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

Rename all properties in the library to match the API reference #544

Merged
merged 32 commits into from
Jun 6, 2018
Merged
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
fdd38c4
Rename all properties in the library to match the API reference
remi-stripe Sep 19, 2017
afadd09
Add methods to manage parameter types as pointers
remi-stripe Jan 7, 2018
f875db9
Rework most of the library naming and structure
remi-stripe Sep 19, 2017
0af1351
Move UsageRecord to pointers for parameters
remi-stripe Apr 14, 2018
eeafe40
Moving all int/uint to int64 for consistency
remi-stripe Apr 14, 2018
edc4a19
Properly handle Document on legal entity for resource and params
remi-stripe Apr 14, 2018
d18ea7f
Fix customer to be a pointer on OrderListParams
remi-stripe Apr 14, 2018
00d32a1
Properly rename Fullfilled even though it does not match the API
remi-stripe Apr 14, 2018
165546b
Fix remaining params not passed as booleans
remi-stripe Apr 14, 2018
5dc66db
Fix examples in the Readme to match new logic
remi-stripe Apr 14, 2018
c395132
Fixed missed parameters/properties names
remi-stripe Apr 18, 2018
266cda7
Review fixes
remi-stripe Apr 18, 2018
275bd35
Use custom types for resources and string on params
remi-stripe May 24, 2018
8e1e874
Remove the currency package
remi-stripe May 24, 2018
19d0c24
Move all embedded struct resources to pointers
remi-stripe May 24, 2018
c0085ac
Properly move any remaining parameter slices to a slice of pointers
remi-stripe May 24, 2018
66ac54f
Fix resources to pass a parameter's value in the URL not the pointer
remi-stripe May 25, 2018
c0d2ee1
Fix the parameter to be the value and not the pointer address
remi-stripe May 25, 2018
63d5c58
Address review comments
remi-stripe May 25, 2018
21fac3e
Fix extra space
remi-stripe May 25, 2018
0ce559d
Plan creation allows specific params for inline Product creation
remi-stripe May 26, 2018
e2dcfe1
Create params for cancelation and add support for cancel_at_period_end
remi-stripe May 26, 2018
53cda78
Rename discount's DelSub to DelSubscription and fix unit test
remi-stripe May 26, 2018
f246515
Only pass custom sub parameter if booleans are true
remi-stripe May 26, 2018
ec9f324
Add support for the account token on Account creation or update
remi-stripe May 31, 2018
e0331df
Added constants and properties/params for Plan Product while review docs
remi-stripe Jun 1, 2018
8c71eb5
Reverting ApplicationFeeRefund back to FeeRefund
remi-stripe Jun 1, 2018
537b35b
Fix test parameters to be compatible with stripe-mock 0.17.0
brandur Jun 4, 2018
22d1bb9
Convert Params and ListParams fields to pointers as well for consistency
brandur Jun 5, 2018
b3c54c5
Add ListParams.SetStripeAccount and use it in tests
brandur Jun 5, 2018
69562de
Fixed one last example
remi-stripe Jun 5, 2018
56c6c56
Fix card and bank account endpoints to the most recent ones
remi-stripe Jun 6, 2018
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
Prev Previous commit
Next Next commit
Remove the currency package
  • Loading branch information
remi-stripe committed Jun 6, 2018
commit 8e1e87414afec171045ba56d7b80a688eed8560b
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -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"),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is now Description.

}
chargeParams.SetSource("tok_amex") // obtained with Stripe.js
charge, err := sc.Charges.New(chargeParams)
4 changes: 0 additions & 4 deletions charge.go
Original file line number Diff line number Diff line change
@@ -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 {
5 changes: 2 additions & 3 deletions charge/client_test.go
Original file line number Diff line number Diff line change
@@ -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")

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