Your IP : 216.73.217.95


Current Path : /proc/thread-self/cwd/static/frontend/Magento/luma/it_IT/Magento_Vault/js/view/payment/
Upload File :
Current File : //proc/thread-self/cwd/static/frontend/Magento/luma/it_IT/Magento_Vault/js/view/payment/vault.js

/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */
/*browser:true*/

/* @api */
define([
    'underscore',
    'uiComponent',
    'Magento_Checkout/js/model/payment/renderer-list',
    'uiLayout',
    'uiRegistry'
], function (_, Component, rendererList, layout, registry) {
    'use strict';

    var vaultGroupName = 'vaultGroup';

    layout([{
        name: vaultGroupName,
        component: 'Magento_Checkout/js/model/payment/method-group',
        alias: 'vault',
        sortOrder: 10
    }]);

    registry.get(vaultGroupName, function (vaultGroup) {
        _.each(window.checkoutConfig.payment.vault, function (config, index) {
            rendererList.push(
                {
                    type: index,
                    config: config.config,
                    component: config.component,
                    group: vaultGroup,

                    /**
                     * Custom payment method types comparator
                     * @param {String} typeA
                     * @param {String} typeB
                     * @return {Boolean}
                     */
                    typeComparatorCallback: function (typeA, typeB) {
                        // vault token items have the same name as vault payment without index
                        return typeA.substring(0, typeA.lastIndexOf('_')) === typeB;
                    }
                }
            );
        });
    });

    /**
     * Add view logic here if needed
     */
    return Component.extend({});
});