From 4e17d1b12fecf78711f3150d223cdd712111b018 Mon Sep 17 00:00:00 2001 From: Vildan Bina Date: Sat, 9 Nov 2024 20:52:01 +0100 Subject: [PATCH] add ArticleProductUrl and ArticleImageUrl to KlarnaKP reserve payload --- .../KlarnaKP/Models/Article.php | 27 +++++++++++++++++++ .../KlarnaKP/Models/Payload.php | 1 - .../Service/ParameterKeys/ArticleAdapter.php | 2 ++ tests/Buckaroo/Payments/KlarnaKPTest.php | 9 +++++++ 4 files changed, 38 insertions(+), 1 deletion(-) create mode 100644 src/PaymentMethods/KlarnaKP/Models/Article.php diff --git a/src/PaymentMethods/KlarnaKP/Models/Article.php b/src/PaymentMethods/KlarnaKP/Models/Article.php new file mode 100644 index 00000000..a734e884 --- /dev/null +++ b/src/PaymentMethods/KlarnaKP/Models/Article.php @@ -0,0 +1,27 @@ + 'ArticlePrice', 'quantity' => 'ArticleQuantity', 'vatPercentage' => 'ArticleVat', + 'imageUrl' => 'ArticleImageUrl', + 'productUrl' => 'ArticleProductUrl', ]; } diff --git a/tests/Buckaroo/Payments/KlarnaKPTest.php b/tests/Buckaroo/Payments/KlarnaKPTest.php index 1395746f..dc1a69d6 100644 --- a/tests/Buckaroo/Payments/KlarnaKPTest.php +++ b/tests/Buckaroo/Payments/KlarnaKPTest.php @@ -111,6 +111,8 @@ public function it_creates_a_klarnakp_update_reservation() 'vatPercentage' => '21', 'quantity' => '2', 'price' => '20.10', + 'imageUrl' => 'https://example.com/image', + 'productUrl' => 'https://example.com/product', ], [ 'identifier' => 'Articlenumber2', @@ -118,6 +120,8 @@ public function it_creates_a_klarnakp_update_reservation() 'vatPercentage' => '21', 'quantity' => '1', 'price' => '10.10', + 'imageUrl' => 'https://example.com/image', + 'productUrl' => 'https://example.com/product', ], ], ]); @@ -143,6 +147,7 @@ public function it_creates_a_klarnakp_refund() private function getPaymentPayload(?array $additional = null): array { $payload = [ + 'clientIP' => '198.162.1.1', 'currency' => 'EUR', 'amountDebit' => 50.30, 'order' => uniqid(), @@ -187,6 +192,8 @@ private function getPaymentPayload(?array $additional = null): array 'vatPercentage' => '21', 'quantity' => '2', 'price' => '20.10', + 'imageUrl' => 'https://example.com/image', + 'productUrl' => 'https://example.com/product', ], [ 'identifier' => 'Articlenumber2', @@ -194,6 +201,8 @@ private function getPaymentPayload(?array $additional = null): array 'vatPercentage' => '21', 'quantity' => '1', 'price' => '10.10', + 'imageUrl' => 'https://example.com/image', + 'productUrl' => 'https://example.com/product', ], ] ];