Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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!');
}
Expand All @@ -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);
Expand Down
Loading