diff --git a/src/PaymentMethods/PaymentMethodFactory.php b/src/PaymentMethods/PaymentMethodFactory.php index 2840b75..f07890b 100644 --- a/src/PaymentMethods/PaymentMethodFactory.php +++ b/src/PaymentMethods/PaymentMethodFactory.php @@ -27,6 +27,7 @@ use Buckaroo\PaymentMethods\iDin\iDin; use Buckaroo\PaymentMethods\SEPA\SEPA; use Buckaroo\PaymentMethods\iDeal\iDeal; +use Buckaroo\PaymentMethods\iDealProcessing\iDealProcessing; use Buckaroo\PaymentMethods\MBWay\MBWay; use Buckaroo\PaymentMethods\Tinka\Tinka; use Buckaroo\Exceptions\BuckarooException; @@ -92,7 +93,8 @@ class PaymentMethodFactory ], CreditClick::class => ['creditclick'], CreditManagement::class => ['credit_management'], - iDeal::class => ['ideal', 'idealprocessing'], + iDeal::class => ['ideal'], + iDealProcessing::class => ['idealprocessing'], iDealQR::class => ['ideal_qr'], iDin::class => ['idin'], In3::class => ['in3'], @@ -120,7 +122,6 @@ class PaymentMethodFactory Przelewy24::class => ['przelewy24'], PointOfSale::class => ['pospayment'], Giropay::class => ['giropay'], - NoServiceSpecifiedPayment::class => ['noservice'], GiftCard::class => [ 'giftcard', 'westlandbon', 'babygiftcard', 'babyparkgiftcard', 'beautywellness', 'boekenbon', 'boekenvoordeel', diff --git a/src/PaymentMethods/iDealProcessing/Models/Pay.php b/src/PaymentMethods/iDealProcessing/Models/Pay.php new file mode 100644 index 0000000..5e10d05 --- /dev/null +++ b/src/PaymentMethods/iDealProcessing/Models/Pay.php @@ -0,0 +1,28 @@ +payload)); + } + + /** + * @param Model|null $model + * @return TransactionResponse + */ + public function payRemainder(?Model $model = null): TransactionResponse + { + return parent::payRemainder($model ?? new Pay($this->payload)); + } + + /** + * @return array + * @throws BuckarooException + */ + public function issuers(): array + { + $this->serviceVersion = 2; + + return $this->traitIssuers(); + } +} diff --git a/tests/Buckaroo/Payments/IdealProcessingTest.php b/tests/Buckaroo/Payments/IdealProcessingTest.php new file mode 100644 index 0000000..cb4b384 --- /dev/null +++ b/tests/Buckaroo/Payments/IdealProcessingTest.php @@ -0,0 +1,90 @@ +paymentPayload = [ + 'invoice' => uniqid(), + 'amountDebit' => 10.10, + 'issuer' => 'ABNANL2A', + 'pushURL' => 'https://buckaroo.dev/push', + 'returnURL' => 'https://buckaroo.dev/return', + 'clientIP' => [ + 'address' => '123.456.789.123', + 'type' => 0, + ], + 'customParameters' => [ + 'CustomerBillingFirstName' => 'test' + ], + 'additionalParameters' => [ + 'initiated_by_magento' => 1, + 'service_action' => 'something', + ], + ]; + } + + /** + * @return void + * @test + */ + public function it_get_idealprocessing_issuers() + { + $response = $this->buckaroo->method('idealprocessing')->issuers(); + + $this->assertIsArray($response); + foreach ($response as $item) + { + $this->assertIsArray($item); + $this->assertArrayHasKey('id', $item); + $this->assertArrayHasKey('name', $item); + } + } + + /** + * @return void + * @test + */ + public function it_creates_a_idealprocessing_payment() + { + $response = $this->buckaroo->method('idealprocessing')->pay($this->paymentPayload); + + $this->assertTrue($response->isPendingProcessing()); + } +} diff --git a/tests/Buckaroo/Payments/IdealTest.php b/tests/Buckaroo/Payments/IdealTest.php index 6b402c1..c7cb886 100644 --- a/tests/Buckaroo/Payments/IdealTest.php +++ b/tests/Buckaroo/Payments/IdealTest.php @@ -100,7 +100,7 @@ public function it_get_ideal_issuers() */ public function it_creates_a_ideal_payment() { - $response = $this->buckaroo->method('idealprocessing')->pay($this->paymentPayload); + $response = $this->buckaroo->method('ideal')->pay($this->paymentPayload); $this->assertTrue($response->isPendingProcessing()); }