lib/active_merchant/billing/gateway.rb in activemerchant-1.100.0 vs lib/active_merchant/billing/gateway.rb in activemerchant-1.101.0
- old
+ new
@@ -121,12 +121,13 @@
# The supported card types for the gateway
class_attribute :supported_cardtypes
self.supported_cardtypes = []
+ # This default list of currencies without fractions are from https://en.wikipedia.org/wiki/ISO_4217
class_attribute :currencies_without_fractions, :currencies_with_three_decimal_places
- self.currencies_without_fractions = %w(BIF BYR CLP CVE DJF GNF ISK JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF)
+ self.currencies_without_fractions = %w(BIF BYR CLP CVE DJF GNF ISK JPY KMF KRW PYG RWF UGX UYI VND VUV XAF XOF XPF)
self.currencies_with_three_decimal_places = %w()
class_attribute :homepage_url
class_attribute :display_name
@@ -153,13 +154,11 @@
result.to_s.downcase
end
def self.supported_countries=(country_codes)
country_codes.each do |country_code|
- unless ActiveMerchant::Country.find(country_code)
- raise ActiveMerchant::InvalidCountryCodeError, "No country could be found for the country #{country_code}"
- end
+ raise ActiveMerchant::InvalidCountryCodeError, "No country could be found for the country #{country_code}" unless ActiveMerchant::Country.find(country_code)
end
@supported_countries = country_codes.dup
end
def self.supported_countries
@@ -255,12 +254,10 @@
money.cents
else
money
end
- if money.is_a?(String)
- raise ArgumentError, 'money amount must be a positive Integer in cents.'
- end
+ raise ArgumentError, 'money amount must be a positive Integer in cents.' if money.is_a?(String)
if self.money_format == :cents
cents.to_s
else
sprintf('%.2f', cents.to_f / 100)