LearningSalesForceCommerceC.../storefront-reference-architecture/test/mocks/models/payment.js

53 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-12-21 10:57:31 -08:00
'use strict';
var proxyquire = require('proxyquire').noCallThru().noPreserveCache();
var collections = require('../util/collections');
function proxyModel() {
return proxyquire('../../../cartridges/app_storefront_base/cartridge/models/payment', {
'*/cartridge/scripts/util/collections': collections,
'dw/order/PaymentMgr': {
getApplicablePaymentMethods: function () {
return [
{
ID: 'GIFT_CERTIFICATE',
name: 'Gift Certificate'
},
{
ID: 'CREDIT_CARD',
name: 'Credit Card'
}
];
},
getPaymentMethod: function () {
return {
getApplicablePaymentCards: function () {
return [
{
cardType: 'Visa',
name: 'Visa',
UUID: 'some UUID'
},
{
cardType: 'Amex',
name: 'American Express',
UUID: 'some UUID'
},
{
cardType: 'Discover',
name: 'Discover'
}
];
}
};
},
getApplicablePaymentCards: function () {
return ['applicable payment cards'];
}
},
'dw/order/PaymentInstrument': {}
});
}
module.exports = proxyModel();