From fa3e7a17ebd996b865a60fc49758a39cec73362c Mon Sep 17 00:00:00 2001 From: pynkittisak Date: Fri, 28 Jun 2024 16:13:28 +0700 Subject: [PATCH] fix radio button --- .../view/payment/method-renderer/omise-cc-method.js | 12 +++++++++--- .../omise-offsite-installment-method.js | 10 ++++++++-- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/view/frontend/web/js/view/payment/method-renderer/omise-cc-method.js b/view/frontend/web/js/view/payment/method-renderer/omise-cc-method.js index af0dcc21..3be8be39 100644 --- a/view/frontend/web/js/view/payment/method-renderer/omise-cc-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/omise-cc-method.js @@ -8,7 +8,9 @@ define( 'Magento_Payment/js/model/credit-card-validation/validator', 'Magento_Checkout/js/model/full-screen-loader', 'Magento_Checkout/js/action/redirect-on-success', - 'Magento_Checkout/js/model/quote' + 'Magento_Checkout/js/model/quote', + 'Magento_Checkout/js/checkout-data', + 'Magento_Checkout/js/action/select-payment-method' ], function ( ko, @@ -19,7 +21,9 @@ define( validator, fullScreenLoader, redirectOnSuccessAction, - quote + quote, + checkoutData, + selectPaymentMethodAction ) { 'use strict' @@ -87,6 +91,8 @@ define( selectPaymentMethod: function () { this._super(); + selectPaymentMethodAction(this.getData()); + checkoutData.setSelectedPaymentMethod(this.item.method); OmiseCard.destroy(); setTimeout(() => { if (this.isSecureForm()) { @@ -97,7 +103,7 @@ define( } }, 300); - return this + return true }, isSecureForm: function () { diff --git a/view/frontend/web/js/view/payment/method-renderer/omise-offsite-installment-method.js b/view/frontend/web/js/view/payment/method-renderer/omise-offsite-installment-method.js index 510afb64..7911bed0 100644 --- a/view/frontend/web/js/view/payment/method-renderer/omise-offsite-installment-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/omise-offsite-installment-method.js @@ -8,6 +8,8 @@ define( 'Magento_Catalog/js/price-utils', 'Magento_Checkout/js/model/full-screen-loader', 'mage/storage', + 'Magento_Checkout/js/checkout-data', + 'Magento_Checkout/js/action/select-payment-method' ], function ( $, @@ -17,7 +19,9 @@ define( quote, priceUtils, fullScreenLoader, - storage + storage, + checkoutData, + selectPaymentMethodAction ) { 'use strict'; const CAPTION = $.mage.__('Choose number of monthly payments'); @@ -142,6 +146,8 @@ define( selectPaymentMethod: function () { this._super(); + selectPaymentMethodAction(this.getData()); + checkoutData.setSelectedPaymentMethod(this.item.method); OmiseCard.destroy(); setTimeout(() => { const element = document.querySelector('.omise-installment-form') @@ -149,7 +155,7 @@ define( this.applyOmiseJsToElement(this, element); } }, 300); - return this + return true }, openOmiseJs: function () {