27-28 February, 2019, London
As you may notice from this blog there is a pretty high number of Magento 2 payment related articles. This article isn’t an exception. I’ve collected all changes introduced in the
Magento\Payment module as part of the Magento 2.2.0 release.
Table of contents:
As for comparison, I decided to check out Magento 2.1.9 and Magento 2.2.0 with different Payment modules module-payment:100.1.7 vs module-payment:100.2.0 and go through line by line checking the changes.
Magento\Payment module in the Magento 2.2.0 release no longer supports PHP 5.6 version. New PHP 7.1 version support has been introduced. Actually, this change affects all Magento 2.2 modules.
Magento team introduced better API coverage in the Magento 2.2 release. The
This list of classes and interfaces were modified with @api annotation. It doesn’t mean all these PHP classes were added in the release. There were in the previous releases however, there was no @api annotation added.
Only one interface has been deprecated. The
Magento\Payment\Model\Method\ConfigInterface interface has no semantic meaning.
Magento\Payment\Helper\Data::getStoreMethods() has been used to get and sort available payment methods for a store specified. An alternative solution is to use the
Only one new interface has been introduced as part of the Magento 2.2.0 release. The
Magento\Payment\Api\PaymentVerificationInterface is the payment provider codes verification interface. There is no default implementation of this interface because a code verification depends on payment method integration specifics. It is expected to implement the interface in a custom payment module.
Custom payment methods might implement this interface to provide specific mapping for payment methods, like AVS or CVV verification. The payment methods can map payment method info from internal sources, like an additional information, to specific international codes.
All Unit Tests in the
Magento\Payment module are based on the latest PHPUnit library 6.2.0. It means that Unit Tests for your custom payment modules should also be revisited as tests fail to execute with the Magento 2.2.0 installation.
As for the
Magento\Payment module, I’ve noticed minor but important changes which helped to comply with the PHPUnit 6.2.0 version:
A short echo syntax
<?= instead of long old-fashioned
<?php echo syntax. Interesting to notice that the expiration year issue with value is still present in the
The validate-card-year validation rule was incorrectly checking year by using month validator. Now validate-card-year validates year correctly.
Magento\Payment\Model\Method\Adapter::fetchTransactionInfo() method now returns a result of the method execution. My experience building and reviewing payment modules there aren’t many usages of the fetchTransactionInfo() method, but it is good that the method has been fixed.
There was also new Logger optional dependency and class variable introduced in the
Magento\Payment\Model\Method\Adapter class. I am not sure why if there are no usages of the logger instance.
It is important to keep an eye on changes introduced between the major releases. Especially if it is an eCommerce payment functionality.
Drop me a line at firstname.lastname@example.org or comment below with your thoughts on how you deal with updates and new Magento 2 versions.
Max Pronko is an international Magento Expert, development consultant, motivational speaker and Magento award-winning developer. He is known for the educational development programs for organizations of all sizes and has positively affected thousands of people and organizations worldwide.
Subscribe to my Magento 2 tips and tutorials content.
Every week I send an interesting email directly to your inbox