From 2ae1fff19cd5245385f91bd42342b7970ce36797 Mon Sep 17 00:00:00 2001 From: SirDomin Date: Tue, 25 Aug 2020 12:50:18 +0200 Subject: [PATCH 1/6] provder + spec --- spec/Provider/PayPalOrderProviderSpec.php | 53 +++++++++++++++++++ .../Webhook/CompleteOrderAction.php | 31 +++++++++++ src/Provider/PayPalOrderProvider.php | 33 ++++++++++++ src/Provider/PayPalOrderProviderInterface.php | 13 +++++ src/Resources/config/services.xml | 7 +++ src/Resources/config/services/controller.xml | 4 ++ src/Resources/config/webhook_routing.yaml | 6 +++ 7 files changed, 147 insertions(+) create mode 100644 spec/Provider/PayPalOrderProviderSpec.php create mode 100644 src/Controller/Webhook/CompleteOrderAction.php create mode 100644 src/Provider/PayPalOrderProvider.php create mode 100644 src/Provider/PayPalOrderProviderInterface.php diff --git a/spec/Provider/PayPalOrderProviderSpec.php b/spec/Provider/PayPalOrderProviderSpec.php new file mode 100644 index 00000000..72e9f875 --- /dev/null +++ b/spec/Provider/PayPalOrderProviderSpec.php @@ -0,0 +1,53 @@ +beConstructedWith($paymentProvider); + } + + function it_provides_data_by_request_if_order_is_found( + Request $request, + PaymentProviderInterface $paymentProvider, + OrderInterface $order, + PaymentInterface $payment + ): void { + $request->getContent(false)->willReturn('{"resource":{"id":"PAYP_ORDER_ID"}}'); + + $paymentProvider->getByPayPalOrderId('PAYP_ORDER_ID')->willReturn($payment); + + $payment->getOrder()->willReturn($order); + + $this->provide($request)->shouldReturn($order); + } + + function it_throws_error_if_request_is_not_valid( + Request $request + ): void { + $request->getContent(false)->willReturn('{}'); + + $this->shouldThrow(\InvalidArgumentException::class)->during('provide', [$request]); + } + + function it_throws_error_if_payment_is_not_found( + Request $request, + PaymentProviderInterface $paymentProvider + ): void { + $request->getContent(false)->willReturn('{"resource":{"id":"WRONG_ID"}}'); + $paymentProvider->getByPayPalOrderId('WRONG_ID')->willThrow(PaymentNotFoundException::class); + + $this->shouldThrow(PaymentNotFoundException::class)->during('provide', [$request]); + } +} diff --git a/src/Controller/Webhook/CompleteOrderAction.php b/src/Controller/Webhook/CompleteOrderAction.php new file mode 100644 index 00000000..4610b229 --- /dev/null +++ b/src/Controller/Webhook/CompleteOrderAction.php @@ -0,0 +1,31 @@ +orderProvider = $orderProvider; + } + + public function __invoke(Request $request): Response + { + $order = $this->orderProvider->provide($request); + + return new JsonResponse( + ['tet' => $order->getShippingAddress()->getCity()] + ); + } +} diff --git a/src/Provider/PayPalOrderProvider.php b/src/Provider/PayPalOrderProvider.php new file mode 100644 index 00000000..45357eb9 --- /dev/null +++ b/src/Provider/PayPalOrderProvider.php @@ -0,0 +1,33 @@ +paymentProvider = $paymentProvider; + } + + public function provide(Request $request): OrderInterface + { + $content = (array) json_decode((string) $request->getContent(false), true); + Assert::keyExists($content, 'resource'); + $resource = (array) $content['resource']; + Assert::keyExists($resource, 'id'); + + $payment = $this->paymentProvider->getByPayPalOrderId($resource['id']); + Assert::notNull($payment); + + return $payment->getOrder(); + } +} diff --git a/src/Provider/PayPalOrderProviderInterface.php b/src/Provider/PayPalOrderProviderInterface.php new file mode 100644 index 00000000..cb8df402 --- /dev/null +++ b/src/Provider/PayPalOrderProviderInterface.php @@ -0,0 +1,13 @@ + + + + + diff --git a/src/Resources/config/services/controller.xml b/src/Resources/config/services/controller.xml index df16700c..cf2847ed 100644 --- a/src/Resources/config/services/controller.xml +++ b/src/Resources/config/services/controller.xml @@ -10,6 +10,10 @@ + + + + diff --git a/src/Resources/config/webhook_routing.yaml b/src/Resources/config/webhook_routing.yaml index cc93decf..100d81c8 100644 --- a/src/Resources/config/webhook_routing.yaml +++ b/src/Resources/config/webhook_routing.yaml @@ -3,3 +3,9 @@ sylius_paypal_plugin_webhook_refund_order: methods: [POST] defaults: _controller: Sylius\PayPalPlugin\Controller\Webhook\RefundOrderAction + +sylius_paypal_webhook_complete_order: + path: /paypal-webhook/api/complete-order/ + methods: [POST] + defaults: + _controller: Sylius\PayPalPlugin\Controller\Webhook\CompleteOrderAction From e824c24f56db87ac2c38ac111777522bbaf213a3 Mon Sep 17 00:00:00 2001 From: SirDomin Date: Tue, 25 Aug 2020 13:55:59 +0200 Subject: [PATCH 2/6] code standards --- psalm.xml | 3 ++ .../Webhook/CompleteOrderAction.php | 49 +++++++++++++++++-- src/Provider/PayPalOrderProvider.php | 8 +-- src/Resources/config/services/controller.xml | 1 + 4 files changed, 53 insertions(+), 8 deletions(-) diff --git a/psalm.xml b/psalm.xml index 426c506d..2f7d7dbf 100644 --- a/psalm.xml +++ b/psalm.xml @@ -29,6 +29,7 @@ + @@ -36,12 +37,14 @@ + + diff --git a/src/Controller/Webhook/CompleteOrderAction.php b/src/Controller/Webhook/CompleteOrderAction.php index 4610b229..967f62c2 100644 --- a/src/Controller/Webhook/CompleteOrderAction.php +++ b/src/Controller/Webhook/CompleteOrderAction.php @@ -4,28 +4,67 @@ namespace Sylius\PayPalPlugin\Controller\Webhook; +use Doctrine\Persistence\ObjectManager; +use Sylius\Component\Core\Model\AddressInterface; use Sylius\PayPalPlugin\Provider\PayPalOrderProviderInterface; -use Symfony\Component\HttpFoundation\JsonResponse; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; +use Webmozart\Assert\Assert; final class CompleteOrderAction { /** @var PayPalOrderProviderInterface */ private $orderProvider; + /** @var ObjectManager */ + private $objectManager; + public function __construct( - PayPalOrderProviderInterface $orderProvider + PayPalOrderProviderInterface $orderProvider, + ObjectManager $objectManager ) { $this->orderProvider = $orderProvider; + $this->objectManager = $objectManager; } public function __invoke(Request $request): Response { $order = $this->orderProvider->provide($request); - return new JsonResponse( - ['tet' => $order->getShippingAddress()->getCity()] - ); + $payPalAddress = $this->getAddressFromRequest($request); + + /** @var AddressInterface $orderAddress */ + $orderAddress = $order->getShippingAddress(); + + $orderAddress->setCity($payPalAddress['city']); + $orderAddress->setStreet($payPalAddress['street']); + $orderAddress->setPostcode($payPalAddress['post_code']); + $orderAddress->setCountryCode($payPalAddress['country_code']); + + $this->objectManager->flush(); + + return new Response('', Response::HTTP_NO_CONTENT); + } + + private function getAddressFromRequest(Request $request): array + { + $content = (array) json_decode((string) $request->getContent(false), true); + $resource = $content['resource']; + + Assert::keyExists($resource, 'purchase_units'); + $purchaseUnits = $resource['purchase_units'][0]; + + Assert::keyExists($purchaseUnits, 'shipping'); + $shipping = $purchaseUnits['shipping']; + + Assert::keyExists($shipping, 'address'); + $address = $shipping['address']; + + return [ + 'city' => (string) $address['admin_area_2'], + 'street' => (string) $address['address_line_1'] . (string) $address['address_line_2'], + 'post_code' => (string) $address['postal_code'], + 'country_code' => (string) $address['country_code'], + ]; } } diff --git a/src/Provider/PayPalOrderProvider.php b/src/Provider/PayPalOrderProvider.php index 45357eb9..d3ac1b17 100644 --- a/src/Provider/PayPalOrderProvider.php +++ b/src/Provider/PayPalOrderProvider.php @@ -25,9 +25,11 @@ public function provide(Request $request): OrderInterface $resource = (array) $content['resource']; Assert::keyExists($resource, 'id'); - $payment = $this->paymentProvider->getByPayPalOrderId($resource['id']); - Assert::notNull($payment); + $payment = $this->paymentProvider->getByPayPalOrderId((string) $resource['id']); - return $payment->getOrder(); + $order = $payment->getOrder(); + Assert::notNull($order); + + return $order; } } diff --git a/src/Resources/config/services/controller.xml b/src/Resources/config/services/controller.xml index cf2847ed..77b421df 100644 --- a/src/Resources/config/services/controller.xml +++ b/src/Resources/config/services/controller.xml @@ -12,6 +12,7 @@ + From 147e04cb0d202340b54b20698f9df6a8a2533038 Mon Sep 17 00:00:00 2001 From: SirDomin Date: Thu, 27 Aug 2020 12:37:34 +0200 Subject: [PATCH 3/6] webhook removed, address is changed while completing order --- psalm.xml | 4 +- spec/Processor/PayPalAddressProcessorSpec.php | 29 ++++++++ .../Webhook/CompleteOrderAction.php | 70 ------------------- src/Payum/Action/CompleteOrderAction.php | 10 ++- src/Processor/PayPalAddressProcessor.php | 45 ++++++++++++ src/Resources/config/services.xml | 4 ++ src/Resources/config/services/controller.xml | 7 +- src/Resources/config/services/payum.xml | 1 + src/Resources/config/webhook_routing.yaml | 6 -- 9 files changed, 91 insertions(+), 85 deletions(-) create mode 100644 spec/Processor/PayPalAddressProcessorSpec.php delete mode 100644 src/Controller/Webhook/CompleteOrderAction.php create mode 100644 src/Processor/PayPalAddressProcessor.php diff --git a/psalm.xml b/psalm.xml index 2f7d7dbf..1d6e59e2 100644 --- a/psalm.xml +++ b/psalm.xml @@ -29,7 +29,7 @@ - + @@ -37,14 +37,12 @@ - - diff --git a/spec/Processor/PayPalAddressProcessorSpec.php b/spec/Processor/PayPalAddressProcessorSpec.php new file mode 100644 index 00000000..97b31d91 --- /dev/null +++ b/spec/Processor/PayPalAddressProcessorSpec.php @@ -0,0 +1,29 @@ +beConstructedWith($objectManager); + } + + function it_throws_error_if_address_data_is_missing( + OrderInterface $order, + AddressInterface $orderAddress, + ObjectManager $objectManager + ): void { + $order->getShippingAddress()->willReturn($orderAddress); + + $objectManager->flush()->shouldNotBeCalled(); + $this->shouldThrow(\InvalidArgumentException::class)->during('process', [[], $order]); + } +} diff --git a/src/Controller/Webhook/CompleteOrderAction.php b/src/Controller/Webhook/CompleteOrderAction.php deleted file mode 100644 index 967f62c2..00000000 --- a/src/Controller/Webhook/CompleteOrderAction.php +++ /dev/null @@ -1,70 +0,0 @@ -orderProvider = $orderProvider; - $this->objectManager = $objectManager; - } - - public function __invoke(Request $request): Response - { - $order = $this->orderProvider->provide($request); - - $payPalAddress = $this->getAddressFromRequest($request); - - /** @var AddressInterface $orderAddress */ - $orderAddress = $order->getShippingAddress(); - - $orderAddress->setCity($payPalAddress['city']); - $orderAddress->setStreet($payPalAddress['street']); - $orderAddress->setPostcode($payPalAddress['post_code']); - $orderAddress->setCountryCode($payPalAddress['country_code']); - - $this->objectManager->flush(); - - return new Response('', Response::HTTP_NO_CONTENT); - } - - private function getAddressFromRequest(Request $request): array - { - $content = (array) json_decode((string) $request->getContent(false), true); - $resource = $content['resource']; - - Assert::keyExists($resource, 'purchase_units'); - $purchaseUnits = $resource['purchase_units'][0]; - - Assert::keyExists($purchaseUnits, 'shipping'); - $shipping = $purchaseUnits['shipping']; - - Assert::keyExists($shipping, 'address'); - $address = $shipping['address']; - - return [ - 'city' => (string) $address['admin_area_2'], - 'street' => (string) $address['address_line_1'] . (string) $address['address_line_2'], - 'post_code' => (string) $address['postal_code'], - 'country_code' => (string) $address['country_code'], - ]; - } -} diff --git a/src/Payum/Action/CompleteOrderAction.php b/src/Payum/Action/CompleteOrderAction.php index 70fce659..a82f3228 100644 --- a/src/Payum/Action/CompleteOrderAction.php +++ b/src/Payum/Action/CompleteOrderAction.php @@ -23,6 +23,7 @@ use Sylius\PayPalPlugin\Api\CompleteOrderApiInterface; use Sylius\PayPalPlugin\Api\UpdateOrderApiInterface; use Sylius\PayPalPlugin\Payum\Request\CompleteOrder; +use Sylius\PayPalPlugin\Processor\PayPalAddressProcessor; final class CompleteOrderAction implements ActionInterface { @@ -35,14 +36,19 @@ final class CompleteOrderAction implements ActionInterface /** @var CompleteOrderApiInterface */ private $completeOrderApi; + /** @var PayPalAddressProcessor */ + private $payPalAddressProcessor; + public function __construct( AuthorizeClientApiInterface $authorizeClientApi, UpdateOrderApiInterface $updateOrderApi, - CompleteOrderApiInterface $completeOrderApi + CompleteOrderApiInterface $completeOrderApi, + PayPalAddressProcessor $payPalAddressProcessor ) { $this->authorizeClientApi = $authorizeClientApi; $this->updateOrderApi = $updateOrderApi; $this->completeOrderApi = $completeOrderApi; + $this->payPalAddressProcessor = $payPalAddressProcessor; } /** @param CompleteOrder $request */ @@ -86,6 +92,8 @@ public function execute($request): void 'paypal_order_id' => $content['id'], 'paypal_payment_id' => $content['purchase_units'][0]['payments']['captures'][0]['id'], ]); + + $this->payPalAddressProcessor->process($content['purchase_units'][0]['shipping']['address'], $order); } } diff --git a/src/Processor/PayPalAddressProcessor.php b/src/Processor/PayPalAddressProcessor.php new file mode 100644 index 00000000..14528840 --- /dev/null +++ b/src/Processor/PayPalAddressProcessor.php @@ -0,0 +1,45 @@ +objectManager = $objectManager; + } + + /** + * @param array $address + */ + public function process(array $address, OrderInterface $order): void + { + /** @var AddressInterface $orderAddress */ + $orderAddress = $order->getShippingAddress(); + + Assert::keyExists($address, 'admin_area_2'); + Assert::keyExists($address, 'address_line_1'); + Assert::keyExists($address, 'postal_code'); + Assert::keyExists($address, 'country_code'); + + $street = $address['address_line_1'] . ($address['address_line_2'] ?? ''); + + $orderAddress->setCity($address['admin_area_2']); + $orderAddress->setStreet($street); + $orderAddress->setPostcode($address['postal_code']); + $orderAddress->setCountryCode($address['country_code']); + + $this->objectManager->flush(); + } +} diff --git a/src/Resources/config/services.xml b/src/Resources/config/services.xml index 75ee28d2..b7de9e7e 100644 --- a/src/Resources/config/services.xml +++ b/src/Resources/config/services.xml @@ -153,5 +153,9 @@ %sylius.form.type.checkout_select_payment.validation_groups% + + + + diff --git a/src/Resources/config/services/controller.xml b/src/Resources/config/services/controller.xml index 77b421df..cf6afbb3 100644 --- a/src/Resources/config/services/controller.xml +++ b/src/Resources/config/services/controller.xml @@ -10,11 +10,6 @@ - - - - - @@ -33,6 +28,8 @@ + + diff --git a/src/Resources/config/services/payum.xml b/src/Resources/config/services/payum.xml index 9b591168..82e17876 100644 --- a/src/Resources/config/services/payum.xml +++ b/src/Resources/config/services/payum.xml @@ -24,6 +24,7 @@ + diff --git a/src/Resources/config/webhook_routing.yaml b/src/Resources/config/webhook_routing.yaml index 100d81c8..cc93decf 100644 --- a/src/Resources/config/webhook_routing.yaml +++ b/src/Resources/config/webhook_routing.yaml @@ -3,9 +3,3 @@ sylius_paypal_plugin_webhook_refund_order: methods: [POST] defaults: _controller: Sylius\PayPalPlugin\Controller\Webhook\RefundOrderAction - -sylius_paypal_webhook_complete_order: - path: /paypal-webhook/api/complete-order/ - methods: [POST] - defaults: - _controller: Sylius\PayPalPlugin\Controller\Webhook\CompleteOrderAction From 9a04e78245d70b9e9e3a8368aaecaa5394a44bc6 Mon Sep 17 00:00:00 2001 From: SirDomin Date: Fri, 28 Aug 2020 10:33:25 +0200 Subject: [PATCH 4/6] removed unused service --- spec/Provider/PayPalOrderProviderSpec.php | 53 ------------------- src/Provider/PayPalOrderProvider.php | 35 ------------ src/Provider/PayPalOrderProviderInterface.php | 13 ----- 3 files changed, 101 deletions(-) delete mode 100644 spec/Provider/PayPalOrderProviderSpec.php delete mode 100644 src/Provider/PayPalOrderProvider.php delete mode 100644 src/Provider/PayPalOrderProviderInterface.php diff --git a/spec/Provider/PayPalOrderProviderSpec.php b/spec/Provider/PayPalOrderProviderSpec.php deleted file mode 100644 index 72e9f875..00000000 --- a/spec/Provider/PayPalOrderProviderSpec.php +++ /dev/null @@ -1,53 +0,0 @@ -beConstructedWith($paymentProvider); - } - - function it_provides_data_by_request_if_order_is_found( - Request $request, - PaymentProviderInterface $paymentProvider, - OrderInterface $order, - PaymentInterface $payment - ): void { - $request->getContent(false)->willReturn('{"resource":{"id":"PAYP_ORDER_ID"}}'); - - $paymentProvider->getByPayPalOrderId('PAYP_ORDER_ID')->willReturn($payment); - - $payment->getOrder()->willReturn($order); - - $this->provide($request)->shouldReturn($order); - } - - function it_throws_error_if_request_is_not_valid( - Request $request - ): void { - $request->getContent(false)->willReturn('{}'); - - $this->shouldThrow(\InvalidArgumentException::class)->during('provide', [$request]); - } - - function it_throws_error_if_payment_is_not_found( - Request $request, - PaymentProviderInterface $paymentProvider - ): void { - $request->getContent(false)->willReturn('{"resource":{"id":"WRONG_ID"}}'); - $paymentProvider->getByPayPalOrderId('WRONG_ID')->willThrow(PaymentNotFoundException::class); - - $this->shouldThrow(PaymentNotFoundException::class)->during('provide', [$request]); - } -} diff --git a/src/Provider/PayPalOrderProvider.php b/src/Provider/PayPalOrderProvider.php deleted file mode 100644 index d3ac1b17..00000000 --- a/src/Provider/PayPalOrderProvider.php +++ /dev/null @@ -1,35 +0,0 @@ -paymentProvider = $paymentProvider; - } - - public function provide(Request $request): OrderInterface - { - $content = (array) json_decode((string) $request->getContent(false), true); - Assert::keyExists($content, 'resource'); - $resource = (array) $content['resource']; - Assert::keyExists($resource, 'id'); - - $payment = $this->paymentProvider->getByPayPalOrderId((string) $resource['id']); - - $order = $payment->getOrder(); - Assert::notNull($order); - - return $order; - } -} diff --git a/src/Provider/PayPalOrderProviderInterface.php b/src/Provider/PayPalOrderProviderInterface.php deleted file mode 100644 index cb8df402..00000000 --- a/src/Provider/PayPalOrderProviderInterface.php +++ /dev/null @@ -1,13 +0,0 @@ - Date: Mon, 31 Aug 2020 12:03:36 +0200 Subject: [PATCH 5/6] Improve PayPalAddressProcessor specs --- spec/Processor/PayPalAddressProcessorSpec.php | 59 ++++++++++++++++++- src/Processor/PayPalAddressProcessor.php | 9 ++- .../PayPalAddressProcessorInterface.php | 15 +++++ 3 files changed, 77 insertions(+), 6 deletions(-) create mode 100644 src/Processor/PayPalAddressProcessorInterface.php diff --git a/spec/Processor/PayPalAddressProcessorSpec.php b/spec/Processor/PayPalAddressProcessorSpec.php index 97b31d91..5bd3cf24 100644 --- a/spec/Processor/PayPalAddressProcessorSpec.php +++ b/spec/Processor/PayPalAddressProcessorSpec.php @@ -8,6 +8,7 @@ use PhpSpec\ObjectBehavior; use Sylius\Component\Core\Model\AddressInterface; use Sylius\Component\Core\Model\OrderInterface; +use Sylius\PayPalPlugin\Processor\PayPalAddressProcessorInterface; final class PayPalAddressProcessorSpec extends ObjectBehavior { @@ -16,7 +17,63 @@ function let(ObjectManager $objectManager): void $this->beConstructedWith($objectManager); } - function it_throws_error_if_address_data_is_missing( + function it_implements_pay_pal_address_processor_interface(): void + { + $this->shouldImplement(PayPalAddressProcessorInterface::class); + } + + function it_updates_order_address( + OrderInterface $order, + AddressInterface $orderAddress, + ObjectManager $objectManager + ): void { + $order->getShippingAddress()->willReturn($orderAddress); + + $orderAddress->setCity('New York')->shouldBeCalled(); + $orderAddress->setStreet('Main St. 123')->shouldBeCalled(); + $orderAddress->setPostcode('10001')->shouldBeCalled(); + $orderAddress->setCountryCode('US')->shouldBeCalled(); + + $objectManager->flush()->shouldBeCalled(); + + $this->process( + [ + 'address_line_1' => 'Main St. 123', + 'admin_area_2' => 'New York', + 'postal_code' => '10001', + 'country_code' => 'US', + ], + $order + ); + } + + function it_updates_order_address_with_two_address_lines( + OrderInterface $order, + AddressInterface $orderAddress, + ObjectManager $objectManager + ): void { + $order->getShippingAddress()->willReturn($orderAddress); + + $orderAddress->setCity('New York')->shouldBeCalled(); + $orderAddress->setStreet('Main St. 123')->shouldBeCalled(); + $orderAddress->setPostcode('10001')->shouldBeCalled(); + $orderAddress->setCountryCode('US')->shouldBeCalled(); + + $objectManager->flush()->shouldBeCalled(); + + $this->process( + [ + 'address_line_1' => 'Main St.', + 'address_line_2' => '123', + 'admin_area_2' => 'New York', + 'postal_code' => '10001', + 'country_code' => 'US', + ], + $order + ); + } + + function it_throws_an_exception_if_address_data_is_missing( OrderInterface $order, AddressInterface $orderAddress, ObjectManager $objectManager diff --git a/src/Processor/PayPalAddressProcessor.php b/src/Processor/PayPalAddressProcessor.php index 14528840..defb813b 100644 --- a/src/Processor/PayPalAddressProcessor.php +++ b/src/Processor/PayPalAddressProcessor.php @@ -9,14 +9,13 @@ use Sylius\Component\Core\Model\OrderInterface; use Webmozart\Assert\Assert; -final class PayPalAddressProcessor +final class PayPalAddressProcessor implements PayPalAddressProcessorInterface { /** @var ObjectManager */ private $objectManager; - public function __construct( - ObjectManager $objectManager - ) { + public function __construct(ObjectManager $objectManager) + { $this->objectManager = $objectManager; } @@ -33,7 +32,7 @@ public function process(array $address, OrderInterface $order): void Assert::keyExists($address, 'postal_code'); Assert::keyExists($address, 'country_code'); - $street = $address['address_line_1'] . ($address['address_line_2'] ?? ''); + $street = $address['address_line_1'] . (isset($address['address_line_2']) ? ' ' . $address['address_line_2'] : ''); $orderAddress->setCity($address['admin_area_2']); $orderAddress->setStreet($street); diff --git a/src/Processor/PayPalAddressProcessorInterface.php b/src/Processor/PayPalAddressProcessorInterface.php new file mode 100644 index 00000000..bd87fadd --- /dev/null +++ b/src/Processor/PayPalAddressProcessorInterface.php @@ -0,0 +1,15 @@ + $address + */ + public function process(array $address, OrderInterface $order): void; +} From ddfc5fcaa09ea3ff6f157ea6c1da6525800a9b89 Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Mon, 31 Aug 2020 12:44:14 +0200 Subject: [PATCH 6/6] Fix typo in javascript resulting failing payment-page payment functionality --- src/Resources/views/payFromPaymentPage.html.twig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Resources/views/payFromPaymentPage.html.twig b/src/Resources/views/payFromPaymentPage.html.twig index c4187bb7..6443ff76 100644 --- a/src/Resources/views/payFromPaymentPage.html.twig +++ b/src/Resources/views/payFromPaymentPage.html.twig @@ -20,7 +20,7 @@ method: 'post' }).then(function(res) { return res.status === 400 ? window.location.reload() : res.json(); - }).then(data => data.orderID); + }).then(data => data.order_id); }, onApprove: function(data, actions) { return fetch(completePayPalOrderFromPaymentPageUrl, {