From e97e314d35711035f899c925d7f85ac907587d6e Mon Sep 17 00:00:00 2001 From: Mike De Decker <41482163+Mike-MultiSafepay@users.noreply.github.com> Date: Wed, 26 Jun 2019 15:08:57 +0200 Subject: [PATCH 01/32] PLGMAGTWOS-449: Fixed payment redirect to cart instead of success page if paid with some iDEAL apps --- Controller/Connect/Success.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Controller/Connect/Success.php b/Controller/Connect/Success.php index eaa7182..9d4e3a8 100644 --- a/Controller/Connect/Success.php +++ b/Controller/Connect/Success.php @@ -104,8 +104,10 @@ public function execute() $session->getQuote()->setIsActive(false)->save(); // set some vars for the success page - $session->setLastSuccessQuoteId($params['transactionid']); - $session->setLastQuoteId($params['transactionid']); + $session->setLastSuccessQuoteId($order_information->getQuoteId()); + $session->setLastQuoteId($order_information->getQuoteId()); + $session->setLastOrderId($order_information->getEntityId()); + $session->setLastRealOrderId($order_information->getIncrementId()); //To a status request in order to update the order before redirect to thank you page. Doing this the status won't be payment pending so the order page can be viewed $paymentMethod = $this->_mspConnect; From 4fd930e39fd905b7d34cf3f079e8d3c5a8a29eb1 Mon Sep 17 00:00:00 2001 From: tim-multisafepay Date: Thu, 27 Jun 2019 09:41:31 +0200 Subject: [PATCH 02/32] Added extra unit tests Signed-off-by: tim-multisafepay --- Test/Unit/Helper/DataTest.php | 172 +++++++++++++++++++++++++-- Test/Unit/Model/CustomfieldsTest.php | 34 ++++++ 2 files changed, 199 insertions(+), 7 deletions(-) create mode 100644 Test/Unit/Model/CustomfieldsTest.php diff --git a/Test/Unit/Helper/DataTest.php b/Test/Unit/Helper/DataTest.php index 2d923f2..cf57591 100644 --- a/Test/Unit/Helper/DataTest.php +++ b/Test/Unit/Helper/DataTest.php @@ -1,4 +1,5 @@ [$this->getVisaObject()], - 'expected' => "Payment methods specification:
VISA (€10.00)", + 'paymentMethods' => [$this->getVisaObject()], + 'expected' => "Payment methods specification:
VISA (€10.00)", ], [ - 'paymentMethods' => [ + 'paymentMethods' => [ $this->getVisaObject(), $this->getCouponObject() ], - 'expected' => "Payment methods specification:
VISA (€10.00) / COUPON (€10.00)", + 'expected' => "Payment methods specification:
VISA (€10.00) / COUPON (€10.00)", ], [ - 'paymentMethods' => [ + 'paymentMethods' => [ $this->getVisaObject(), $this->getCouponObject(), $this->getCouponObject() ], - 'expected' => "Payment methods specification:
VISA (€10.00) / COUPON (€10.00) / COUPON (€10.00)", + 'expected' => "Payment methods specification:
VISA (€10.00) / COUPON (€10.00) / COUPON (€10.00)", ], ]; } @@ -141,7 +142,6 @@ private function getVisaObject() return $visa; } - private function getCouponObject() { $coupon = new \stdClass(); @@ -150,4 +150,162 @@ private function getCouponObject() $coupon->type = 'COUPON'; return $coupon; } + + /** + * @dataProvider getGatewayProvider + * @dataProvider getGiftcardProvider + * @param $gatewayCode + */ + public function testGetPaymentType($gatewayCode) + { + $result = $this->helper->getPaymentType($gatewayCode); + + $this->assertEquals($this->helper->gateways[$gatewayCode]['type'], $result); + } + + /** + * @dataProvider getGatewayProvider + * @param $gateway + */ + public function testIsMspGateway($gateway) + { + $result = $this->helper->isMspGateway($gateway); + + $this->assertTrue($result); + } + + /** + * @dataProvider getGiftcardProvider + * @param $giftcard + */ + public function testIsMspGiftcard($giftcard) + { + $result = $this->helper->isMspGiftcard($giftcard); + + $this->assertTrue($result); + } + + public function getGatewayProvider() + { + return [ + ['afterpaymsp'], + ['alipay'], + ['americanexpress'], + ['bancontact'], + ['belfius'], + ['betaalnaontvangst'], + ['betaalplan'], + ['creditcard'], + ['directdebit'], + ['dotpay'], + ['einvoice'], + ['eps'], + ['ferbuy'], + ['giropay'], + ['ideal'], + ['idealqr'], + ['ing'], + ['kbc'], + ['klarnainvoice'], + ['maestro'], + ['mastercard'], + ['mspbanktransfer'], + ['multisafepay'], + ['paypalmsp'], + ['paysafecard'], + ['sofort'], + ['trustly'], + ['trustpay'], + ['visa'], + ]; + } + + public function getGiftcardProvider() + { + return [ + ['babygiftcard'], + ['beautyandwellness'], + ['boekenbon'], + ['erotiekbon'], + ['fashioncheque'], + ['fashiongiftcard'], + ['fietsenbon'], + ['gezondheidsbon'], + ['givacard'], + ['goodcard'], + ['nationaletuinbon'], + ['nationaleverwencadeaubon'], + ['parfumcadeaukaart'], + ['podiumcadeaukaart'], + ['sportenfit'], + ['vvvbon'], + ['webshopgiftcard'], + ['wellnessgiftcard'], + ['wijncadeau'], + ['winkelcheque'], + ['yourgift'], + ]; + } + + + public function testGetAllMethods() + { + $result = $this->helper->getAllMethods(); + + $methods = [ + 'afterpaymsp' => 'AfterPay', + 'alipay' => 'Alipay', + 'americanexpress' => 'American Express', + 'bancontact' => 'Bancontact', + 'belfius' => 'Belfius', + 'betaalnaontvangst' => 'Pay After Delivery', + 'betaalplan' => 'Betaalplan', + 'creditcard' => 'Credit card', + 'directdebit' => 'Direct Debit', + 'dotpay' => 'Dotpay', + 'einvoice' => 'E-Invoicing', + 'eps' => 'EPS', + 'ferbuy' => 'Ferbuy', + 'giropay' => 'GiroPay', + 'ideal' => 'iDEAL', + 'idealqr' => 'iDEAL QR', + 'ing' => 'ING Home\'Pay', + 'kbc' => 'KBC', + 'klarnainvoice' => 'Klarna', + 'maestro' => 'Maestro', + 'mastercard' => 'Mastercard', + 'mspbanktransfer' => 'Bank transfer', + 'multisafepay' => 'MultiSafepay', + 'paypalmsp' => 'PayPal', + 'paysafecard' => 'Paysafecard', + 'sofort' => 'SOFORT Banking', + 'trustly' => 'Trustly', + 'trustpay' => 'Trustpay', + 'visa' => 'Visa', + 'babygiftcard' => 'Babygiftcard', + 'beautyandwellness' => 'Beauty and wellness', + 'boekenbon' => 'Boekenbon', + 'erotiekbon' => 'Erotiekbon', + 'fashioncheque' => 'Fashioncheque', + 'fashiongiftcard' => 'Fashiongiftcard', + 'fietsenbon' => 'Fietsenbon', + 'gezondheidsbon' => 'Gezondheidsbon', + 'givacard' => 'Givacard', + 'goodcard' => 'Goodcard', + 'nationaletuinbon' => 'Nationale tuinbon', + 'nationaleverwencadeaubon' => 'Nationale verwencadeaubon', + 'parfumcadeaukaart' => 'Parfumcadeaukaart', + 'podiumcadeaukaart' => 'Podium', + 'sportenfit' => 'Sportenfit', + 'vvvbon' => 'VVV Cadeaukaart', + 'webshopgiftcard' => 'Webshop Giftcard', + 'wellnessgiftcard' => 'Wellness Giftcards', + 'wijncadeau' => 'Wijn Cadeau', + 'winkelcheque' => 'Winkel Cheque', + 'yourgift' => 'YourGift', + ]; + + $this->assertEquals($methods, $result); + } + } \ No newline at end of file diff --git a/Test/Unit/Model/CustomfieldsTest.php b/Test/Unit/Model/CustomfieldsTest.php new file mode 100644 index 0000000..9246aa3 --- /dev/null +++ b/Test/Unit/Model/CustomfieldsTest.php @@ -0,0 +1,34 @@ +get('MultiSafepay\Connect\Model\Config\Source\Customfields'); + + $expected = [ + [ + 'value' => 0, + 'label' => 'Disabled' + ], + [ + 'value' => 1, + 'label' => 'Mandatory' + ], + [ + 'value' => 2, + 'label' => 'Optional' + ], + ]; + + $result = $instance->toOptionArray(); + $this->assertEquals($expected, $result); + } +} From 63cb07615b44fcb7f87acc29484dffdef13b2788 Mon Sep 17 00:00:00 2001 From: Mike De Decker <41482163+Mike-MultiSafepay@users.noreply.github.com> Date: Tue, 2 Jul 2019 15:00:42 +0200 Subject: [PATCH 03/32] DAVAMS-148: Update image locations for README badges --- README.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index e8ba80d..c80bc47 100644 --- a/README.md +++ b/README.md @@ -6,9 +6,9 @@ Easily integrate MultiSafepay payment solutions into your Magento 2 webshop with the free and completely new MultiSafepay Magento 2 plugin. -[![Latest Stable Version](https://poser.pugx.org/multisafepay/magento2msp/v/stable)](https://packagist.org/packages/multisafepay/magento2msp) -[![Total Downloads](https://poser.pugx.org/multisafepay/magento2msp/downloads)](https://packagist.org/packages/multisafepay/magento2msp) -[![License](https://poser.pugx.org/multisafepay/magento2msp/license)](https://packagist.org/packages/multisafepay/magento2msp) +[![Latest Stable Version](https://img.shields.io/packagist/v/multisafepay/magento2msp.svg)](https://packagist.org/packages/multisafepay/magento2msp) +[![Total Downloads](https://img.shields.io/packagist/dt/multisafepay/magento2msp.svg)](https://packagist.org/packages/multisafepay/magento2msp) +[![License](https://img.shields.io/packagist/l/multisafepay/magento2msp.svg)](https://packagist.org/packages/multisafepay/magento2msp) ## About MultiSafepay ## MultiSafepay is a collecting payment service provider which means we take care of the agreements, technical details and payment collection required for each payment method. You can start selling online today and manage all your transactions from one place. @@ -52,4 +52,4 @@ After these changes, the template should be tested to confirm it is working. You can create issues on our repository. If you need any additional help or support, please contact techsupport@multisafepay.com ## License -[Open Software License (OSL 3.0)](https://github.com/MultiSafepay/Magento2Msp/blob/master/LICENSE.md) \ No newline at end of file +[Open Software License (OSL 3.0)](https://github.com/MultiSafepay/Magento2Msp/blob/master/LICENSE.md) From db949ec3e19c137c77a6095d9a2d4a2f7819cc69 Mon Sep 17 00:00:00 2001 From: Vinod Sowdagar <53818758+Vinod-MultiSafepay@users.noreply.github.com> Date: Tue, 13 Aug 2019 12:29:46 +0200 Subject: [PATCH 04/32] PLGMAGTWOS-454: Translated 'Choose your creditcard' to German --- i18n/de_DE.csv | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/i18n/de_DE.csv b/i18n/de_DE.csv index b420142..a44a350 100644 --- a/i18n/de_DE.csv +++ b/i18n/de_DE.csv @@ -111,7 +111,7 @@ Salutation,Salutation Comment,Comment Newsletter,Newsletter "Choose your bank...","Choose your bank..." -"Choose your credit card...","Choose your credit card..." +"Choose your credit card...","Wählen Sie Ihre Kreditkarte..." "Order", "Bestellen" "@","@" "Notice: Captured amount %1 differs from MultiSafepay amount %2", "Notice: Captured amount %1 differs from MultiSafepay amount %2" From 2d105c89b1c4cf3912e714a90d68ef96653de382 Mon Sep 17 00:00:00 2001 From: Vinod MultiSafepay Date: Tue, 13 Aug 2019 12:40:47 +0200 Subject: [PATCH 05/32] PLGMAGTWOS-452: Removed reservation number order note for Klarna --- Model/Connect.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Model/Connect.php b/Model/Connect.php index 3b83024..65252e9 100644 --- a/Model/Connect.php +++ b/Model/Connect.php @@ -1362,10 +1362,6 @@ protected function _registerPaymentCapture($skipFraudDetection, $transactionid, $order->addStatusToHistory($order->getStatus(), $line); } - if ($payment->getMethodInstance()->getCode() == 'klarnainvoice') { - $order->addStatusToHistory($order->getStatus(), "Klarna Reservation number:" . $this->_client->orders->data->payment_details->external_transaction_id, false); - } - // Force order to Processing to solve https://github.com/magento/magento2/issues/18148 $state = Order::STATE_PROCESSING; $status = $this->_statusResolver->getOrderStatusByState($order, $state); From 54465d5dd11703de4902343090da0e2d2395e8f9 Mon Sep 17 00:00:00 2001 From: Vinod MultiSafepay Date: Tue, 13 Aug 2019 15:07:11 +0200 Subject: [PATCH 06/32] PLGMAGTWOS-442: Marked the API key fields as sensitive (Thanks to Rutger Hertogh) --- etc/di.xml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/etc/di.xml b/etc/di.xml index f97eae1..134e50b 100644 --- a/etc/di.xml +++ b/etc/di.xml @@ -7,4 +7,13 @@ + + + + + 1 + 1 + + + \ No newline at end of file From 001c0cc145253152237de98860dc9cff1f7568d0 Mon Sep 17 00:00:00 2001 From: Sonny <48082757+Sonny-MultiSafepay@users.noreply.github.com> Date: Tue, 20 Aug 2019 12:44:37 +0200 Subject: [PATCH 07/32] PLGMAGTWOS-474: Fixed Magento Marketplace Extensions Verification errors * Removed usage of insecure function in Fastcheckout button * Disabled silencing of errors in wrapper --- Model/Api/Objects/Core.php | 2 +- view/frontend/templates/fastcheckout/button.phtml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Model/Api/Objects/Core.php b/Model/Api/Objects/Core.php index e97cc99..62ac7e1 100644 --- a/Model/Api/Objects/Core.php +++ b/Model/Api/Objects/Core.php @@ -75,7 +75,7 @@ public function get($endpoint, $id, $body = array(), $query_string = false) protected function processRequest($http_method, $api_method, $http_body = null) { $body = $this->mspapi->processAPIRequest($http_method, $api_method, $http_body); - if (!($object = @json_decode($body))) { + if (!($object = json_decode($body))) { throw new \Exception("'{$body}'."); } diff --git a/view/frontend/templates/fastcheckout/button.phtml b/view/frontend/templates/fastcheckout/button.phtml index 8c0046d..0bbf5ab 100644 --- a/view/frontend/templates/fastcheckout/button.phtml +++ b/view/frontend/templates/fastcheckout/button.phtml @@ -3,7 +3,7 @@ * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ -$id = $block->getContainerId() . mt_rand(); + ?>