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

[BUG] Always work with Money objects instead of bare numbers #212

Open FunkyloverOne opened 4 years ago

FunkyloverOne commented 4 years ago

Because Money objects take care of proper rounding depending on Currency#subunit_to_unit.

To make it clearer - we had to work with JPY currency and there are no subunits. So every time there are some fractional numbers - it ends up with an error from PayPal API, which is fair enough. :)

We also needed a REST API version of your controller (which is worth a separate issue). Anyway, here's some draft code which demonstrates what needs to be done: https://github.com/FunkyloverOne/better_spree_paypal_express/commit/1d39a029b213fa1bbfdd3f1240fb09e841e626f7

I could open a PR later.

However, another problem is that I have issues running your test suite. I generate the dummy app, but it lacks some "iPad" link in tests, I do not yet know the details why.