Tariq Sanjakdar
07/01/2020, 10:44 PMawait cart.addPayment({
payment_method: {
internalid: '108'
// type: 'creditcard',
// creditcard: {
// ccnumber: "5168441223630339",
// ccname: "John Smith",
// ccexpiredate: "11/1/2022",
// expmonth: "11",
// expyear: "2022"
// }
}
});
await cart.getPaymentMethods().then(function(pm){
console.log('payment method', pm);
});
var nextStep = {};
await checkout.getStepsInfo().then(async function(stepInfo){
var steps = stepInfo;
console.log('steps', steps);
await checkout.getCurrentStep().then(function(step){
var currentStep = step;
console.log('current step', step);
for(var i = 0; i < steps.length; i++){
if(currentStep.url === steps[i].url){
if(steps[i +1].show_step){
nextStep = steps[i +1];
break;
}
else{
for(var j = i +1; j < steps.length; j++){
if(steps[j].show_step){
nextStep = steps[j];
break;
}
}
break;
}
}
}
});
});
await checkout.setCurrentStep({
url: nextStep.url,
step_url: nextStep.url,
name: nextStep.name,
show_step: true,
state: 'Present',
step_group_name: nextStep.step_group_name,
modules: nextStep.modules
});
Any help would be much appreciated! 🙂PabloZ
07/02/2020, 1:04 AMPabloZ
07/02/2020, 1:05 AM// type: 'creditcard',
thisPabloZ
07/02/2020, 1:05 AMTariq Sanjakdar
07/02/2020, 1:08 AMPabloZ
07/02/2020, 1:11 AMPabloZ
07/02/2020, 1:11 AMLiveOrderModel.setPaymentMethods = _.wrap(LiveOrderModel.setPaymentMethods, function (fn, data) {
var certificateMethods;
var methods;
fn.apply(this, _.toArray(arguments).slice(1));
certificateMethods = _.where(data.paymentmethods, { type: 'giftcertificate' });
methods = _.difference(data.paymentmethods, certificateMethods);
if (this.isSecure && methods && methods.length && ModelsInit.session.isLoggedIn2()) {
_.each(methods, function (paymentmethod) {
if (paymentmethod.type === 'payinstore') {
ModelsInit.order.removePayment();
try {
ModelsInit.order.setPayment({
paymentterms: '',
paymentmethod: Configuration.get('pickup.payInStorePaymentMethodID', '8')
});
} catch (e) {
if (e && e.code && e.code === 'ERR_WS_INVALID_PAYMENT') {
ModelsInit.order.removePayment();
}
throw e;
}
}
});
}
});
PabloZ
07/02/2020, 1:12 AMPabloZ
07/02/2020, 1:12 AMTariq Sanjakdar
07/02/2020, 1:12 AMPabloZ
07/02/2020, 1:14 AMPabloZ
07/02/2020, 1:14 AMLiveOrderModel.getPaymentMethods = _.wrap(LiveOrderModel.getPaymentMethods, function (fn, orderFields) {
var paymentMethods = fn.apply(this, _.toArray(arguments).slice(1));
if (
orderFields.payment &&
orderFields.payment.paymentmethod === Configuration.get('pickup.payInStorePaymentMethodID', '8')
) {
paymentMethods.push({
type: 'payinstore',
name: 'Pay In Store',
primary: true
});
}
return paymentMethods;
});
PabloZ
07/02/2020, 1:15 AMPabloZ
07/02/2020, 1:18 AMTariq Sanjakdar
07/02/2020, 1:18 AM