From 8f9c8230f68cd154b8cf381dd8065c9fc703fb4f Mon Sep 17 00:00:00 2001 From: Shu Chen Date: Thu, 2 May 2024 13:36:15 +0800 Subject: [PATCH] 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 63a3c9fe..00000000 --- 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 338b970d..2de8138f 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 881cfd99..2d858487 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 e1f535dc..00000000 --- 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 f5cb5f49..00000000 --- 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 6f21cb87..00000000 --- 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 325405e2..3a4d6f3f 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 ab4db2d7..00000000 --- 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()); - } -}