0

Need to extend credit-card-type.js for add master card detection new/latest pattern:

I am creating and extending payment method using this link http://inchoo.net/magento-2/implementing-payment-gateway-magento-2/

Its working fine ... just not detecting master card type until I put all 16 digit of the credit card this is the problem i am facing

As of my understanding and research magento making credit-card-type.js at below path:

\pub\static\frontend\Magento\luma\en_US\Magento_Payment\js\model\credit-card-validation\credit-card-number-validator\credit-card-type.js

need to override this for add/update new pattern for master card detection like below link: https://stackoverflow.com/a/72801/3820040

Checking if anyone have the resolution of the issue... Please let me know if you can help.

0

By doing some research and development I found below solution/way to override js file:

Just go to requirejs-config.js file at below path... If you dont find then create the file. [Namespace]/[Module]/view/frontend/requirejs-config.js and

add below code:

var config = {
    map: {
        '*': {
            'Magento_Payment/js/model/credit-card-validation/credit-card-number-validator/credit-card-type':'[Namespace]_[Module]/js/model/credit-card-validation/credit-card-number-validator/credit-card-type',               
        }
    }
};

Before this above code first take/copy credit-card-type.js file from below path:

\pub\static\frontend\Magento\luma\en_US\Magento_Payment\js\model\credit-card-validation\credit-card-number-validator\credit-card-type.js

and pase at your module js file location at

[Namespace]_[Module]/js/model/credit-card-validation/credit-card-number-validator/credit-card-type.js

Then you can make your custom changes as like I have done in my case.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.