| Current Path : /home/rtorresani/www/vendor/magento/module-payment/view/frontend/web/js/ |
| Current File : //home/rtorresani/www/vendor/magento/module-payment/view/frontend/web/js/cc-type.js |
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/* @api */
define([
'jquery',
'jquery-ui-modules/widget'
], function ($) {
'use strict';
$.widget('mage.creditCardType', {
options: {
typeCodes: ['SS', 'SM', 'SO'] // Type codes for Switch/Maestro/Solo credit cards.
},
/**
* Bind change handler to select element and trigger the event to show/hide
* the Switch/Maestro or Solo credit card type container for those credit card types.
* @private
*/
_create: function () {
this.element.on('change', $.proxy(this._toggleCardType, this)).trigger('change');
},
/**
* Toggle the Switch/Maestro and Solo credit card type container depending on which
* credit card type is selected.
* @private
*/
_toggleCardType: function () {
$(this.options.creditCardTypeContainer)
.toggle($.inArray(this.element.val(), this.options.typeCodes) !== -1);
}
});
return $.mage.creditCardType;
});