Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing integration.teardown() call #210

Open
aivils opened this issue Sep 11, 2019 · 0 comments
Open

missing integration.teardown() call #210

aivils opened this issue Sep 11, 2019 · 0 comments

Comments

@aivils
Copy link

aivils commented Sep 11, 2019

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant