From 7b82561e2953a97c78686883c117a2da2f34c66c Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Mon, 14 Sep 2020 13:38:35 +0200 Subject: [PATCH 1/2] Temporarily remove 'items' from order creation API call --- src/Api/CreateOrderApi.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Api/CreateOrderApi.php b/src/Api/CreateOrderApi.php index 7fafade8..17d657ee 100644 --- a/src/Api/CreateOrderApi.php +++ b/src/Api/CreateOrderApi.php @@ -100,7 +100,8 @@ public function create(string $token, PaymentInterface $payment, string $referen ], ], 'soft_descriptor' => 'Sylius PayPal Payment', - 'items' => $payPalItemData['items'], + // TODO: figure out how to update items while updating PayPal order +// 'items' => $payPalItemData['items'], ], ], 'application_context' => [ From 2d57e7bdd44ede5f11345663187384b904bb1fda Mon Sep 17 00:00:00 2001 From: Mateusz Zalewski Date: Mon, 14 Sep 2020 13:53:19 +0200 Subject: [PATCH 2/2] Remove items from spec --- spec/Api/CreateOrderApiSpec.php | 60 +++++---------------------------- 1 file changed, 9 insertions(+), 51 deletions(-) diff --git a/spec/Api/CreateOrderApiSpec.php b/spec/Api/CreateOrderApiSpec.php index 5c9c451b..846c8e25 100644 --- a/spec/Api/CreateOrderApiSpec.php +++ b/spec/Api/CreateOrderApiSpec.php @@ -94,11 +94,8 @@ function it_creates_pay_pal_order_based_on_given_payment( $data['purchase_units'][0]['amount']['value'] === 100 && $data['purchase_units'][0]['amount']['currency_code'] === 'PLN' && $data['purchase_units'][0]['amount']['breakdown']['shipping']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['amount']['breakdown']['shipping']['value'] === 10 && - $data['purchase_units'][0]['items'][0]['name'] === 'PRODUCT_ONE' && - $data['purchase_units'][0]['items'][0]['quantity'] === 1 && - $data['purchase_units'][0]['items'][0]['unit_amount']['value'] === 90 && - $data['purchase_units'][0]['items'][0]['unit_amount']['currency_code'] === 'PLN'; + $data['purchase_units'][0]['amount']['breakdown']['shipping']['value'] === 10 + ; }) )->willReturn(['status' => 'CREATED', 'id' => 123]); @@ -169,11 +166,8 @@ function it_creates_pay_pal_order_with_shipping_address_based_on_given_payment( $data['purchase_units'][0]['shipping']['address']['address_line_1'] === 'Hobbit St. 123' && $data['purchase_units'][0]['shipping']['address']['admin_area_2'] === 'Minas Tirith' && $data['purchase_units'][0]['shipping']['address']['postal_code'] === '000' && - $data['purchase_units'][0]['shipping']['address']['country_code'] === 'US' && - $data['purchase_units'][0]['items'][0]['name'] === 'PRODUCT_ONE' && - $data['purchase_units'][0]['items'][0]['quantity'] === 1 && - $data['purchase_units'][0]['items'][0]['unit_amount']['value'] === 90 && - $data['purchase_units'][0]['items'][0]['unit_amount']['currency_code'] === 'PLN'; + $data['purchase_units'][0]['shipping']['address']['country_code'] === 'US' + ; }) )->willReturn(['status' => 'CREATED', 'id' => 123]); @@ -255,15 +249,8 @@ function it_creates_pay_pal_order_with_more_than_one_product( $data['purchase_units'][0]['shipping']['address']['address_line_1'] === 'Hobbit St. 123' && $data['purchase_units'][0]['shipping']['address']['admin_area_2'] === 'Minas Tirith' && $data['purchase_units'][0]['shipping']['address']['postal_code'] === '000' && - $data['purchase_units'][0]['shipping']['address']['country_code'] === 'US' && - $data['purchase_units'][0]['items'][0]['name'] === 'PRODUCT_ONE' && - $data['purchase_units'][0]['items'][0]['quantity'] === 1 && - $data['purchase_units'][0]['items'][0]['unit_amount']['value'] === 90 && - $data['purchase_units'][0]['items'][0]['unit_amount']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][1]['name'] === 'PRODUCT_TWO' && - $data['purchase_units'][0]['items'][1]['quantity'] === 2 && - $data['purchase_units'][0]['items'][1]['unit_amount']['value'] === 40 && - $data['purchase_units'][0]['items'][1]['unit_amount']['currency_code'] === 'PLN'; + $data['purchase_units'][0]['shipping']['address']['country_code'] === 'US' + ; }) )->willReturn(['status' => 'CREATED', 'id' => 123]); @@ -345,19 +332,8 @@ function it_creates_pay_pal_order_with_non_neutral_tax_and_changed_quantity( $data['purchase_units'][0]['shipping']['address']['address_line_1'] === 'Hobbit St. 123' && $data['purchase_units'][0]['shipping']['address']['admin_area_2'] === 'Minas Tirith' && $data['purchase_units'][0]['shipping']['address']['postal_code'] === '000' && - $data['purchase_units'][0]['shipping']['address']['country_code'] === 'US' && - $data['purchase_units'][0]['items'][0]['name'] === 'PRODUCT_ONE' && - $data['purchase_units'][0]['items'][0]['quantity'] === 1 && - $data['purchase_units'][0]['items'][0]['unit_amount']['value'] === 50 && - $data['purchase_units'][0]['items'][0]['unit_amount']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][0]['tax']['value'] === 10 && - $data['purchase_units'][0]['items'][0]['tax']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][1]['name'] === 'PRODUCT_ONE' && - $data['purchase_units'][0]['items'][1]['quantity'] === 1 && - $data['purchase_units'][0]['items'][1]['unit_amount']['value'] === 50 && - $data['purchase_units'][0]['items'][1]['unit_amount']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][1]['tax']['value'] === 10 && - $data['purchase_units'][0]['items'][1]['tax']['currency_code'] === 'PLN'; + $data['purchase_units'][0]['shipping']['address']['country_code'] === 'US' + ; }) )->willReturn(['status' => 'CREATED', 'id' => 123]); @@ -451,25 +427,7 @@ function it_creates_pay_pal_order_with_more_than_one_product_with_different_tax_ $data['purchase_units'][0]['shipping']['address']['address_line_1'] === 'Hobbit St. 123' && $data['purchase_units'][0]['shipping']['address']['admin_area_2'] === 'Minas Tirith' && $data['purchase_units'][0]['shipping']['address']['postal_code'] === '000' && - $data['purchase_units'][0]['shipping']['address']['country_code'] === 'US' && - $data['purchase_units'][0]['items'][0]['name'] === 'PRODUCT_ONE' && - $data['purchase_units'][0]['items'][0]['quantity'] === 1 && - $data['purchase_units'][0]['items'][0]['unit_amount']['value'] === 90 && - $data['purchase_units'][0]['items'][0]['unit_amount']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][0]['tax']['value'] === 2 && - $data['purchase_units'][0]['items'][0]['tax']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][1]['name'] === 'PRODUCT_TWO' && - $data['purchase_units'][0]['items'][1]['quantity'] === 1 && - $data['purchase_units'][0]['items'][1]['unit_amount']['value'] === 40 && - $data['purchase_units'][0]['items'][1]['unit_amount']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][1]['tax']['value'] === 1 && - $data['purchase_units'][0]['items'][1]['tax']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][2]['name'] === 'PRODUCT_TWO' && - $data['purchase_units'][0]['items'][2]['quantity'] === 1 && - $data['purchase_units'][0]['items'][2]['unit_amount']['value'] === 40 && - $data['purchase_units'][0]['items'][2]['unit_amount']['currency_code'] === 'PLN' && - $data['purchase_units'][0]['items'][2]['tax']['value'] === 1 && - $data['purchase_units'][0]['items'][2]['tax']['currency_code'] === 'PLN' + $data['purchase_units'][0]['shipping']['address']['country_code'] === 'US' ; }) )->willReturn(['status' => 'CREATED', 'id' => 123]);