Class: Money::Converters::StripeConverter

Inherits:
Iso4217Converter show all
Defined in:
lib/money/converters/stripe_converter.rb

Constant Summary collapse

SUBUNIT_TO_UNIT =
{
  # https://docs.stripe.com/currencies#special-cases
  'ISK' => 100,
  'UGX' => 100,
  'HUF' => 100,
  'TWD' => 100,
  # https://docs.stripe.com/currencies#zero-decimal
  'BIF' => 1,
  'CLP' => 1,
  'DJF' => 1,
  'GNF' => 1,
  'JPY' => 1,
  'KMF' => 1,
  'KRW' => 1,
  'MGA' => 1,
  'PYG' => 1,
  'RWF' => 1,
  'VND' => 1,
  'VUV' => 1,
  'XAF' => 1,
  'XOF' => 1,
  'XPF' => 1,
  'USDC' => 1_000_000,
}.freeze

Instance Method Summary collapse

Methods inherited from Converter

#from_subunits, #to_subunits

Instance Method Details

#subunit_to_unit(currency) ⇒ Object



31
32
33
# File 'lib/money/converters/stripe_converter.rb', line 31

def subunit_to_unit(currency)
  SUBUNIT_TO_UNIT.fetch(currency.iso_code, super)
end