Skip to content

Commit

Permalink
add ArticleProductUrl and ArticleImageUrl to KlarnaKP reserve payload
Browse files Browse the repository at this point in the history
  • Loading branch information
vildanbina committed Nov 9, 2024
1 parent ed579f4 commit 4e17d1b
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 1 deletion.
27 changes: 27 additions & 0 deletions src/PaymentMethods/KlarnaKP/Models/Article.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php
/*
* NOTICE OF LICENSE
*
* This source file is subject to the MIT License
* It is available through the world-wide-web at this URL:
* https://tldrlegal.com/license/mit-license
* If you are unable to obtain it through the world-wide-web, please send an email
* to support@buckaroo.nl so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade this module to newer
* versions in the future. If you wish to customize this module for your
* needs please contact support@buckaroo.nl for more information.
*
* @copyright Copyright (c) Buckaroo B.V.
* @license https://tldrlegal.com/license/mit-license
*/

namespace Buckaroo\PaymentMethods\KlarnaKP\Models;

class Article extends \Buckaroo\Models\Article
{
protected ?string $imageUrl;
protected ?string $productUrl;
}
1 change: 0 additions & 1 deletion src/PaymentMethods/KlarnaKP/Models/Payload.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

namespace Buckaroo\PaymentMethods\KlarnaKP\Models;

use Buckaroo\Models\Article;
use Buckaroo\Models\ServiceParameter;
use Buckaroo\PaymentMethods\KlarnaKP\Service\ParameterKeys\ArticleAdapter;
use Buckaroo\PaymentMethods\Traits\CountableGroupKey;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,7 @@ class ArticleAdapter extends ServiceParametersKeysAdapter
'price' => 'ArticlePrice',
'quantity' => 'ArticleQuantity',
'vatPercentage' => 'ArticleVat',
'imageUrl' => 'ArticleImageUrl',
'productUrl' => 'ArticleProductUrl',
];
}
9 changes: 9 additions & 0 deletions tests/Buckaroo/Payments/KlarnaKPTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,17 @@ 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',
'description' => 'Red Toy Car',
'vatPercentage' => '21',
'quantity' => '1',
'price' => '10.10',
'imageUrl' => 'https://example.com/image',
'productUrl' => 'https://example.com/product',
],
],
]);
Expand All @@ -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(),
Expand Down Expand Up @@ -187,13 +192,17 @@ 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',
'description' => 'Red Toy Car',
'vatPercentage' => '21',
'quantity' => '1',
'price' => '10.10',
'imageUrl' => 'https://example.com/image',
'productUrl' => 'https://example.com/product',
],
]
];
Expand Down

0 comments on commit 4e17d1b

Please sign in to comment.