In my project, I have two payment methods - credit card and bank transfer. Bank transfer means postpay. User pays invoice after order complete. Current code works fine when I choose credit card as payment method. When I choose bank transfer then I cannot submit form due to submit handlers from vzero stop it.
I placed this JS
window.currentSpreeBraintreeVzeroIntegration = integration;
in the file https://github.com/spree-contrib/spree_braintree_vzero/blob/master/app/views/spree/checkout/payment/braintree_vzero/_dropin_on_ready_callback.js.erb
Later in the code I add
$('input[name*=payment_method_id]').on('change', function() {
if( window.currentSpreeBraintreeVzeroIntegration ) {
// payment_method_id == 3 bank transfer
if( $(this).val() == 3 ) {
console.log('val='+$(this).val());
window.currentSpreeBraintreeVzeroIntegration.teardown();
}
}
});
This JS call teardown() when user chooses bank transfer payment method. Now user can submit form.
Unfortunately I am not sure is this solution correct.
In my project, I have two payment methods - credit card and bank transfer. Bank transfer means postpay. User pays invoice after order complete. Current code works fine when I choose credit card as payment method. When I choose bank transfer then I cannot submit form due to submit handlers from vzero stop it.
I placed this JS
in the file https://github.com/spree-contrib/spree_braintree_vzero/blob/master/app/views/spree/checkout/payment/braintree_vzero/_dropin_on_ready_callback.js.erb
Later in the code I add
This JS call teardown() when user chooses bank transfer payment method. Now user can submit form.
Unfortunately I am not sure is this solution correct.