Skip to content

Commit

Permalink
Remove the currency package
Browse files Browse the repository at this point in the history
  • Loading branch information
remi-stripe committed May 24, 2018
1 parent 35258f8 commit 3ac12b5
Show file tree
Hide file tree
Showing 19 changed files with 167 additions and 190 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions charge.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions charge/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand Down Expand Up @@ -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{
Expand All @@ -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")

Expand Down
3 changes: 1 addition & 2 deletions coupon/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
)

Expand All @@ -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"),
Expand Down
147 changes: 147 additions & 0 deletions currency.go
Original file line number Diff line number Diff line change
@@ -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
)
148 changes: 0 additions & 148 deletions currency/currency.go

This file was deleted.

5 changes: 0 additions & 5 deletions currency/currency_test.go

This file was deleted.

3 changes: 1 addition & 2 deletions example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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")
Expand Down
Loading

0 comments on commit 3ac12b5

Please sign in to comment.