diff --git a/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js b/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js index be3068eb9a..486e835ba8 100755 --- a/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/adyen-cc-method.js @@ -166,16 +166,16 @@ define( * set up the installments */ renderCCPaymentMethod: function() { - let componentConfig = this.buildComponentConfiguration(); - - this.cardComponent = adyenCheckout.mountPaymentMethodComponent( - this.checkoutComponent, - 'card', - componentConfig, - '#cardContainer' - ) - - return true + if (!this.cardComponent) { + let componentConfig = this.buildComponentConfiguration(); + + this.cardComponent = adyenCheckout.mountPaymentMethodComponent( + this.checkoutComponent, + 'card', + componentConfig, + '#cardContainer' + ) + } }, buildComponentConfiguration: function () { diff --git a/view/frontend/web/js/view/payment/method-renderer/multishipping/adyen-cc-method.js b/view/frontend/web/js/view/payment/method-renderer/multishipping/adyen-cc-method.js index 635a91aede..e5d2913fc7 100644 --- a/view/frontend/web/js/view/payment/method-renderer/multishipping/adyen-cc-method.js +++ b/view/frontend/web/js/view/payment/method-renderer/multishipping/adyen-cc-method.js @@ -65,6 +65,10 @@ define([ $("#payment-continue").on("click", function () { paymentComponent.showValidation(); }); + + if (paymentComponent.isValid) { + self.assignStateData(paymentComponent); + } } else { console.warn('Payment component could not be generated!'); } @@ -78,14 +82,18 @@ define([ let baseComponentConfiguration = this._super(); baseComponentConfiguration.onChange = function (state) { - $('#stateData').val(state.isValid ? JSON.stringify(state.data) : ''); - self.placeOrderAllowed(!!state.isValid); - self.storeCc = !!state.data.storePaymentMethod; + self.assignStateData(state); }; return baseComponentConfiguration; }, + assignStateData: function (state) { + $('#stateData').val(state.isValid ? JSON.stringify(state.data) : ''); + this.placeOrderAllowed(!!state.isValid); + this.storeCc = !!state.data.storePaymentMethod; + }, + // Observable is set to true after div element in `cc-form.html` template is rendered setIsTemplateRendered: function () { this.isTemplateRendered(true);