From 63ef463ac871d21afbaeba0cfb707a576e52b03f Mon Sep 17 00:00:00 2001 From: DependraSethiya Date: Mon, 20 Mar 2023 19:43:34 +0530 Subject: [PATCH] Payment Method Condition Update --- .../cartridge/controllers/COBilling.js | 12 +++++------- .../cartridge/controllers/Checkout.js | 12 ++++++------ 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/cartridges/app_komoju_controllers/cartridge/controllers/COBilling.js b/cartridges/app_komoju_controllers/cartridge/controllers/COBilling.js index 710fdfe..5e29091 100644 --- a/cartridges/app_komoju_controllers/cartridge/controllers/COBilling.js +++ b/cartridges/app_komoju_controllers/cartridge/controllers/COBilling.js @@ -121,13 +121,11 @@ function returnToForm(cart, params) { Object.keys(currentPaymentMethod).forEach(function (paymentMethodKey) { var method = {}; var object = currentPaymentMethod[paymentMethodKey]; - method.ID = object.id; - method.subTypes = object.subTypes; - method.displayName = object.displayValue[locale]; - method.enabled = object.enabled; - if (method.enabled !== undefined && method.enabled === true && method.ID !== 'credit_card') { - allPaymentMethod.push(method); - } else if (method.enabled !== undefined && method.enabled === true && method.ID === 'credit_card' && object.currency === currency) { + if (object.enabled !== undefined && object.enabled === true && object.currency === currency) { + method.ID = object.id; + method.subTypes = object.subTypes; + method.displayName = object.displayValue[locale]; + method.enabled = object.enabled; allPaymentMethod.push(method); } }); diff --git a/cartridges/int_komoju_sfra/cartridge/controllers/Checkout.js b/cartridges/int_komoju_sfra/cartridge/controllers/Checkout.js index 3fd57d9..ff0196f 100644 --- a/cartridges/int_komoju_sfra/cartridge/controllers/Checkout.js +++ b/cartridges/int_komoju_sfra/cartridge/controllers/Checkout.js @@ -84,13 +84,13 @@ server.prepend( Object.keys(currentPaymentMethod).forEach(function (paymentMethodKey) { var method = {}; var object = currentPaymentMethod[paymentMethodKey]; - method.ID = object.id; - method.subTypes = object.subTypes; - method.displayName = object.displayValue[locale]; - method.enabled = object.enabled; - if (object.enabled !== undefined && object.enabled === true && object.id !== 'credit_card') { + if (object.enabled !== undefined && object.enabled === true && object.currency === currency) { + method.ID = object.id; + method.subTypes = object.subTypes; + method.displayName = object.displayValue[locale]; + method.enabled = object.enabled; allPaymentMethods.push(method); - } else if (object.enabled !== undefined && object.enabled === true && object.id === 'credit_card' && object.currency === currency) { allPaymentMethods.push(method); } + } }); }); }