diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ca01101..a16260b2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,10 +5,14 @@ # Changelog ## Latest Version +#### Enhancements: +- GP-API: BNPL unit tests update + +## v6.1.1 (02/09/2023) #### Bug Fixes: - Portico Gateway: fix DigitalPaymentToken handling -## v6.0.6 (02/02/2023) +## v6.1.0 (02/02/2023) #### Enhancements: - GP-API: add risk assessment feature - Refacto the Secure3DBuilder diff --git a/metadata.xml b/metadata.xml index 11ca6220..27a9bccb 100644 --- a/metadata.xml +++ b/metadata.xml @@ -1,3 +1,3 @@ - 6.1.1 + 6.1.2 \ No newline at end of file diff --git a/test/Integration/Gateways/GpApiConnector/GpApiBNPLTest.php b/test/Integration/Gateways/GpApiConnector/GpApiBNPLTest.php index bfc18ec0..28b964c6 100644 --- a/test/Integration/Gateways/GpApiConnector/GpApiBNPLTest.php +++ b/test/Integration/Gateways/GpApiConnector/GpApiBNPLTest.php @@ -314,6 +314,46 @@ public function testBNPL_KlarnaProvider() $this->assertEquals(TransactionStatus::CAPTURED, $captureTrn->responseMessage); } + public function testBNPL_KlarnaProvider_Refund() + { + $this->paymentMethod->bnplType = BNPLType::KLARNA; + $customer = $this->setCustomerData(); + $products = $this->setProductList(); + + $transaction = $this->paymentMethod->authorize(550) + ->withCurrency($this->currency) + ->withProductData($products) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withCustomerData($customer) + ->execute(); + + $this->assertNotNull($transaction); + $this->assertEquals('SUCCESS', $transaction->responseCode); + $this->assertEquals(TransactionStatus::INITIATED, $transaction->responseMessage); + $this->assertNotNull($transaction->bnplResponse->redirectUrl); + + fwrite(STDERR, print_r($transaction->bnplResponse->redirectUrl, TRUE)); + + sleep(45); + + $captureTrn = $transaction->capture()->execute(); + + $this->assertNotNull($captureTrn); + $this->assertEquals('SUCCESS', $captureTrn->responseCode); + $this->assertEquals(TransactionStatus::CAPTURED, $captureTrn->responseMessage); + + sleep(15); + + $trnRefund = $captureTrn->refund(100) + ->withCurrency($this->currency) + ->execute(); + + $this->assertNotNull($trnRefund); + $this->assertEquals('SUCCESS', $trnRefund->responseCode); + $this->assertEquals(TransactionStatus::CAPTURED, $trnRefund->responseMessage); + } + public function testBNPL_ClearPayProvider() { $this->paymentMethod->bnplType = BNPLType::CLEARPAY; @@ -403,6 +443,46 @@ public function testBNPL_ClearPayProvider_MultipleCapture() $this->assertEquals(TransactionStatus::CAPTURED, $captureTrn->responseMessage); } + public function testBNPL_ClearPayProvider_Refund() + { + $this->paymentMethod->bnplType = BNPLType::CLEARPAY; + $customer = $this->setCustomerData(); + $products = $this->setProductList(); + + $transaction = $this->paymentMethod->authorize(550) + ->withCurrency($this->currency) + ->withProductData($products) + ->withAddress($this->shippingAddress, AddressType::SHIPPING) + ->withAddress($this->billingAddress, AddressType::BILLING) + ->withCustomerData($customer) + ->execute(); + + $this->assertNotNull($transaction); + $this->assertEquals('SUCCESS', $transaction->responseCode); + $this->assertEquals(TransactionStatus::INITIATED, $transaction->responseMessage); + $this->assertNotNull($transaction->bnplResponse->redirectUrl); + + fwrite(STDERR, print_r($transaction->bnplResponse->redirectUrl, TRUE)); + + sleep(45); + + $captureTrn = $transaction->capture()->execute(); + + $this->assertNotNull($captureTrn); + $this->assertEquals('SUCCESS', $captureTrn->responseCode); + $this->assertEquals(TransactionStatus::CAPTURED, $captureTrn->responseMessage); + + sleep(15); + + $trnRefund = $captureTrn->refund(550) + ->withCurrency($this->currency) + ->execute(); + + $this->assertNotNull($trnRefund); + $this->assertEquals('SUCCESS', $trnRefund->responseCode); + $this->assertEquals(TransactionStatus::CAPTURED, $trnRefund->responseMessage); + } + public function testBNPL_InvalidStatusForCapture_NoRedirect() { $customer = $this->setCustomerData();