Type
magento2-module
This module allows you to define payment method availability dynamically.
magento2-module
MIT
None
None
None
None
None
This module allows you to define payment method availability dynamically. The free source is available at the github repository.
THIS REPOSITORY HAS BEEN ARCHIVED.
PLEASE, READ THE "DEVELOPERS" SECTION.
THIS MODULE IS A FALSE ANSWER TO A FALSE PROBLEM.
composer require tklein/module-payment-method-availability
Go to your Magento root, then run the following magento command:
php bin/magento setup:upgrade
If you are in production mode, do not forget to recompile and redeploy the static resources, or to use the --keep-generated
option.
Customize the module without efforts.
The following settings are available at Stores > Configuration > Sales > Payment Methods > Other Payment Methods > Default Payment Method Settings
:
Please see the following API first, maybe it could resolve your issue:
<type name="Magento\Payment\Model\Checks\SpecificationFactory">
<arguments>
<argument name="mapping" xsi:type="array">
<item name="country" xsi:type="object">Magento\Payment\Model\Checks\CanUseForCountry</item>
<item name="currency" xsi:type="object">Magento\Payment\Model\Checks\CanUseForCurrency</item>
<item name="checkout" xsi:type="object">Magento\Payment\Model\Checks\CanUseCheckout</item>
<item name="internal" xsi:type="object">Magento\Payment\Model\Checks\CanUseInternal</item>
<item name="total" xsi:type="object">Magento\Payment\Model\Checks\TotalMinMax</item>
<item name="zero_total" xsi:type="object">Magento\Payment\Model\Checks\ZeroTotal</item>
</argument>
</arguments>
</type>
Where the specifications implements the following interface: \Magento\Payment\Model\Checks\SpecificationInterface
.
In the case of the gateway API, please refer to the validator pool:
Magento\Payment\Gateway\Validator\ValidatorPool
This project is licensed under the MIT License - see the LICENSE file for details.
That's all folks!