From 492bebb8b11f301650f13aa0e8b2694a43a561db Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Thu, 2 May 2024 13:33:22 +0800 Subject: [PATCH 1/4] Adding iDeal Fast Checkout --- src/PaymentMethods/iDeal/iDeal.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/PaymentMethods/iDeal/iDeal.php b/src/PaymentMethods/iDeal/iDeal.php index dbd0761..e0902c4 100644 --- a/src/PaymentMethods/iDeal/iDeal.php +++ b/src/PaymentMethods/iDeal/iDeal.php @@ -53,6 +53,19 @@ public function pay(?Model $model = null) return parent::pay($model ?? new Pay($this->payload)); } + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function payFastCheckout(?Model $model = null) + { + $this->setPayPayload(); + + $this->setServiceList('PayFastCheckout', $model ?? new Pay($this->payload)); + + return $this->postRequest(); + } + /** * @param Model|null $model * @return TransactionResponse From 8f9c8230f68cd154b8cf381dd8065c9fc703fb4f Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Thu, 2 May 2024 13:36:15 +0800 Subject: [PATCH 2/4] Remove CreditClick payment --- example/transactions/credit_click.php | 30 --------- src/PaymentMethods/Billink/Billink.php | 6 +- .../Models/Refund.php | 2 +- .../CreditClick/CreditClick.php | 53 --------------- src/PaymentMethods/CreditClick/Models/Pay.php | 65 ------------------- .../Service/ParameterKeys/CustomerAdapter.php | 32 --------- src/PaymentMethods/PaymentMethodFactory.php | 2 - tests/Buckaroo/Payments/CreditClickTest.php | 61 ----------------- 8 files changed, 4 insertions(+), 247 deletions(-) delete mode 100644 example/transactions/credit_click.php rename src/PaymentMethods/{CreditClick => Billink}/Models/Refund.php (93%) delete mode 100644 src/PaymentMethods/CreditClick/CreditClick.php delete mode 100644 src/PaymentMethods/CreditClick/Models/Pay.php delete mode 100644 src/PaymentMethods/CreditClick/Service/ParameterKeys/CustomerAdapter.php delete mode 100644 tests/Buckaroo/Payments/CreditClickTest.php diff --git a/example/transactions/credit_click.php b/example/transactions/credit_click.php deleted file mode 100644 index 63a3c9f..0000000 --- a/example/transactions/credit_click.php +++ /dev/null @@ -1,30 +0,0 @@ -method('creditclick')->pay([ - 'amountDebit' => 10, - 'invoice' => uniqid(), - 'email' => 'billingcustomer@buckaroo.nl', - 'customer' => [ - 'firstName' => 'Test', - 'lastName' => 'Aflever', - ], -]); - -//Refund -$response = $buckaroo->method('creditclick')->refund([ - 'amountCredit' => 10, - 'invoice' => 'testinvoice 123', - 'description' => 'refund', - 'originalTransactionKey' => '2D04704995B74D679AACC59F87XXXXXX', - 'serviceParameters' => [ - 'reason' => 'RequestedByCustomer', - ], -]); diff --git a/src/PaymentMethods/Billink/Billink.php b/src/PaymentMethods/Billink/Billink.php index 338b970..2de8138 100644 --- a/src/PaymentMethods/Billink/Billink.php +++ b/src/PaymentMethods/Billink/Billink.php @@ -23,7 +23,7 @@ use Buckaroo\Models\Model; use Buckaroo\PaymentMethods\Billink\Models\Capture; use Buckaroo\PaymentMethods\Billink\Models\Pay; -use Buckaroo\PaymentMethods\CreditClick\Models\Refund; +use Buckaroo\PaymentMethods\Billink\Models\Refund; use Buckaroo\PaymentMethods\PayablePaymentMethod; use Buckaroo\Transaction\Response\TransactionResponse; @@ -76,11 +76,11 @@ public function capture(): TransactionResponse */ public function cancelAuthorize(): TransactionResponse { - $pay = new Refund($this->payload); + $cancel = new Refund($this->payload); $this->setPayPayload(); - $this->setServiceList('CancelAuthorize', $pay); + $this->setServiceList('CancelAuthorize', $cancel); return $this->postRequest(); } diff --git a/src/PaymentMethods/CreditClick/Models/Refund.php b/src/PaymentMethods/Billink/Models/Refund.php similarity index 93% rename from src/PaymentMethods/CreditClick/Models/Refund.php rename to src/PaymentMethods/Billink/Models/Refund.php index 881cfd9..2d85848 100644 --- a/src/PaymentMethods/CreditClick/Models/Refund.php +++ b/src/PaymentMethods/Billink/Models/Refund.php @@ -18,7 +18,7 @@ * @license https://tldrlegal.com/license/mit-license */ -namespace Buckaroo\PaymentMethods\CreditClick\Models; +namespace Buckaroo\PaymentMethods\Billink\Models; use Buckaroo\Models\ServiceParameter; diff --git a/src/PaymentMethods/CreditClick/CreditClick.php b/src/PaymentMethods/CreditClick/CreditClick.php deleted file mode 100644 index e1f535d..0000000 --- a/src/PaymentMethods/CreditClick/CreditClick.php +++ /dev/null @@ -1,53 +0,0 @@ -payload)); - } - - /** - * @param Model|null $model - * @return TransactionResponse - */ - public function refund(?Model $model = null): TransactionResponse - { - return parent::refund($model ?? new Refund($this->payload)); - } -} diff --git a/src/PaymentMethods/CreditClick/Models/Pay.php b/src/PaymentMethods/CreditClick/Models/Pay.php deleted file mode 100644 index f5cb5f4..0000000 --- a/src/PaymentMethods/CreditClick/Models/Pay.php +++ /dev/null @@ -1,65 +0,0 @@ -customer = new Person($customer); - } - - return $this->customer; - } - - /** - * @param $email - * @return Email - */ - public function email($email = null) - { - if (is_string($email)) - { - $this->email = new Email($email); - } - - return $this->email; - } -} diff --git a/src/PaymentMethods/CreditClick/Service/ParameterKeys/CustomerAdapter.php b/src/PaymentMethods/CreditClick/Service/ParameterKeys/CustomerAdapter.php deleted file mode 100644 index 6f21cb8..0000000 --- a/src/PaymentMethods/CreditClick/Service/ParameterKeys/CustomerAdapter.php +++ /dev/null @@ -1,32 +0,0 @@ - 'firstname', - 'lastName' => 'lastname', - 'email' => 'email', - ]; -} diff --git a/src/PaymentMethods/PaymentMethodFactory.php b/src/PaymentMethods/PaymentMethodFactory.php index 325405e..3a4d6f3 100644 --- a/src/PaymentMethods/PaymentMethodFactory.php +++ b/src/PaymentMethods/PaymentMethodFactory.php @@ -54,7 +54,6 @@ use Buckaroo\PaymentMethods\CreditCard\CreditCard; use Buckaroo\PaymentMethods\Multibanco\Multibanco; use Buckaroo\PaymentMethods\Przelewy24\Przelewy24; -use Buckaroo\PaymentMethods\CreditClick\CreditClick; use Buckaroo\PaymentMethods\PayPerEmail\PayPerEmail; use Buckaroo\PaymentMethods\PointOfSale\PointOfSale; use Buckaroo\PaymentMethods\BankTransfer\BankTransfer; @@ -90,7 +89,6 @@ class PaymentMethodFactory 'cartebancaire', 'dankort', 'nexi', 'postepay', ], - CreditClick::class => ['creditclick'], CreditManagement::class => ['credit_management'], iDeal::class => ['ideal'], iDealProcessing::class => ['idealprocessing'], diff --git a/tests/Buckaroo/Payments/CreditClickTest.php b/tests/Buckaroo/Payments/CreditClickTest.php deleted file mode 100644 index ab4db2d..0000000 --- a/tests/Buckaroo/Payments/CreditClickTest.php +++ /dev/null @@ -1,61 +0,0 @@ -buckaroo->method('creditclick')->pay([ - 'amountDebit' => 10, - 'invoice' => uniqid(), - 'customer' => [ - 'firstName' => 'Test', - 'lastName' => 'Aflever', - ], - 'email' => 't.tester@test.nl', - ]); - - $this->assertTrue($response->isPendingProcessing()); - } - - /** - * @test - */ - public function it_creates_a_creditclick_refund() - { - $response = $this->buckaroo->method('creditclick')->refund([ - 'amountCredit' => 10, - 'invoice' => 'testinvoice 123', - 'description' => 'refund', - 'originalTransactionKey' => '2D04704995B74D679AACC59F87XXXXXX', - 'refundreason' => 'RequestedByCustomer', - ]); - - $this->assertTrue($response->isFailed()); - } -} From f3d8db1403bc9ee4120d82e7d5cdc0c3c4ac7947 Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Fri, 3 May 2024 13:02:24 +0800 Subject: [PATCH 3/4] Adding iDeal Fast Checkout --- src/PaymentMethods/iDeal/iDeal.php | 4 +++- tests/Buckaroo/Payments/IdealTest.php | 32 +++++++++++++++++++-------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/src/PaymentMethods/iDeal/iDeal.php b/src/PaymentMethods/iDeal/iDeal.php index e0902c4..60556d2 100644 --- a/src/PaymentMethods/iDeal/iDeal.php +++ b/src/PaymentMethods/iDeal/iDeal.php @@ -58,9 +58,11 @@ public function pay(?Model $model = null) * @return TransactionResponse */ public function payFastCheckout(?Model $model = null) - { + { $this->setPayPayload(); + $this->request->setData('order', ''); + $this->setServiceList('PayFastCheckout', $model ?? new Pay($this->payload)); return $this->postRequest(); diff --git a/tests/Buckaroo/Payments/IdealTest.php b/tests/Buckaroo/Payments/IdealTest.php index c7cb886..1d65fab 100644 --- a/tests/Buckaroo/Payments/IdealTest.php +++ b/tests/Buckaroo/Payments/IdealTest.php @@ -24,16 +24,16 @@ use Buckaroo\Config\Config; -class CustomConfig extends Config -{ - public function __construct() - { - $websiteKey = 'Set Key'; - $secretKey = 'From other resources like DB/ENV/Platform Config'; +// class CustomConfig extends Config +// { +// public function __construct() +// { +// $websiteKey = 'Set Key'; +// $secretKey = 'From other resources like DB/ENV/Platform Config'; - parent::__construct($websiteKey, $secretKey); - } -} +// parent::__construct($websiteKey, $secretKey); +// } +// } class IdealTest extends BuckarooTestCase { @@ -105,6 +105,20 @@ public function it_creates_a_ideal_payment() $this->assertTrue($response->isPendingProcessing()); } + /** + * @return void + * @test + */ + public function it_creates_a_ideal_fast_checkout_payment() + { + $response = $this->buckaroo->method('ideal')->payFastCheckout([ + 'amountDebit' => 10.10, + 'invoice' => uniqid(), + ]); + + $this->assertTrue($response->isWaitingOnUserInput()); + } + /** * @test */ From 4713afd780b86b5e8abd68a0aeee106d46e2239e Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Fri, 3 May 2024 13:20:19 +0800 Subject: [PATCH 4/4] Remove whitespaces --- src/PaymentMethods/iDeal/iDeal.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/PaymentMethods/iDeal/iDeal.php b/src/PaymentMethods/iDeal/iDeal.php index 60556d2..4a19fac 100644 --- a/src/PaymentMethods/iDeal/iDeal.php +++ b/src/PaymentMethods/iDeal/iDeal.php @@ -58,11 +58,11 @@ public function pay(?Model $model = null) * @return TransactionResponse */ public function payFastCheckout(?Model $model = null) - { + { $this->setPayPayload(); - + $this->request->setData('order', ''); - + $this->setServiceList('PayFastCheckout', $model ?? new Pay($this->payload)); return $this->postRequest();