RubyMoney / google_currency

Ruby Money::Bank interface for the Google Currency exchange data
http://rubymoney.github.com/google_currency
MIT License
182 stars 90 forks source link

Incorrect amount converting USD -> VND #40

Closed jlarusso closed 9 years ago

jlarusso commented 9 years ago

I'm missing a few decimal places when converting from US dollars to Vietnamese Dong.

irb(main):001:0> usd = Money.new(50, 'USD')
=> #<Money fractional:50 currency:USD>
irb(main):002:0> vnd = usd.exchange_to('VND')
=> #<Money fractional:10902 currency:VND>
irb(main):003:0> vnd.to_i
=> 10902

The google finance converter shows 50 USD = 1090250 VND

Could this be a bug?

semmons99 commented 9 years ago

My guess, Google is using a different size subunit than is used in physical transactions, much this this ticket: https://github.com/RubyMoney/google_currency/issues/38

Perhaps you can research and submit a similar patch.