Skip to content

Commit

Permalink
Merge pull request #366 from mollie/1.23.1
Browse files Browse the repository at this point in the history
1.23.1
  • Loading branch information
Marvin-Magmodules authored Mar 10, 2021
2 parents d17796b + 960f85f commit 7691c14
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 deletions.
3 changes: 1 addition & 2 deletions Service/Order/TransactionPart/CardToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ class CardToken implements TransactionPartInterface
public function process(OrderInterface $order, $apiMethod, array $transaction)
{
$additionalData = $order->getPayment()->getAdditionalInformation();

if (!isset($additionalData['card_token'])) {
if ($order->getPayment()->getMethod() != 'mollie_methods_creditcard' || !isset($additionalData['card_token'])) {
return $transaction;
}

Expand Down
21 changes: 21 additions & 0 deletions Test/Integration/Service/Order/TransactionPart/CardTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ public function testAddsDataForPaymentsApi()
{
$order = $this->loadOrderById('100000001');
$payment = $order->getPayment();
$payment->setMethod('mollie_methods_creditcard');
$payment->setAdditionalInformation('card_token', 'abc123');

/** @var CardToken $instance */
Expand All @@ -36,6 +37,7 @@ public function testAddsDataForPaymentsApi()
public function testAddsDataForOrdersApi()
{
$order = $this->loadOrderById('100000001');
$order->getPayment()->setMethod('mollie_methods_creditcard');
$payment = $order->getPayment();
$payment->setAdditionalInformation('card_token', 'abc123');

Expand All @@ -53,6 +55,25 @@ public function testAddsDataForOrdersApi()
public function testDoesNotChangeTheTransactionWhenNoCardTokenIsPresent()
{
$order = $this->loadOrderById('100000001');
$order->getPayment()->setMethod('mollie_methods_creditcard');

/** @var CardToken $instance */
$instance = $this->objectManager->create(CardToken::class);

$transaction = $instance->process($order, Orders::CHECKOUT_TYPE, ['method' => 'creditcard']);

$this->assertEquals(['method' => 'creditcard'], $transaction);
}

/**
* @magentoDataFixture Magento/Sales/_files/order.php
*/
public function testDoesATheCardFieldWhenThePaymentMethodIsNotCreditcard()
{
$order = $this->loadOrderById('100000001');
$payment = $order->getPayment();
$payment->setMethod('checkmo');
$payment->setAdditionalInformation('card_token', 'abc123');

/** @var CardToken $instance */
$instance = $this->objectManager->create(CardToken::class);
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "mollie/magento2",
"description": "Mollie Payment Module for Magento 2",
"version": "1.23.0",
"version": "1.23.1",
"keywords": [
"mollie",
"payment",
Expand Down
2 changes: 1 addition & 1 deletion etc/config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<default>
<payment>
<mollie_general>
<version>v1.23.0</version>
<version>v1.23.1</version>
<active>0</active>
<enabled>0</enabled>
<type>test</type>
Expand Down

0 comments on commit 7691c14

Please sign in to comment.