spree-contrib / better_spree_paypal_express

A better Spree PayPal Express Extension.
http://guides.spreecommerce.org
BSD 3-Clause "New" or "Revised" License
110 stars 270 forks source link

Fix JS errors #219

Open mrbrdo opened 2 years ago

mrbrdo commented 2 years ago

The way the paymentMethodID is passed to the JS is not working due to scripts not being loaded yet. Fixed this by passing it through a data attribute on the button. I also used Spree.ready instead of $(document).ready.

Also I added a way to track which lib hid the save button, because I based another payment system on this gem and they would then override hiding the button between each other (basically one lib would hide the button but the other one would show it back immediately). Although it's not needed for this gem itself it may be helpful to others in similar situation or if I release the other gem.

By the way really thanks for this gem, I can't believe how amateur and shitty the official spree braintree vzero gem is. Looks like they used it as a play project for their juniors to try Ruby or something. Meanwhile this gem hasn't had an update for 3 years and still works great except for this JS error and the SSL issue, but these are not hard to fix.