Giter VIP home page Giter VIP logo

Comments (11)

darkfrog26 avatar darkfrog26 commented on July 17, 2024

If you created a fork you can submit a PR back that I can accept to merge back to master. Take a look at this page for some more information: https://docs.github.com/en/free-pro-team@latest/github/collaborating-with-issues-and-pull-requests/creating-a-pull-request

from scala-stripe.

darkfrog26 avatar darkfrog26 commented on July 17, 2024

Let me know if you have any problems and I'll do what I can to help.

from scala-stripe.

Rixamos avatar Rixamos commented on July 17, 2024

Thank you very much for yourr help and your library, I tried to do my best, I modified a bit the tests cause were failing (I supposed wa s something related to the acocunt that is in use witht he tests but I am also bad at testing :) eheh "forgive me father for my noobness"
I hope this change will work correctly in most cases and to help people that maybe had the same issue

from scala-stripe.

darkfrog26 avatar darkfrog26 commented on July 17, 2024

I saw your PR, but wanted to take a shot at going through it myself. Could you take a look at #13 and let me know if it solves your needs?

from scala-stripe.

Rixamos avatar Rixamos commented on July 17, 2024

Sure, I will take a look (probably tomorrow because it is a bit late today for me from italy :) ) .
Just to clarify my use case, I am trying to manage more currencies than just one per time, this by having people with a personal setting that is currency so the payment can be done in multiple currencies.
What I notices is the amount passed to Stripe was everytime multiplied and on Charges was everytime divided per 100 (I suspect there are more place affected, as i saw fastly you changed also the BankAccount to manage the defaultCurrency)
My simple tests have been USD and JPY. Tomorrow I will repeat my tests to have an idea about how is workign the #13
Thank you very much for your support.

from scala-stripe.

Rixamos avatar Rixamos commented on July 17, 2024

I tried with
amount = Money(amount,Currency.getInstance(currency)), //amount in bigdecimal without scale and adding currency
amount = Money(amountScaled), // amount in bigdecimal with scale included
amount = Money(amountScaled,Currency.getInstance(currency)), // amount in bigdecimal with scale included and currency
but the line 166 in Implicits, the encoder, multiplies per the defaultCurrency the amount.
so in Stripe the amounts are multiplied per 100.
When the amount comes back, is considered X*100 but the decoder will divide it again to seems all ok on the app side, however in stripe account it isn't
In add on my personal opinion the "def apply(d: BigDecimal)" is a bit missleading in case someone pass the bigdecimal scaled yet.
I am not expert in scala and encoders and decorders, but is it possible to give to the encoder/decoder a parameter of the currenc currency/scale?
Thanks for your help on this issue.

from scala-stripe.

darkfrog26 avatar darkfrog26 commented on July 17, 2024

Well, realistically this is a problem that should be handled by Stripe more. There are a few places where the currency is specified in the resulting value, and that should be used but it seems pretty hacky.

As far as coming from Stripe it should work already, but didn't you say it's no supported yet?

from scala-stripe.

Rixamos avatar Rixamos commented on July 17, 2024

In the currencies that stripe supports there are some currencies without decimal fraction, i put an extract of how it works in Money.scala
Practically for whom has cents 100 = 1.00 and from whom doesn't 100=100 this is the trick.
Practically is working with the minimum possible granularity per currency
https://stripe.com/docs/currencies#zero-decimal here there is the explenation

from scala-stripe.

darkfrog26 avatar darkfrog26 commented on July 17, 2024

That explanation states that JPY is a zero decimal currency...

from scala-stripe.

Rixamos avatar Rixamos commented on July 17, 2024

Hello, yes, probably I explained myself wrongly, but this is the exact issue i noticed in JPY that for example has 0 decimals, there are also other currencies have 3 or 4 decimals if i remember correctly but at the moment aren t supported by stripe.
However as you can see from the link there are some with 0 decimals that are and fall in this issue.
In next days i will not be available but next week i ll return online so, sorry in advance for the silence in next days

from scala-stripe.

darkfrog26 avatar darkfrog26 commented on July 17, 2024

No worries. I'll try to give this some more thought and see if there's a good way we can handle it.

from scala-stripe.

Related Issues (3)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.