From 8aee02368d5097d141a1a9f2d4382a5d2b4bda51 Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Fri, 25 Sep 2020 00:44:59 +0200 Subject: [PATCH] Inform about sandbox mode in README --- README.md | 12 ++++++++++++ spec/Api/WebhookApiSpec.php | 8 ++++---- src/Api/WebhookApi.php | 2 +- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 44419c3b..9f6c5b9c 100644 --- a/README.md +++ b/README.md @@ -91,6 +91,18 @@ Sylius Core Team’s plugin for [PayPal Commerce Platform](https://www.paypal.co To make PayPal integration working, your local Sylius URL should be accessible for the PayPal servers. Therefore you can add the proper directive to your `/etc/hosts` (something like `127.0.0.1 sylius.local`) or use a service as [ngrok](https://ngrok.com/). +#### Sandbox vs Live + +By default, plugin operates in the sandbox mode. I means all the transactions would be used with the sandbox URLs and code. +To change it, you need to configure the plugin properly: + +```yaml +sylius_pay_pal: + sandbox: false +``` + +You can, for example, configure it only for the production environment (e.g. in `config/packages/prod/sylius_pay_pal_plugin.yaml`). + ## PayPal reports To be able to download reports about your payouts, you need to have reports feature enabled on your PayPal account. Also, diff --git a/spec/Api/WebhookApiSpec.php b/spec/Api/WebhookApiSpec.php index d43422ab..bb6165e5 100644 --- a/spec/Api/WebhookApiSpec.php +++ b/spec/Api/WebhookApiSpec.php @@ -35,13 +35,13 @@ function it_registers_webhook( 'event_types' => [ ['name' => 'PAYMENT.CAPTURE.REFUNDED'], ], - ] + ], ] )->willReturn($response); $response->getBody()->willReturn($body); $body->getContents()->willReturn('{ "status": "CREATED" }'); - $this->register('TOKEN', 'https://webhook.com')->shouldReturn(['status' => 'CREATED']);; + $this->register('TOKEN', 'https://webhook.com')->shouldReturn(['status' => 'CREATED']); } function it_registers_webhook_without_https( @@ -63,12 +63,12 @@ function it_registers_webhook_without_https( 'event_types' => [ ['name' => 'PAYMENT.CAPTURE.REFUNDED'], ], - ] + ], ] )->willReturn($response); $response->getBody()->willReturn($body); $body->getContents()->willReturn('{ "status": "CREATED" }'); - $this->register('TOKEN', 'http://webhook.com')->shouldReturn(['status' => 'CREATED']);; + $this->register('TOKEN', 'http://webhook.com')->shouldReturn(['status' => 'CREATED']); } } diff --git a/src/Api/WebhookApi.php b/src/Api/WebhookApi.php index 0fcd0038..e73887ce 100644 --- a/src/Api/WebhookApi.php +++ b/src/Api/WebhookApi.php @@ -33,7 +33,7 @@ public function register(string $token, string $webhookUrl): array 'event_types' => [ ['name' => 'PAYMENT.CAPTURE.REFUNDED'], ], - ] + ], ]); return (array) json_decode($response->getBody()->getContents(), true);