diff --git a/features/forex.feature b/features/forex.feature new file mode 100644 index 0000000..15057e8 --- /dev/null +++ b/features/forex.feature @@ -0,0 +1,50 @@ +Feature: Forex + Foreign currency exchange, hereafter 'forex', is a feature that allows + marketplaces to charge thier buyers in non-USD currencies. + + This provides a better experience for customers who have accounts denominated + in other currencies, and reduces chargeback rates for those customers as well. + + Scenario: Debit a card in € + Given I have tokenized a card + When I make a POST request to the link "cards.debits" with the body: + """ + { + "debits": [{ + "amount": 2000, + "currency": "EUR" + }] + } + """ + Then I should get a 201 Created status code + And the response is valid according to the "debits" schema + And the fields on this debit match: + """ + { + "currency": "EUR" + } + """ + + Scenario: Debiting a card directly in € + When I POST to /debits with the body: + """ + { + "debits": [{ + "amount": 1234, + "source": { + "number": "4111111111111111", + "expiration_year": "2018", + "expiration_month": 12 + }, + "currency": "EUR" + }] + } + """ + Then I should get a 201 Created status code + And the response is valid according to the "debits" schema + And the fields on this debit match: + """ + { + "currency": "EUR" + } + """ diff --git a/fixtures/_models/currency.json b/fixtures/_models/currency.json new file mode 100644 index 0000000..aa5c04d --- /dev/null +++ b/fixtures/_models/currency.json @@ -0,0 +1,164 @@ +{ + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "string", + "enum": [ + "AED", + "AFN", + "ALL", + "AMD", + "ANG", + "AOA", + "ARS", + "AUD", + "AWG", + "AZN", + "BAM", + "BBD", + "BDT", + "BGN", + "BHD", + "BIF", + "BMD", + "BND", + "BOB", + "BRL", + "BSD", + "BWP", + "BYR", + "BZD", + "CAD", + "CDF", + "CHF", + "CLP", + "CNY", + "COP", + "CRC", + "CUC", + "CVE", + "CZK", + "DJF", + "DKK", + "DOP", + "DZD", + "EEK", + "EGP", + "ERN", + "ETB", + "EUR", + "FJD", + "FKP", + "GBP", + "GEL", + "GHS", + "GIP", + "GMD", + "GNF", + "GQE", + "GTQ", + "GYD", + "HKD", + "HNL", + "HRK", + "HTG", + "HUF", + "IDR", + "ILS", + "INR", + "IQD", + "IRR", + "ISK", + "JMD", + "JOD", + "JPY", + "KES", + "KGS", + "KHR", + "KMF", + "KPW", + "KRW", + "KWD", + "KYD", + "KZT", + "LAK", + "LBP", + "LKR", + "LRD", + "LSL", + "LTL", + "LVL", + "LYD", + "MAD", + "MDL", + "MGA", + "MKD", + "MMK", + "MNT", + "MOP", + "MRO", + "MUR", + "MVR", + "MWK", + "MXN", + "MYR", + "MZM", + "NAD", + "NGN", + "NIO", + "NOK", + "NPR", + "NZD", + "OMR", + "PAB", + "PEN", + "PGK", + "PHP", + "PKR", + "PLN", + "PYG", + "QAR", + "RON", + "RSD", + "RUB", + "RWF", + "SAR", + "SBD", + "SCR", + "SDG", + "SEK", + "SGD", + "SHP", + "SLL", + "SOS", + "SRD", + "STD", + "SYP", + "SZL", + "THB", + "TJS", + "TMM", + "TMT", + "TND", + "TOP", + "TRY", + "TTD", + "TWD", + "TZS", + "UAH", + "UGX", + "USD", + "UYU", + "UZS", + "VEB", + "VND", + "VUV", + "WST", + "XAF", + "XCD", + "XOF", + "XPF", + "YER", + "ZAR", + "ZMK", + "ZWR" + ] +} diff --git a/fixtures/_models/debit.json b/fixtures/_models/debit.json index 689d81c..357fe18 100644 --- a/fixtures/_models/debit.json +++ b/fixtures/_models/debit.json @@ -19,16 +19,21 @@ "type": "string", "format": "date-time" }, + "currency": { + "$ref": "_models/currency.json" + }, "amount": { "description": "The amount of the debit in cents.", "type": "integer", "minimum": 1 }, - "currency": { - "type": "string", - "enum": [ - "USD" - ] + "amount_in_escrow_currency": { + "description": "The amount of the debit in cents, denominated in the escrow_currency.", + "type": "integer", + "minimum": 1 + }, + "escrow_currency": { + "$ref": "_models/currency.json" }, "appears_on_statement_as": { "$ref": "appears_on_statement_as.json" @@ -122,4 +127,4 @@ "meta", "links" ] -} \ No newline at end of file +}