Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adyen: Add currencies with three decimals places #4322

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/active_merchant/billing/gateways/adyen.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ class AdyenGateway < Gateway
self.supported_countries = %w(AT AU BE BG BR CH CY CZ DE DK EE ES FI FR GB GI GR HK HU IE IS IT LI LT LU LV MC MT MX NL NO PL PT RO SE SG SK SI US)
self.default_currency = 'USD'
self.currencies_without_fractions = %w(CVE DJF GNF IDR JPY KMF KRW PYG RWF UGX VND VUV XAF XOF XPF)
self.currencies_with_three_decimal_places = %w(BHD IQD JOD KWD LYD OMR TND)
self.supported_cardtypes = %i[visa master american_express diners_club jcb dankort maestro discover elo naranja cabal unionpay]

self.money_format = :cents
Expand Down
8 changes: 8 additions & 0 deletions test/unit/gateways/adyen_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1146,6 +1146,14 @@ def test_optional_idempotency_key_header
assert_success response
end

def test_three_decimal_places_currency_handling
stub_comms do
@gateway.authorize(1000, @credit_card, @options.merge(currency: 'JOD'))
end.check_request(skip_response: true) do |_endpoint, data|
assert_match(/"amount\":{\"value\":\"1000\",\"currency\":\"JOD\"}/, data)
end
end

private

def stored_credential_options(*args, ntid: nil)
Expand Down