diff --git a/README.md b/README.md index cd6a24025f..257151a20d 100644 --- a/README.md +++ b/README.md @@ -156,9 +156,9 @@ func handler(w http.ResponseWriter, r *http.Request) { sc := stripeClient.New("sk_live_key", stripe.NewBackends(httpClient)) chargeParams := &stripe.ChargeParams{ - Amount: 2000, - Currency: "usd", - Desc: "Charge from Google App Engine", + Amount: stripe.Int64(2000), + Currency: stripe.String(string(stripe.CurrencyUSD)), + Desc: stripe.String("Charge from Google App Engine"), } chargeParams.SetSource("tok_amex") // obtained with Stripe.js charge, err := sc.Charges.New(chargeParams) diff --git a/charge.go b/charge.go index e3a9606d74..3bb9818904 100644 --- a/charge.go +++ b/charge.go @@ -19,10 +19,6 @@ const ( ChargeFraudStripeReportFraudulent ChargeFraudStripeReport = "fraudulent" ) -// Currency is the list of supported currencies. -// For more details see https://support.stripe.com/questions/which-currencies-does-stripe-support. -type Currency string - // ChargeParams is the set of parameters that can be used when creating or updating a charge. // For more details see https://stripe.com/docs/api#create_charge and https://stripe.com/docs/api#update_charge. type ChargeParams struct { diff --git a/charge/client_test.go b/charge/client_test.go index 194c9cc351..d63e49a67e 100644 --- a/charge/client_test.go +++ b/charge/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -45,7 +44,7 @@ func TestChargeMarkFraudulent(t *testing.T) { func TestChargeNew(t *testing.T) { charge, err := New(&stripe.ChargeParams{ Amount: stripe.Int64(123), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), Source: &stripe.SourceParams{Token: stripe.String("src_123")}, Shipping: &stripe.ShippingDetailsParams{ Address: &stripe.AddressParams{ @@ -63,7 +62,7 @@ func TestChargeNew(t *testing.T) { func TestChargeNew_WithSetSource(t *testing.T) { params := stripe.ChargeParams{ Amount: stripe.Int64(123), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), } params.SetSource("tok_123") diff --git a/coupon/client_test.go b/coupon/client_test.go index 8027ee4909..13b159d322 100644 --- a/coupon/client_test.go +++ b/coupon/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -32,7 +31,7 @@ func TestCouponList(t *testing.T) { func TestCouponNew(t *testing.T) { coupon, err := New(&stripe.CouponParams{ - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), Duration: stripe.String(string(stripe.CouponDurationRepeating)), DurationInMonths: stripe.Int64(3), ID: stripe.String("25OFF"), diff --git a/currency.go b/currency.go new file mode 100644 index 0000000000..9023162995 --- /dev/null +++ b/currency.go @@ -0,0 +1,147 @@ +package stripe + +// Currency is the list of supported currencies. +// For more details see https://support.stripe.com/questions/which-currencies-does-stripe-support. +type Currency string + +const ( + CurrencyAED Currency = "aed" // United Arab Emirates Dirham + CurrencyAFN Currency = "afn" // Afghan Afghani + CurrencyALL Currency = "all" // Albanian Lek + CurrencyAMD Currency = "amd" // Armenian Dram + CurrencyANG Currency = "ang" // Netherlands Antillean Gulden + CurrencyAOA Currency = "aoa" // Angolan Kwanza + CurrencyARS Currency = "ars" // Argentine Peso + CurrencyAUD Currency = "aud" // Australian Dollar + CurrencyAWG Currency = "awg" // Aruban Florin + CurrencyAZN Currency = "azn" // Azerbaijani Manat + CurrencyBAM Currency = "bam" // Bosnia & Herzegovina Convertible Mark + CurrencyBBD Currency = "bbd" // Barbadian Dollar + CurrencyBDT Currency = "bdt" // Bangladeshi Taka + CurrencyBGN Currency = "bgn" // Bulgarian Lev + CurrencyBIF Currency = "bif" // Burundian Franc + CurrencyBMD Currency = "bmd" // Bermudian Dollar + CurrencyBND Currency = "bnd" // Brunei Dollar + CurrencyBOB Currency = "bob" // Bolivian Boliviano + CurrencyBRL Currency = "brl" // Brazilian Real + CurrencyBSD Currency = "bsd" // Bahamian Dollar + CurrencyBWP Currency = "bwp" // Botswana Pula + CurrencyBZD Currency = "bzd" // Belize Dollar + CurrencyCAD Currency = "cad" // Canadian Dollar + CurrencyCDF Currency = "cdf" // Congolese Franc + CurrencyCHF Currency = "chf" // Swiss Franc + CurrencyCLP Currency = "clp" // Chilean Peso + CurrencyCNY Currency = "cny" // Chinese Renminbi Yuan + CurrencyCOP Currency = "cop" // Colombian Peso + CurrencyCRC Currency = "crc" // Costa Rican Colón + CurrencyCVE Currency = "cve" // Cape Verdean Escudo + CurrencyCZK Currency = "czk" // Czech Koruna + CurrencyDJF Currency = "djf" // Djiboutian Franc + CurrencyDKK Currency = "dkk" // Danish Krone + CurrencyDOP Currency = "dop" // Dominican Peso + CurrencyDZD Currency = "dzd" // Algerian Dinar + CurrencyEEK Currency = "eek" // Estonian Kroon + CurrencyEGP Currency = "egp" // Egyptian Pound + CurrencyETB Currency = "etb" // Ethiopian Birr + CurrencyEUR Currency = "eur" // Euro + CurrencyFJD Currency = "fjd" // Fijian Dollar + CurrencyFKP Currency = "fkp" // Falkland Islands Pound + CurrencyGBP Currency = "gbp" // British Pound + CurrencyGEL Currency = "gel" // Georgian Lari + CurrencyGIP Currency = "gip" // Gibraltar Pound + CurrencyGMD Currency = "gmd" // Gambian Dalasi + CurrencyGNF Currency = "gnf" // Guinean Franc + CurrencyGTQ Currency = "gtq" // Guatemalan Quetzal + CurrencyGYD Currency = "gyd" // Guyanese Dollar + CurrencyHKD Currency = "hkd" // Hong Kong Dollar + CurrencyHNL Currency = "hnl" // Honduran Lempira + CurrencyHRK Currency = "hrk" // Croatian Kuna + CurrencyHTG Currency = "htg" // Haitian Gourde + CurrencyHUF Currency = "huf" // Hungarian Forint + CurrencyIDR Currency = "idr" // Indonesian Rupiah + CurrencyILS Currency = "ils" // Israeli New Sheqel + CurrencyINR Currency = "inr" // Indian Rupee + CurrencyISK Currency = "isk" // Icelandic Króna + CurrencyJMD Currency = "jmd" // Jamaican Dollar + CurrencyJPY Currency = "jpy" // Japanese Yen + CurrencyKES Currency = "kes" // Kenyan Shilling + CurrencyKGS Currency = "kgs" // Kyrgyzstani Som + CurrencyKHR Currency = "khr" // Cambodian Riel + CurrencyKMF Currency = "kmf" // Comorian Franc + CurrencyKRW Currency = "krw" // South Korean Won + CurrencyKYD Currency = "kyd" // Cayman Islands Dollar + CurrencyKZT Currency = "kzt" // Kazakhstani Tenge + CurrencyLAK Currency = "lak" // Lao Kip + CurrencyLBP Currency = "lbp" // Lebanese Pound + CurrencyLKR Currency = "lkr" // Sri Lankan Rupee + CurrencyLRD Currency = "lrd" // Liberian Dollar + CurrencyLSL Currency = "lsl" // Lesotho Loti + CurrencyLTL Currency = "ltl" // Lithuanian Litas + CurrencyLVL Currency = "lvl" // Latvian Lats + CurrencyMAD Currency = "mad" // Moroccan Dirham + CurrencyMDL Currency = "mdl" // Moldovan Leu + CurrencyMGA Currency = "mga" // Malagasy Ariary + CurrencyMKD Currency = "mkd" // Macedonian Denar + CurrencyMNT Currency = "mnt" // Mongolian Tögrög + CurrencyMOP Currency = "mop" // Macanese Pataca + CurrencyMRO Currency = "mro" // Mauritanian Ouguiya + CurrencyMUR Currency = "mur" // Mauritian Rupee + CurrencyMVR Currency = "mvr" // Maldivian Rufiyaa + CurrencyMWK Currency = "mwk" // Malawian Kwacha + CurrencyMXN Currency = "mxn" // Mexican Peso + CurrencyMYR Currency = "myr" // Malaysian Ringgit + CurrencyMZN Currency = "mzn" // Mozambican Metical + CurrencyNAD Currency = "nad" // Namibian Dollar + CurrencyNGN Currency = "ngn" // Nigerian Naira + CurrencyNIO Currency = "nio" // Nicaraguan Córdoba + CurrencyNOK Currency = "nok" // Norwegian Krone + CurrencyNPR Currency = "npr" // Nepalese Rupee + CurrencyNZD Currency = "nzd" // New Zealand Dollar + CurrencyPAB Currency = "pab" // Panamanian Balboa + CurrencyPEN Currency = "pen" // Peruvian Nuevo Sol + CurrencyPGK Currency = "pgk" // Papua New Guinean Kina + CurrencyPHP Currency = "php" // Philippine Peso + CurrencyPKR Currency = "pkr" // Pakistani Rupee + CurrencyPLN Currency = "pln" // Polish Złoty + CurrencyPYG Currency = "pyg" // Paraguayan Guaraní + CurrencyQAR Currency = "qar" // Qatari Riyal + CurrencyRON Currency = "ron" // Romanian Leu + CurrencyRSD Currency = "rsd" // Serbian Dinar + CurrencyRUB Currency = "rub" // Russian Ruble + CurrencyRWF Currency = "rwf" // Rwandan Franc + CurrencySAR Currency = "sar" // Saudi Riyal + CurrencySBD Currency = "sbd" // Solomon Islands Dollar + CurrencySCR Currency = "scr" // Seychellois Rupee + CurrencySEK Currency = "sek" // Swedish Krona + CurrencySGD Currency = "sgd" // Singapore Dollar + CurrencySHP Currency = "shp" // Saint Helenian Pound + CurrencySLL Currency = "sll" // Sierra Leonean Leone + CurrencySOS Currency = "sos" // Somali Shilling + CurrencySRD Currency = "srd" // Surinamese Dollar + CurrencySTD Currency = "std" // São Tomé and Príncipe Dobra + CurrencySVC Currency = "svc" // Salvadoran Colón + CurrencySZL Currency = "szl" // Swazi Lilangeni + CurrencyTHB Currency = "thb" // Thai Baht + CurrencyTJS Currency = "tjs" // Tajikistani Somoni + CurrencyTOP Currency = "top" // Tongan Paʻanga + CurrencyTRY Currency = "try" // Turkish Lira + CurrencyTTD Currency = "ttd" // Trinidad and Tobago Dollar + CurrencyTWD Currency = "twd" // New Taiwan Dollar + CurrencyTZS Currency = "tzs" // Tanzanian Shilling + CurrencyUAH Currency = "uah" // Ukrainian Hryvnia + CurrencyUGX Currency = "ugx" // Ugandan Shilling + CurrencyUSD Currency = "usd" // United States Dollar + CurrencyUYU Currency = "uyu" // Uruguayan Peso + CurrencyUZS Currency = "uzs" // Uzbekistani Som + CurrencyVEF Currency = "vef" // Venezuelan Bolívar + CurrencyVND Currency = "vnd" // Vietnamese Đồng + CurrencyVUV Currency = "vuv" // Vanuatu Vatu + CurrencyWST Currency = "wst" // Samoan Tala + CurrencyXAF Currency = "xaf" // Central African Cfa Franc + CurrencyXCD Currency = "xcd" // East Caribbean Dollar + CurrencyXOF Currency = "xof" // West African Cfa Franc + CurrencyXPF Currency = "xpf" // Cfp Franc + CurrencyYER Currency = "yer" // Yemeni Rial + CurrencyZAR Currency = "zar" // South African Rand + CurrencyZMW Currency = "zmw" // Zambian Kwacha +) diff --git a/currency/currency.go b/currency/currency.go deleted file mode 100644 index bac8844a61..0000000000 --- a/currency/currency.go +++ /dev/null @@ -1,148 +0,0 @@ -// Package currency provides the list of currency codes -package currency - -import ( - stripe "github.com/stripe/stripe-go" -) - -const ( - AED stripe.Currency = "aed" // United Arab Emirates Dirham - AFN stripe.Currency = "afn" // Afghan Afghani - ALL stripe.Currency = "all" // Albanian Lek - AMD stripe.Currency = "amd" // Armenian Dram - ANG stripe.Currency = "ang" // Netherlands Antillean Gulden - AOA stripe.Currency = "aoa" // Angolan Kwanza - ARS stripe.Currency = "ars" // Argentine Peso - AUD stripe.Currency = "aud" // Australian Dollar - AWG stripe.Currency = "awg" // Aruban Florin - AZN stripe.Currency = "azn" // Azerbaijani Manat - BAM stripe.Currency = "bam" // Bosnia & Herzegovina Convertible Mark - BBD stripe.Currency = "bbd" // Barbadian Dollar - BDT stripe.Currency = "bdt" // Bangladeshi Taka - BGN stripe.Currency = "bgn" // Bulgarian Lev - BIF stripe.Currency = "bif" // Burundian Franc - BMD stripe.Currency = "bmd" // Bermudian Dollar - BND stripe.Currency = "bnd" // Brunei Dollar - BOB stripe.Currency = "bob" // Bolivian Boliviano - BRL stripe.Currency = "brl" // Brazilian Real - BSD stripe.Currency = "bsd" // Bahamian Dollar - BWP stripe.Currency = "bwp" // Botswana Pula - BZD stripe.Currency = "bzd" // Belize Dollar - CAD stripe.Currency = "cad" // Canadian Dollar - CDF stripe.Currency = "cdf" // Congolese Franc - CHF stripe.Currency = "chf" // Swiss Franc - CLP stripe.Currency = "clp" // Chilean Peso - CNY stripe.Currency = "cny" // Chinese Renminbi Yuan - COP stripe.Currency = "cop" // Colombian Peso - CRC stripe.Currency = "crc" // Costa Rican Colón - CVE stripe.Currency = "cve" // Cape Verdean Escudo - CZK stripe.Currency = "czk" // Czech Koruna - DJF stripe.Currency = "djf" // Djiboutian Franc - DKK stripe.Currency = "dkk" // Danish Krone - DOP stripe.Currency = "dop" // Dominican Peso - DZD stripe.Currency = "dzd" // Algerian Dinar - EEK stripe.Currency = "eek" // Estonian Kroon - EGP stripe.Currency = "egp" // Egyptian Pound - ETB stripe.Currency = "etb" // Ethiopian Birr - EUR stripe.Currency = "eur" // Euro - FJD stripe.Currency = "fjd" // Fijian Dollar - FKP stripe.Currency = "fkp" // Falkland Islands Pound - GBP stripe.Currency = "gbp" // British Pound - GEL stripe.Currency = "gel" // Georgian Lari - GIP stripe.Currency = "gip" // Gibraltar Pound - GMD stripe.Currency = "gmd" // Gambian Dalasi - GNF stripe.Currency = "gnf" // Guinean Franc - GTQ stripe.Currency = "gtq" // Guatemalan Quetzal - GYD stripe.Currency = "gyd" // Guyanese Dollar - HKD stripe.Currency = "hkd" // Hong Kong Dollar - HNL stripe.Currency = "hnl" // Honduran Lempira - HRK stripe.Currency = "hrk" // Croatian Kuna - HTG stripe.Currency = "htg" // Haitian Gourde - HUF stripe.Currency = "huf" // Hungarian Forint - IDR stripe.Currency = "idr" // Indonesian Rupiah - ILS stripe.Currency = "ils" // Israeli New Sheqel - INR stripe.Currency = "inr" // Indian Rupee - ISK stripe.Currency = "isk" // Icelandic Króna - JMD stripe.Currency = "jmd" // Jamaican Dollar - JPY stripe.Currency = "jpy" // Japanese Yen - KES stripe.Currency = "kes" // Kenyan Shilling - KGS stripe.Currency = "kgs" // Kyrgyzstani Som - KHR stripe.Currency = "khr" // Cambodian Riel - KMF stripe.Currency = "kmf" // Comorian Franc - KRW stripe.Currency = "krw" // South Korean Won - KYD stripe.Currency = "kyd" // Cayman Islands Dollar - KZT stripe.Currency = "kzt" // Kazakhstani Tenge - LAK stripe.Currency = "lak" // Lao Kip - LBP stripe.Currency = "lbp" // Lebanese Pound - LKR stripe.Currency = "lkr" // Sri Lankan Rupee - LRD stripe.Currency = "lrd" // Liberian Dollar - LSL stripe.Currency = "lsl" // Lesotho Loti - LTL stripe.Currency = "ltl" // Lithuanian Litas - LVL stripe.Currency = "lvl" // Latvian Lats - MAD stripe.Currency = "mad" // Moroccan Dirham - MDL stripe.Currency = "mdl" // Moldovan Leu - MGA stripe.Currency = "mga" // Malagasy Ariary - MKD stripe.Currency = "mkd" // Macedonian Denar - MNT stripe.Currency = "mnt" // Mongolian Tögrög - MOP stripe.Currency = "mop" // Macanese Pataca - MRO stripe.Currency = "mro" // Mauritanian Ouguiya - MUR stripe.Currency = "mur" // Mauritian Rupee - MVR stripe.Currency = "mvr" // Maldivian Rufiyaa - MWK stripe.Currency = "mwk" // Malawian Kwacha - MXN stripe.Currency = "mxn" // Mexican Peso - MYR stripe.Currency = "myr" // Malaysian Ringgit - MZN stripe.Currency = "mzn" // Mozambican Metical - NAD stripe.Currency = "nad" // Namibian Dollar - NGN stripe.Currency = "ngn" // Nigerian Naira - NIO stripe.Currency = "nio" // Nicaraguan Córdoba - NOK stripe.Currency = "nok" // Norwegian Krone - NPR stripe.Currency = "npr" // Nepalese Rupee - NZD stripe.Currency = "nzd" // New Zealand Dollar - PAB stripe.Currency = "pab" // Panamanian Balboa - PEN stripe.Currency = "pen" // Peruvian Nuevo Sol - PGK stripe.Currency = "pgk" // Papua New Guinean Kina - PHP stripe.Currency = "php" // Philippine Peso - PKR stripe.Currency = "pkr" // Pakistani Rupee - PLN stripe.Currency = "pln" // Polish Złoty - PYG stripe.Currency = "pyg" // Paraguayan Guaraní - QAR stripe.Currency = "qar" // Qatari Riyal - RON stripe.Currency = "ron" // Romanian Leu - RSD stripe.Currency = "rsd" // Serbian Dinar - RUB stripe.Currency = "rub" // Russian Ruble - RWF stripe.Currency = "rwf" // Rwandan Franc - SAR stripe.Currency = "sar" // Saudi Riyal - SBD stripe.Currency = "sbd" // Solomon Islands Dollar - SCR stripe.Currency = "scr" // Seychellois Rupee - SEK stripe.Currency = "sek" // Swedish Krona - SGD stripe.Currency = "sgd" // Singapore Dollar - SHP stripe.Currency = "shp" // Saint Helenian Pound - SLL stripe.Currency = "sll" // Sierra Leonean Leone - SOS stripe.Currency = "sos" // Somali Shilling - SRD stripe.Currency = "srd" // Surinamese Dollar - STD stripe.Currency = "std" // São Tomé and Príncipe Dobra - SVC stripe.Currency = "svc" // Salvadoran Colón - SZL stripe.Currency = "szl" // Swazi Lilangeni - THB stripe.Currency = "thb" // Thai Baht - TJS stripe.Currency = "tjs" // Tajikistani Somoni - TOP stripe.Currency = "top" // Tongan Paʻanga - TRY stripe.Currency = "try" // Turkish Lira - TTD stripe.Currency = "ttd" // Trinidad and Tobago Dollar - TWD stripe.Currency = "twd" // New Taiwan Dollar - TZS stripe.Currency = "tzs" // Tanzanian Shilling - UAH stripe.Currency = "uah" // Ukrainian Hryvnia - UGX stripe.Currency = "ugx" // Ugandan Shilling - USD stripe.Currency = "usd" // United States Dollar - UYU stripe.Currency = "uyu" // Uruguayan Peso - UZS stripe.Currency = "uzs" // Uzbekistani Som - VEF stripe.Currency = "vef" // Venezuelan Bolívar - VND stripe.Currency = "vnd" // Vietnamese Đồng - VUV stripe.Currency = "vuv" // Vanuatu Vatu - WST stripe.Currency = "wst" // Samoan Tala - XAF stripe.Currency = "xaf" // Central African Cfa Franc - XCD stripe.Currency = "xcd" // East Caribbean Dollar - XOF stripe.Currency = "xof" // West African Cfa Franc - XPF stripe.Currency = "xpf" // Cfp Franc - YER stripe.Currency = "yer" // Yemeni Rial - ZAR stripe.Currency = "zar" // South African Rand - ZMW stripe.Currency = "zmw" // Zambian Kwacha -) diff --git a/currency/currency_test.go b/currency/currency_test.go deleted file mode 100644 index 1e926a49a0..0000000000 --- a/currency/currency_test.go +++ /dev/null @@ -1,5 +0,0 @@ -package currency - -import ( - _ "github.com/stripe/stripe-go/testing" -) diff --git a/example_test.go b/example_test.go index 27236fd645..641a57f020 100644 --- a/example_test.go +++ b/example_test.go @@ -5,7 +5,6 @@ import ( stripe "github.com/stripe/stripe-go" "github.com/stripe/stripe-go/charge" - "github.com/stripe/stripe-go/currency" "github.com/stripe/stripe-go/customer" "github.com/stripe/stripe-go/invoice" "github.com/stripe/stripe-go/plan" @@ -16,7 +15,7 @@ func ExampleCharge_new() { params := &stripe.ChargeParams{ Amount: stripe.Int64(1000), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), } params.SetSource("tok_visa") params.AddMetadata("key", "value") diff --git a/exchangerate/client_test.go b/exchangerate/client_test.go index b93f95e59e..91ba1113ae 100644 --- a/exchangerate/client_test.go +++ b/exchangerate/client_test.go @@ -5,12 +5,11 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) func TestExchangeRateGet(t *testing.T) { - rates, err := Get(string(currency.USD)) + rates, err := Get(string(stripe.CurrencyUSD)) assert.Nil(t, err) assert.NotNil(t, rates) } diff --git a/invoiceitem/client_test.go b/invoiceitem/client_test.go index 258fd61ef8..04c37627e6 100644 --- a/invoiceitem/client_test.go +++ b/invoiceitem/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -33,7 +32,7 @@ func TestInvoiceItemList(t *testing.T) { func TestInvoiceItemNew(t *testing.T) { item, err := New(&stripe.InvoiceItemParams{ Amount: stripe.Int64(123), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), Customer: stripe.String("cus_123"), }) assert.Nil(t, err) diff --git a/order/client_test.go b/order/client_test.go index e1db42d224..8a3580b07f 100644 --- a/order/client_test.go +++ b/order/client_test.go @@ -9,7 +9,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -30,7 +29,7 @@ func TestOrderList(t *testing.T) { func TestOrderNew(t *testing.T) { order, err := New(&stripe.OrderParams{ - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), }) assert.Nil(t, err) assert.NotNil(t, order) diff --git a/payout/client_test.go b/payout/client_test.go index 5209c94764..ed4554a3e8 100644 --- a/payout/client_test.go +++ b/payout/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -33,7 +32,7 @@ func TestPayoutList(t *testing.T) { func TestPayoutNew(t *testing.T) { payout, err := New(&stripe.PayoutParams{ Amount: stripe.Int64(123), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), }) assert.Nil(t, err) assert.NotNil(t, payout) diff --git a/plan/client_test.go b/plan/client_test.go index 39de697781..ad91cf73c7 100644 --- a/plan/client_test.go +++ b/plan/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -33,7 +32,7 @@ func TestPlanList(t *testing.T) { func TestPlanNew(t *testing.T) { plan, err := New(&stripe.PlanParams{ Amount: stripe.Int64(1), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), ID: stripe.String("sapphire-elite"), Interval: stripe.String(string(stripe.PlanIntervalMonth)), Product: &stripe.ProductParams{ @@ -50,7 +49,7 @@ func TestPlanNew(t *testing.T) { func TestPlanNewWithProductID(t *testing.T) { plan, err := New(&stripe.PlanParams{ Amount: stripe.Int64(1), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), ID: stripe.String("sapphire-elite"), Interval: stripe.String(string(stripe.PlanIntervalMonth)), ProductID: stripe.String("prod_12345abc"), diff --git a/plan_test.go b/plan_test.go index 1860f024c0..187d01256d 100644 --- a/plan_test.go +++ b/plan_test.go @@ -54,7 +54,7 @@ func TestPlanParams_AppendTo(t *testing.T) { want interface{} }{ {"amount", &PlanParams{Amount: Int64(123)}, strconv.FormatUint(123, 10)}, - {"currency", &PlanParams{Currency: String("usd")}, "usd"}, + {"currency", &PlanParams{Currency: String(string(CurrencyUSD))}, "usd"}, {"id", &PlanParams{ID: String("sapphire-elite")}, "sapphire-elite"}, {"interval", &PlanParams{Interval: String("month")}, "month"}, {"interval_count", &PlanParams{IntervalCount: Int64(3)}, strconv.FormatUint(3, 10)}, diff --git a/sku/client_test.go b/sku/client_test.go index c81734da1d..ec7aaecc18 100644 --- a/sku/client_test.go +++ b/sku/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -35,7 +34,7 @@ func TestSKUNew(t *testing.T) { Active: stripe.Bool(true), Attributes: map[string]string{"attr1": "val1", "attr2": "val2"}, Price: stripe.Int64(499), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), Inventory: &stripe.InventoryParams{ Type: stripe.String(string(stripe.SKUInventoryTypeBucket)), Value: stripe.String(string(stripe.SKUInventoryValueLimited)), diff --git a/source/client_test.go b/source/client_test.go index 5425852b61..c3e4adc18f 100644 --- a/source/client_test.go +++ b/source/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -19,7 +18,7 @@ func TestSourceNew(t *testing.T) { source, err := New(&stripe.SourceObjectParams{ Type: stripe.String("bitcoin"), Amount: stripe.Int64(1000), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), Flow: stripe.String(string(stripe.SourceFlowReceiver)), Owner: &stripe.SourceOwnerParams{ Email: stripe.String("jenny.rosen@example.com"), diff --git a/threedsecure/client_test.go b/threedsecure/client_test.go index efda2b8afa..4af2e2a79c 100644 --- a/threedsecure/client_test.go +++ b/threedsecure/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -18,7 +17,7 @@ func TestThreeDSecureGet(t *testing.T) { func TestThreeDSecureNew(t *testing.T) { threeDSecure, err := New(&stripe.ThreeDSecureParams{ Amount: stripe.Int64(1000), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), Customer: stripe.String("cus_123"), Card: stripe.String("card_123"), ReturnURL: stripe.String("https://test.com"), diff --git a/topup/client_test.go b/topup/client_test.go index 432e00f36e..896ef27624 100644 --- a/topup/client_test.go +++ b/topup/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -18,7 +17,7 @@ func TestTopupGet(t *testing.T) { func TestTopupNew(t *testing.T) { topup, err := New(&stripe.TopupParams{ Amount: stripe.Int64(123), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), Source: &stripe.SourceParams{Token: stripe.String("src_123")}, Description: stripe.String("creating a topup"), StatementDescriptor: stripe.String("topup"), @@ -30,7 +29,7 @@ func TestTopupNew(t *testing.T) { func TestTopupNew_WithSetSource(t *testing.T) { params := stripe.TopupParams{ Amount: stripe.Int64(123), - Currency: stripe.String("usd"), + Currency: stripe.String(string(stripe.CurrencyUSD)), Description: stripe.String("creating a topup"), StatementDescriptor: stripe.String("topup"), } diff --git a/transfer/client_test.go b/transfer/client_test.go index 1bff282a2c..e805b20ac8 100644 --- a/transfer/client_test.go +++ b/transfer/client_test.go @@ -5,7 +5,6 @@ import ( assert "github.com/stretchr/testify/require" stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/currency" _ "github.com/stripe/stripe-go/testing" ) @@ -27,7 +26,7 @@ func TestTransferList(t *testing.T) { func TestTransferNew(t *testing.T) { transfer, err := New(&stripe.TransferParams{ Amount: stripe.Int64(123), - Currency: stripe.String(string(currency.USD)), + Currency: stripe.String(string(stripe.CurrencyUSD)), Destination: stripe.String("acct_123"), SourceTransaction: stripe.String("ch_123"), SourceType: stripe.String(string(stripe.TransferSourceTypeCard)),