From 28c24cf3171fdd29d119b2c01e174a9825e69161 Mon Sep 17 00:00:00 2001 From: Brandur Date: Fri, 3 Apr 2020 11:04:04 -0700 Subject: [PATCH 1/8] Make API response accessible on returned API structs (#1054) * Make API response accessible on returned API structs Makes an API response struct containing niceties like the raw response body, status, and request ID accessible via API resource structs returned from client functions. For example: customer, err := customer.New(params) fmt.Printf("request ID = %s\n", customer.LastResponse.RequestID) This is a feature that already exists in other language API libraries and which is requested occasionally here, usually for various situations involving more complex usage or desire for better observability. -- Implementation We introduce a few new types to make this work: * `APIResponse`: Represents a response from the Stripe API and includes things like request ID, status, and headers. I elected to create my own object instead of reusing `http.Response` because it gives us a little more flexibility, and hides many of myriad of fields exposed by the `http` version, which will hopefully give us a little more API stability/forward compatibility. * `APIResource`: A struct that contains `LastResponse` and is meant to represent any type that can we returned from a Stripe API endpoint. A coupon is an `APIResource` and so is a list object. This struct is embedded in response structs where appropriate across the whole API surface area (e.g. `Coupon`, `ListMeta`, etc.). * `LastResponseGetter`: A very basic interface to an object that looks like an `APIResource`. This isn't strictly necessary, but gives us slightly more flexibility around the API and makes backward compatibility a little bit better for non-standard use cases (see the section on that below). `stripe.Do` and other backend calls all start taking objects which are `LastResponseGetter` instead of `interface{}`. This provides us with some type safety around forgetting to include an embedded `APIResource` on structs that should have it by making the compiler balk. As `stripe.Do` finishes running a request, it generates an `APIResponse` object and sets it onto the API resource type it's deserializing and returning (e.g. a `Coupon`). Errors also embed `APIResource` and similarly get access to the same set of fields as response resources, although in their case some of the fields provided in `APIResponse` are duplicates of what they had already (see "Caveats" below). -- Backwards compatibility This is a minor breaking change in that backend implementations methods like `Do` now take `LastResponseGetter` instead of `interface{}`, which is more strict. The good news though is that: * Very few users should be using any of these even if they're technically public. The resource-specific clients packages tend to do all the work. * Users who are broken should have a very easy time updating code. Mostly this will just involve adding `APIResource` to structs that were being passed in. -- Naming * `APIResponse`: Went with this instead of `StripeResponse` as we see in some other libraries because the linter will complain that it "stutters" when used outside of the package (meaning, uses the same word twice in a row), i.e. `stripe.StripeResponse`. `APIResponse` sorts nicely with `APIResource` though, so I think it's okay. * `LastResponse`: Copied the "last" convention from other API libraries like stripe-python. * `LastResponseGetter`: Given an "-er" name per Go convention around small interfaces that are basically one liners -- e.g. `Reader`, `Writer, `Formatter`, `CloseNotifier`, etc. I can see the argument that this maybe should just be `APIResourceInterface` or something like that in case we start adding new things, but I figure at that point we can either rename it, or create a parent interface that encapsulates it: ``` go type APIResourceInterface interface { LastResponseGetter } ``` -- Caveats * We only set the last response for top-level returned objects. For example, an `InvoiceItem` is an API resource, but if it's returned under an `Invoice`, only `Invoice` has a non-nil `LastResponse`. The same applies for all resources under list objects. I figure that doing it this way is more performant and makes a little bit more intuitive sense. Users should be able to work around it if they need to. * There is some duplication between `LastResponse` and some other fields that already existed on `stripe.Error` because the latter was already exposing some of this information, e.g. `RequestID`. I figure this is okay: it's nice that `stripe.Error` is a `LastResponseGetter` for consistency with other API resources. The duplication is a little unfortunate, but not that big of a deal. * Rename `LastResponseGetter` to `LastResponseSetter` and remove a function * Update stripe.go Co-Authored-By: Olivier Bellone * Move `APIResource` onto individual list structs instead of having it in `ListMeta` Co-authored-by: Brandur Co-authored-by: Olivier Bellone --- account.go | 3 ++ accountlink.go | 1 + applepaydomain.go | 2 + balance.go | 1 + balancetransaction.go | 2 + bankaccount.go | 2 + bitcoinreceiver.go | 2 + bitcointransaction.go | 1 + capability.go | 2 + card.go | 3 ++ charge.go | 2 + checkout_session.go | 2 + countryspec.go | 2 + coupon.go | 2 + creditnote.go | 3 ++ customer.go | 2 + customerbalancetransaction.go | 2 + discount.go | 1 + dispute.go | 2 + ephemeralkey.go | 2 + error.go | 2 + event.go | 2 + exchangerate.go | 2 + fee.go | 2 + feerefund.go | 2 + file.go | 2 + filelink.go | 2 + invoice.go | 3 ++ invoiceitem.go | 2 + issuing_authorization.go | 2 + issuing_card.go | 3 ++ issuing_cardholder.go | 3 ++ issuing_dispute.go | 2 + issuing_transaction.go | 2 + loginlink.go | 1 + mandate.go | 1 + oauth.go | 3 ++ order.go | 2 + orderreturn.go | 2 + paymentintent.go | 2 + paymentmethod.go | 2 + paymentsource.go | 2 + payout.go | 2 + person.go | 2 + plan.go | 2 + product.go | 2 + radar_earlyfraudwarning.go | 2 + radar_valuelist.go | 2 + radar_valuelistitem.go | 2 + recipient.go | 2 + refund.go | 2 + reporting_reportrun.go | 2 + reporting_reporttype.go | 2 + reversal.go | 2 + review.go | 2 + setupintent.go | 2 + sigma_scheduledqueryrun.go | 2 + sku.go | 2 + source.go | 1 + sourcetransaction.go | 1 + stripe.go | 72 +++++++++++++++++++++++++++++++---- stripe_test.go | 65 +++++++++++++++++++++++++++++++ sub.go | 2 + subitem.go | 2 + subschedule.go | 2 + taxid.go | 2 + taxrate.go | 2 + terminal_connectiontoken.go | 1 + terminal_location.go | 2 + terminal_reader.go | 2 + threedsecure.go | 1 + token.go | 2 + topup.go | 2 + transfer.go | 2 + usagerecord.go | 1 + usagerecordsummary.go | 1 + webhookendpoint.go | 2 + 77 files changed, 275 insertions(+), 7 deletions(-) diff --git a/account.go b/account.go index a9d95ef095..79d72faabc 100644 --- a/account.go +++ b/account.go @@ -461,6 +461,7 @@ type AccountTOSAcceptance struct { // Account is the resource representing your Stripe account. // For more details see https://stripe.com/docs/api/#account. type Account struct { + APIResource BusinessProfile *AccountBusinessProfile `json:"business_profile"` BusinessType AccountBusinessType `json:"business_type"` Capabilities *AccountCapabilities `json:"capabilities"` @@ -505,6 +506,7 @@ func (a *Account) UnmarshalJSON(data []byte) error { // AccountList is a list of accounts as returned from a list endpoint. type AccountList struct { + APIResource ListMeta Data []*Account `json:"data"` } @@ -512,6 +514,7 @@ type AccountList struct { // ExternalAccountList is a list of external accounts that may be either bank // accounts or cards. type ExternalAccountList struct { + APIResource ListMeta // Values contains any external accounts (bank accounts and/or cards) diff --git a/accountlink.go b/accountlink.go index 38357f1350..80c2b0d0c8 100644 --- a/accountlink.go +++ b/accountlink.go @@ -31,6 +31,7 @@ type AccountLinkParams struct { // AccountLink is the resource representing an account link. // For more details see https://stripe.com/docs/api/#account_links. type AccountLink struct { + APIResource Created int64 `json:"created"` ExpiresAt int64 `json:"expires_at"` Object string `json:"object"` diff --git a/applepaydomain.go b/applepaydomain.go index 3ec6e06d7b..99b9a6c8e6 100644 --- a/applepaydomain.go +++ b/applepaydomain.go @@ -8,6 +8,7 @@ type ApplePayDomainParams struct { // ApplePayDomain is the resource representing a Stripe ApplePayDomain object type ApplePayDomain struct { + APIResource Created int64 `json:"created"` Deleted bool `json:"deleted"` DomainName string `json:"domain_name"` @@ -22,6 +23,7 @@ type ApplePayDomainListParams struct { // ApplePayDomainList is a list of ApplePayDomains as returned from a list endpoint. type ApplePayDomainList struct { + APIResource ListMeta Data []*ApplePayDomain `json:"data"` } diff --git a/balance.go b/balance.go index c4c45cadc1..c24916205b 100644 --- a/balance.go +++ b/balance.go @@ -24,6 +24,7 @@ type BalanceParams struct { // Balance is the resource representing your Stripe balance. // For more details see https://stripe.com/docs/api/#balance. type Balance struct { + APIResource Available []*Amount `json:"available"` ConnectReserved []*Amount `json:"connect_reserved"` Livemode bool `json:"livemode"` diff --git a/balancetransaction.go b/balancetransaction.go index 958e11a76c..6bb28464be 100644 --- a/balancetransaction.go +++ b/balancetransaction.go @@ -126,6 +126,7 @@ type BalanceTransactionListParams struct { // BalanceTransaction is the resource representing the balance transaction. // For more details see https://stripe.com/docs/api/#balance. type BalanceTransaction struct { + APIResource Amount int64 `json:"amount"` AvailableOn int64 `json:"available_on"` Created int64 `json:"created"` @@ -145,6 +146,7 @@ type BalanceTransaction struct { // BalanceTransactionList is a list of transactions as returned from a list endpoint. type BalanceTransactionList struct { + APIResource ListMeta Data []*BalanceTransaction `json:"data"` } diff --git a/bankaccount.go b/bankaccount.go index 08be247a2e..4b20e4d2cf 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -141,6 +141,7 @@ func (p *BankAccountListParams) AppendTo(body *form.Values, keyParts []string) { // BankAccount represents a Stripe bank account. type BankAccount struct { + APIResource Account *Account `json:"account"` AccountHolderName string `json:"account_holder_name"` AccountHolderType BankAccountAccountHolderType `json:"account_holder_type"` @@ -160,6 +161,7 @@ type BankAccount struct { // BankAccountList is a list object for bank accounts. type BankAccountList struct { + APIResource ListMeta Data []*BankAccount `json:"data"` } diff --git a/bitcoinreceiver.go b/bitcoinreceiver.go index 7acf81e47a..30881dfa52 100644 --- a/bitcoinreceiver.go +++ b/bitcoinreceiver.go @@ -16,6 +16,7 @@ type BitcoinReceiverListParams struct { // BitcoinReceiver is the resource representing a Stripe bitcoin receiver. // For more details see https://stripe.com/docs/api/#bitcoin_receivers type BitcoinReceiver struct { + APIResource Active bool `json:"active"` Amount int64 `json:"amount"` AmountReceived int64 `json:"amount_received"` @@ -39,6 +40,7 @@ type BitcoinReceiver struct { // BitcoinReceiverList is a list of bitcoin receivers as retrieved from a list endpoint. type BitcoinReceiverList struct { + APIResource ListMeta Data []*BitcoinReceiver `json:"data"` } diff --git a/bitcointransaction.go b/bitcointransaction.go index af2b8f75f6..3a8fe96c88 100644 --- a/bitcointransaction.go +++ b/bitcointransaction.go @@ -13,6 +13,7 @@ type BitcoinTransactionListParams struct { // It is a child object of BitcoinReceivers // For more details see https://stripe.com/docs/api/#retrieve_bitcoin_receiver type BitcoinTransactionList struct { + APIResource ListMeta Data []*BitcoinTransaction `json:"data"` } diff --git a/capability.go b/capability.go index b79e5d036c..ade1abc094 100644 --- a/capability.go +++ b/capability.go @@ -55,6 +55,7 @@ type CapabilityRequirements struct { // Capability is the resource representing a Stripe capability. // For more details see https://stripe.com/docs/api/capabilities type Capability struct { + APIResource Account *Account `json:"account"` ID string `json:"id"` Object string `json:"object"` @@ -66,6 +67,7 @@ type Capability struct { // CapabilityList is a list of capabilities as retrieved from a list endpoint. type CapabilityList struct { + APIResource ListMeta Data []*Capability `json:"data"` } diff --git a/card.go b/card.go index ac705cff83..b27a1c2d54 100644 --- a/card.go +++ b/card.go @@ -197,6 +197,8 @@ func (p *CardListParams) AppendTo(body *form.Values, keyParts []string) { // Card is the resource representing a Stripe credit/debit card. // For more details see https://stripe.com/docs/api#cards. type Card struct { + APIResource + AddressCity string `json:"address_city"` AddressCountry string `json:"address_country"` AddressLine1 string `json:"address_line1"` @@ -249,6 +251,7 @@ type Card struct { // CardList is a list object for cards. type CardList struct { + APIResource ListMeta Data []*Card `json:"data"` } diff --git a/charge.go b/charge.go index 8ee938ae8b..7ae10d2647 100644 --- a/charge.go +++ b/charge.go @@ -458,6 +458,7 @@ type ChargeTransferData struct { // Charge is the resource representing a Stripe charge. // For more details see https://stripe.com/docs/api#charges. type Charge struct { + APIResource Amount int64 `json:"amount"` AmountRefunded int64 `json:"amount_refunded"` Application *Application `json:"application"` @@ -527,6 +528,7 @@ func (c *Charge) UnmarshalJSON(data []byte) error { // ChargeList is a list of charges as retrieved from a list endpoint. type ChargeList struct { + APIResource ListMeta Data []*Charge `json:"data"` } diff --git a/checkout_session.go b/checkout_session.go index 71511f4cfc..9b6aebf108 100644 --- a/checkout_session.go +++ b/checkout_session.go @@ -163,6 +163,7 @@ type CheckoutSessionShippingAddressCollection struct { // CheckoutSession is the resource representing a Stripe checkout session. // For more details see https://stripe.com/docs/api/checkout/sessions/object type CheckoutSession struct { + APIResource CancelURL string `json:"cancel_url"` ClientReferenceID string `json:"client_reference_id"` Customer *Customer `json:"customer"` @@ -187,6 +188,7 @@ type CheckoutSession struct { // CheckoutSessionList is a list of sessions as retrieved from a list endpoint. type CheckoutSessionList struct { + APIResource ListMeta Data []*CheckoutSession `json:"data"` } diff --git a/countryspec.go b/countryspec.go index 894beb189e..eba7d601a7 100644 --- a/countryspec.go +++ b/countryspec.go @@ -13,6 +13,7 @@ type VerificationFieldsList struct { // CountrySpec is the resource representing the rules required for a Stripe account. // For more details see https://stripe.com/docs/api/#country_specs. type CountrySpec struct { + APIResource DefaultCurrency Currency `json:"default_currency"` ID string `json:"id"` SupportedBankAccountCurrencies map[Currency][]Country `json:"supported_bank_account_currencies"` @@ -29,6 +30,7 @@ type CountrySpecParams struct { // CountrySpecList is a list of country specs as retrieved from a list endpoint. type CountrySpecList struct { + APIResource ListMeta Data []*CountrySpec `json:"data"` } diff --git a/coupon.go b/coupon.go index d6aaf6fb0b..570166d546 100644 --- a/coupon.go +++ b/coupon.go @@ -38,6 +38,7 @@ type CouponListParams struct { // Coupon is the resource representing a Stripe coupon. // For more details see https://stripe.com/docs/api#coupons. type Coupon struct { + APIResource AmountOff int64 `json:"amount_off"` Created int64 `json:"created"` Currency Currency `json:"currency"` @@ -57,6 +58,7 @@ type Coupon struct { // CouponList is a list of coupons as retrieved from a list endpoint. type CouponList struct { + APIResource ListMeta Data []*Coupon `json:"data"` } diff --git a/creditnote.go b/creditnote.go index 0f3bbcf293..97fb543b20 100644 --- a/creditnote.go +++ b/creditnote.go @@ -128,6 +128,7 @@ type CreditNoteTaxAmount struct { // CreditNote is the resource representing a Stripe credit note. // For more details see https://stripe.com/docs/api/credit_notes/object. type CreditNote struct { + APIResource Amount int64 `json:"amount"` Created int64 `json:"created"` Currency Currency `json:"currency"` @@ -174,12 +175,14 @@ type CreditNoteLineItem struct { // CreditNoteList is a list of credit notes as retrieved from a list endpoint. type CreditNoteList struct { + APIResource ListMeta Data []*CreditNote `json:"data"` } // CreditNoteLineItemList is a list of credit note line items as retrieved from a list endpoint. type CreditNoteLineItemList struct { + APIResource ListMeta Data []*CreditNoteLineItem `json:"data"` } diff --git a/customer.go b/customer.go index 7c1888bbbf..ef351f7942 100644 --- a/customer.go +++ b/customer.go @@ -92,6 +92,7 @@ type CustomerListParams struct { // Customer is the resource representing a Stripe customer. // For more details see https://stripe.com/docs/api#customers. type Customer struct { + APIResource Address Address `json:"address"` Balance int64 `json:"balance"` Created int64 `json:"created"` @@ -134,6 +135,7 @@ type CustomerInvoiceSettings struct { // CustomerList is a list of customers as retrieved from a list endpoint. type CustomerList struct { + APIResource ListMeta Data []*Customer `json:"data"` } diff --git a/customerbalancetransaction.go b/customerbalancetransaction.go index 764778cd98..f077db20f8 100644 --- a/customerbalancetransaction.go +++ b/customerbalancetransaction.go @@ -39,6 +39,7 @@ type CustomerBalanceTransactionListParams struct { // CustomerBalanceTransaction is the resource representing a customer balance transaction. // For more details see https://stripe.com/docs/api/customers/customer_balance_transaction_object type CustomerBalanceTransaction struct { + APIResource Amount int64 `json:"amount"` Created int64 `json:"created"` CreditNote *CreditNote `json:"credit_note"` @@ -57,6 +58,7 @@ type CustomerBalanceTransaction struct { // CustomerBalanceTransactionList is a list of customer balance transactions as retrieved from a // list endpoint. type CustomerBalanceTransactionList struct { + APIResource ListMeta Data []*CustomerBalanceTransaction `json:"data"` } diff --git a/discount.go b/discount.go index d86a4e60ec..30d21aaa26 100644 --- a/discount.go +++ b/discount.go @@ -8,6 +8,7 @@ type DiscountParams struct { // Discount is the resource representing a Stripe discount. // For more details see https://stripe.com/docs/api#discounts. type Discount struct { + APIResource Coupon *Coupon `json:"coupon"` Customer string `json:"customer"` Deleted bool `json:"deleted"` diff --git a/dispute.go b/dispute.go index 3c074efedd..f6483f7943 100644 --- a/dispute.go +++ b/dispute.go @@ -87,6 +87,7 @@ type DisputeListParams struct { // Dispute is the resource representing a Stripe dispute. // For more details see https://stripe.com/docs/api#disputes. type Dispute struct { + APIResource Amount int64 `json:"amount"` BalanceTransactions []*BalanceTransaction `json:"balance_transactions"` Charge *Charge `json:"charge"` @@ -105,6 +106,7 @@ type Dispute struct { // DisputeList is a list of disputes as retrieved from a list endpoint. type DisputeList struct { + APIResource ListMeta Data []*Dispute `json:"data"` } diff --git a/ephemeralkey.go b/ephemeralkey.go index c5139772c8..9fc649e81b 100644 --- a/ephemeralkey.go +++ b/ephemeralkey.go @@ -14,6 +14,8 @@ type EphemeralKeyParams struct { // EphemeralKey is the resource representing a Stripe ephemeral key. This is used by Mobile SDKs // to for example manage a Customer's payment methods. type EphemeralKey struct { + APIResource + AssociatedObjects []struct { ID string `json:"id"` Type string `json:"type"` diff --git a/error.go b/error.go index 94d0f48d15..00849b5706 100644 --- a/error.go +++ b/error.go @@ -171,6 +171,8 @@ const ( // Error is the response returned when a call is unsuccessful. // For more details see https://stripe.com/docs/api#errors. type Error struct { + APIResource + ChargeID string `json:"charge,omitempty"` Code ErrorCode `json:"code,omitempty"` DeclineCode DeclineCode `json:"decline_code,omitempty"` diff --git a/event.go b/event.go index 973e6c2086..420ba06104 100644 --- a/event.go +++ b/event.go @@ -9,6 +9,7 @@ import ( // Event is the resource representing a Stripe event. // For more details see https://stripe.com/docs/api#events. type Event struct { + APIResource Account string `json:"account"` Created int64 `json:"created"` Data *EventData `json:"data"` @@ -49,6 +50,7 @@ type EventParams struct { // EventList is a list of events as retrieved from a list endpoint. type EventList struct { + APIResource ListMeta Data []*Event `json:"data"` } diff --git a/exchangerate.go b/exchangerate.go index f21f66ce5a..251cfc5023 100644 --- a/exchangerate.go +++ b/exchangerate.go @@ -3,6 +3,7 @@ package stripe // ExchangeRate is the resource representing the currency exchange rates at // a given time. type ExchangeRate struct { + APIResource ID string `json:"id"` Rates map[Currency]float64 `json:"rates"` } @@ -15,6 +16,7 @@ type ExchangeRateParams struct { // ExchangeRateList is a list of exchange rates as retrieved from a list endpoint. type ExchangeRateList struct { + APIResource ListMeta Data []*ExchangeRate `json:"data"` } diff --git a/fee.go b/fee.go index bc986f7705..18310094b1 100644 --- a/fee.go +++ b/fee.go @@ -20,6 +20,7 @@ type ApplicationFeeListParams struct { // ApplicationFee is the resource representing a Stripe application fee. // For more details see https://stripe.com/docs/api#application_fees. type ApplicationFee struct { + APIResource Account *Account `json:"account"` Amount int64 `json:"amount"` AmountRefunded int64 `json:"amount_refunded"` @@ -37,6 +38,7 @@ type ApplicationFee struct { //ApplicationFeeList is a list of application fees as retrieved from a list endpoint. type ApplicationFeeList struct { + APIResource ListMeta Data []*ApplicationFee `json:"data"` } diff --git a/feerefund.go b/feerefund.go index 9d1ffa546b..c6719f0707 100644 --- a/feerefund.go +++ b/feerefund.go @@ -22,6 +22,7 @@ type FeeRefundListParams struct { // FeeRefund is the resource representing a Stripe application fee refund. // For more details see https://stripe.com/docs/api#fee_refunds. type FeeRefund struct { + APIResource Amount int64 `json:"amount"` BalanceTransaction *BalanceTransaction `json:"balance_transaction"` Created int64 `json:"created"` @@ -33,6 +34,7 @@ type FeeRefund struct { // FeeRefundList is a list object for application fee refunds. type FeeRefundList struct { + APIResource ListMeta Data []*FeeRefund `json:"data"` } diff --git a/file.go b/file.go index 00a3cdc1d1..ef04dc0247 100644 --- a/file.go +++ b/file.go @@ -65,6 +65,7 @@ type FileListParams struct { // File is the resource representing a Stripe file. // For more details see https://stripe.com/docs/api#file_object. type File struct { + APIResource Created int64 `json:"created"` ID string `json:"id"` Filename string `json:"filename"` @@ -77,6 +78,7 @@ type File struct { // FileList is a list of files as retrieved from a list endpoint. type FileList struct { + APIResource ListMeta Data []*File `json:"data"` } diff --git a/filelink.go b/filelink.go index 19615ff36a..9e77cba7a7 100644 --- a/filelink.go +++ b/filelink.go @@ -23,6 +23,7 @@ type FileLinkListParams struct { // FileLink is the resource representing a Stripe file link. // For more details see https://stripe.com/docs/api#file_links. type FileLink struct { + APIResource Created int64 `json:"created"` Expired bool `json:"expired"` ExpiresAt int64 `json:"expires_at"` @@ -55,6 +56,7 @@ func (c *FileLink) UnmarshalJSON(data []byte) error { // FileLinkList is a list of file links as retrieved from a list endpoint. type FileLinkList struct { + APIResource ListMeta Data []*FileLink `json:"data"` } diff --git a/invoice.go b/invoice.go index d976857bef..ea67e8bbb5 100644 --- a/invoice.go +++ b/invoice.go @@ -209,6 +209,7 @@ type InvoiceVoidParams struct { // Invoice is the resource representing a Stripe invoice. // For more details see https://stripe.com/docs/api#invoice_object. type Invoice struct { + APIResource AccountCountry string `json:"account_country"` AccountName string `json:"account_name"` AmountDue int64 `json:"amount_due"` @@ -307,6 +308,7 @@ type InvoiceThresholdReasonItemReason struct { // InvoiceList is a list of invoices as retrieved from a list endpoint. type InvoiceList struct { + APIResource ListMeta Data []*Invoice `json:"data"` } @@ -347,6 +349,7 @@ type Period struct { // InvoiceLineList is a list object for invoice line items. type InvoiceLineList struct { + APIResource ListMeta Data []*InvoiceLine `json:"data"` } diff --git a/invoiceitem.go b/invoiceitem.go index a9987758c9..6010e6d834 100644 --- a/invoiceitem.go +++ b/invoiceitem.go @@ -40,6 +40,7 @@ type InvoiceItemListParams struct { // InvoiceItem is the resource represneting a Stripe invoice item. // For more details see https://stripe.com/docs/api#invoiceitems. type InvoiceItem struct { + APIResource Amount int64 `json:"amount"` Currency Currency `json:"currency"` Customer *Customer `json:"customer"` @@ -63,6 +64,7 @@ type InvoiceItem struct { // InvoiceItemList is a list of invoice items as retrieved from a list endpoint. type InvoiceItemList struct { + APIResource ListMeta Data []*InvoiceItem `json:"data"` } diff --git a/issuing_authorization.go b/issuing_authorization.go index 876b5e4445..c419a1c79b 100644 --- a/issuing_authorization.go +++ b/issuing_authorization.go @@ -223,6 +223,7 @@ type IssuingAuthorizationVerificationData struct { // IssuingAuthorization is the resource representing a Stripe issuing authorization. type IssuingAuthorization struct { + APIResource Amount int64 `json:"amount"` Approved bool `json:"approved"` AuthorizationMethod IssuingAuthorizationAuthorizationMethod `json:"authorization_method"` @@ -274,6 +275,7 @@ type IssuingMerchantData struct { // IssuingAuthorizationList is a list of issuing authorizations as retrieved from a list endpoint. type IssuingAuthorizationList struct { + APIResource ListMeta Data []*IssuingAuthorization `json:"data"` } diff --git a/issuing_card.go b/issuing_card.go index cbbfe0e96c..b82cd1e530 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -229,6 +229,7 @@ type IssuingCardListParams struct { // IssuingCardDetails is the resource representing issuing card details. type IssuingCardDetails struct { + APIResource Card *IssuingCard `json:"card"` CVC string `json:"cvc"` ExpMonth *string `form:"exp_month"` @@ -303,6 +304,7 @@ type IssuingCardSpendingControls struct { // IssuingCard is the resource representing a Stripe issuing card. type IssuingCard struct { + APIResource Billing *IssuingBilling `json:"billing"` Brand string `json:"brand"` CancellationReason IssuingCardCancellationReason `json:"cancellation_reason"` @@ -333,6 +335,7 @@ type IssuingCard struct { // IssuingCardList is a list of issuing cards as retrieved from a list endpoint. type IssuingCardList struct { + APIResource ListMeta Data []*IssuingCard `json:"data"` } diff --git a/issuing_cardholder.go b/issuing_cardholder.go index 22d2af34f2..5b9ee6b21e 100644 --- a/issuing_cardholder.go +++ b/issuing_cardholder.go @@ -214,6 +214,8 @@ type IssuingCardholderSpendingControls struct { // IssuingCardholder is the resource representing a Stripe issuing cardholder. type IssuingCardholder struct { + APIResource + Billing *IssuingBilling `json:"billing"` Company *IssuingCardholderCompany `json:"company"` Created int64 `json:"created"` @@ -236,6 +238,7 @@ type IssuingCardholder struct { // IssuingCardholderList is a list of issuing cardholders as retrieved from a list endpoint. type IssuingCardholderList struct { + APIResource ListMeta Data []*IssuingCardholder `json:"data"` } diff --git a/issuing_dispute.go b/issuing_dispute.go index 47df5bb710..f909ffc129 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -84,6 +84,7 @@ type IssuingDisputeEvidence struct { // IssuingDispute is the resource representing an issuing dispute. type IssuingDispute struct { + APIResource Amount int64 `json:"amount"` Created int64 `json:"created"` Currency Currency `json:"currency"` @@ -99,6 +100,7 @@ type IssuingDispute struct { // IssuingDisputeList is a list of issuing disputes as retrieved from a list endpoint. type IssuingDisputeList struct { + APIResource ListMeta Data []*IssuingDispute `json:"data"` } diff --git a/issuing_transaction.go b/issuing_transaction.go index 817f6058b8..f8e569d9f0 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -30,6 +30,7 @@ type IssuingTransactionListParams struct { // IssuingTransaction is the resource representing a Stripe issuing transaction. type IssuingTransaction struct { + APIResource Amount int64 `json:"amount"` Authorization *IssuingAuthorization `json:"authorization"` BalanceTransaction *BalanceTransaction `json:"balance_transaction"` @@ -50,6 +51,7 @@ type IssuingTransaction struct { // IssuingTransactionList is a list of issuing transactions as retrieved from a list endpoint. type IssuingTransactionList struct { + APIResource ListMeta Data []*IssuingTransaction `json:"data"` } diff --git a/loginlink.go b/loginlink.go index b89ef32566..04d5307d27 100644 --- a/loginlink.go +++ b/loginlink.go @@ -11,6 +11,7 @@ type LoginLinkParams struct { // LoginLink is the resource representing a login link for Express accounts. // For more details see https://stripe.com/docs/api#login_link_object type LoginLink struct { + APIResource Created int64 `json:"created"` URL string `json:"url"` } diff --git a/mandate.go b/mandate.go index 2caec934d2..483434ea4c 100644 --- a/mandate.go +++ b/mandate.go @@ -94,6 +94,7 @@ type MandateSingleUse struct { // Mandate is the resource representing a Mandate. type Mandate struct { + APIResource CustomerAcceptance *MandateCustomerAcceptance `json:"customer_acceptance"` ID string `json:"id"` Livemode bool `json:"livemode"` diff --git a/oauth.go b/oauth.go index a8996897c4..32f11f1863 100644 --- a/oauth.go +++ b/oauth.go @@ -111,6 +111,8 @@ type OAuthTokenParams struct { // OAuthToken is the value of the OAuthToken from OAuth flow. // https://stripe.com/docs/connect/oauth-reference#post-token type OAuthToken struct { + APIResource + Livemode bool `json:"livemode"` Scope OAuthScopeType `json:"scope"` StripeUserID string `json:"stripe_user_id"` @@ -125,5 +127,6 @@ type OAuthToken struct { // Deauthorize is the value of the return from deauthorizing. // https://stripe.com/docs/connect/oauth-reference#post-deauthorize type Deauthorize struct { + APIResource StripeUserID string `json:"stripe_user_id"` } diff --git a/order.go b/order.go index 9e911de95f..6ee002cf72 100644 --- a/order.go +++ b/order.go @@ -123,6 +123,7 @@ type DeliveryEstimate struct { // Order is the resource representing a Stripe charge. // For more details see https://stripe.com/docs/api#orders. type Order struct { + APIResource Amount int64 `json:"amount"` AmountReturned int64 `json:"amount_returned"` Application string `json:"application"` @@ -148,6 +149,7 @@ type Order struct { // OrderList is a list of orders as retrieved from a list endpoint. type OrderList struct { + APIResource ListMeta Data []*Order `json:"data"` } diff --git a/orderreturn.go b/orderreturn.go index ee35cd98b9..a482629764 100644 --- a/orderreturn.go +++ b/orderreturn.go @@ -12,6 +12,7 @@ type OrderReturnParams struct { // OrderReturn is the resource representing an order return. // For more details see https://stripe.com/docs/api#order_returns. type OrderReturn struct { + APIResource Amount int64 `json:"amount"` Created int64 `json:"created"` Currency Currency `json:"currency"` @@ -24,6 +25,7 @@ type OrderReturn struct { // OrderReturnList is a list of order returns as retrieved from a list endpoint. type OrderReturnList struct { + APIResource ListMeta Data []*OrderReturn `json:"data"` } diff --git a/paymentintent.go b/paymentintent.go index 89c1c8b937..9d21a6fcd0 100644 --- a/paymentintent.go +++ b/paymentintent.go @@ -292,6 +292,7 @@ type PaymentIntentTransferData struct { // PaymentIntent is the resource representing a Stripe payout. // For more details see https://stripe.com/docs/api#payment_intents. type PaymentIntent struct { + APIResource Amount int64 `json:"amount"` AmountCapturable int64 `json:"amount_capturable"` AmountReceived int64 `json:"amount_received"` @@ -331,6 +332,7 @@ type PaymentIntent struct { // PaymentIntentList is a list of payment intents as retrieved from a list endpoint. type PaymentIntentList struct { + APIResource ListMeta Data []*PaymentIntent `json:"data"` } diff --git a/paymentmethod.go b/paymentmethod.go index 99c52c3e6f..561f7cdade 100644 --- a/paymentmethod.go +++ b/paymentmethod.go @@ -234,6 +234,7 @@ type PaymentMethodSepaDebit struct { // PaymentMethod is the resource representing a PaymentMethod. type PaymentMethod struct { + APIResource AUBECSDebit *PaymentMethodAUBECSDebit `json:"au_becs_debit"` BillingDetails *BillingDetails `json:"billing_details"` Card *PaymentMethodCard `json:"card"` @@ -252,6 +253,7 @@ type PaymentMethod struct { // PaymentMethodList is a list of PaymentMethods as retrieved from a list endpoint. type PaymentMethodList struct { + APIResource ListMeta Data []*PaymentMethod `json:"data"` } diff --git a/paymentsource.go b/paymentsource.go index 4f592948b1..4e00ce6046 100644 --- a/paymentsource.go +++ b/paymentsource.go @@ -87,6 +87,7 @@ func SourceParamsFor(obj interface{}) (*SourceParams, error) { // The Type should indicate which object is fleshed out (eg. BitcoinReceiver or Card) // For more details see https://stripe.com/docs/api#retrieve_charge type PaymentSource struct { + APIResource BankAccount *BankAccount `json:"-"` BitcoinReceiver *BitcoinReceiver `json:"-"` Card *Card `json:"-"` @@ -98,6 +99,7 @@ type PaymentSource struct { // SourceList is a list object for cards. type SourceList struct { + APIResource ListMeta Data []*PaymentSource `json:"data"` } diff --git a/payout.go b/payout.go index aae9502906..1a11ba531c 100644 --- a/payout.go +++ b/payout.go @@ -108,6 +108,7 @@ type PayoutListParams struct { // Payout is the resource representing a Stripe payout. // For more details see https://stripe.com/docs/api#payouts. type Payout struct { + APIResource Amount int64 `json:"amount"` ArrivalDate int64 `json:"arrival_date"` Automatic bool `json:"automatic"` @@ -133,6 +134,7 @@ type Payout struct { // PayoutList is a list of payouts as retrieved from a list endpoint. type PayoutList struct { + APIResource ListMeta Data []*Payout `json:"data"` } diff --git a/person.go b/person.go index f43993923e..8f41520d0d 100644 --- a/person.go +++ b/person.go @@ -164,6 +164,7 @@ type PersonVerification struct { // Person is the resource representing a Stripe person. // For more details see https://stripe.com/docs/api#persons. type Person struct { + APIResource Account string `json:"account"` Address *AccountAddress `json:"address"` AddressKana *AccountAddress `json:"address_kana"` @@ -192,6 +193,7 @@ type Person struct { // PersonList is a list of persons as retrieved from a list endpoint. type PersonList struct { + APIResource ListMeta Data []*Person `json:"data"` } diff --git a/plan.go b/plan.go index ffbf90b860..d8aae7fb0d 100644 --- a/plan.go +++ b/plan.go @@ -68,6 +68,7 @@ const ( // Plan is the resource representing a Stripe plan. // For more details see https://stripe.com/docs/api#plans. type Plan struct { + APIResource Active bool `json:"active"` AggregateUsage string `json:"aggregate_usage"` Amount int64 `json:"amount"` @@ -92,6 +93,7 @@ type Plan struct { // PlanList is a list of plans as returned from a list endpoint. type PlanList struct { + APIResource ListMeta Data []*Plan `json:"data"` } diff --git a/product.go b/product.go index de6785a933..1fbb8924de 100644 --- a/product.go +++ b/product.go @@ -51,6 +51,7 @@ type PackageDimensions struct { // Product is the resource representing a Stripe product. // For more details see https://stripe.com/docs/api#products. type Product struct { + APIResource Active bool `json:"active"` Attributes []string `json:"attributes"` Caption string `json:"caption"` @@ -73,6 +74,7 @@ type Product struct { // ProductList is a list of products as retrieved from a list endpoint. type ProductList struct { + APIResource ListMeta Data []*Product `json:"data"` } diff --git a/radar_earlyfraudwarning.go b/radar_earlyfraudwarning.go index f2350d9e17..3c204f638c 100644 --- a/radar_earlyfraudwarning.go +++ b/radar_earlyfraudwarning.go @@ -32,6 +32,7 @@ type RadarEarlyFraudWarningListParams struct { // RadarEarlyFraudWarningList is a list of early fraud warnings as retrieved from a // list endpoint. type RadarEarlyFraudWarningList struct { + APIResource ListMeta Values []*RadarEarlyFraudWarning `json:"data"` } @@ -39,6 +40,7 @@ type RadarEarlyFraudWarningList struct { // RadarEarlyFraudWarning is the resource representing an early fraud warning. For // more details see https://stripe.com/docs/api/early_fraud_warnings/object. type RadarEarlyFraudWarning struct { + APIResource Actionable bool `json:"actionable"` Charge *Charge `json:"charge"` Created int64 `json:"created"` diff --git a/radar_valuelist.go b/radar_valuelist.go index a8a39e8ff8..996f2f742c 100644 --- a/radar_valuelist.go +++ b/radar_valuelist.go @@ -33,6 +33,7 @@ type RadarValueListListParams struct { // RadarValueList is the resource representing a value list. type RadarValueList struct { + APIResource Alias string `json:"alias"` Created int64 `json:"created"` CreatedBy string `json:"created_by"` @@ -50,6 +51,7 @@ type RadarValueList struct { // RadarValueListList is a list of value lists as retrieved from a list endpoint. type RadarValueListList struct { + APIResource ListMeta Data []*RadarValueList `json:"data"` } diff --git a/radar_valuelistitem.go b/radar_valuelistitem.go index 98dfcbcb39..eefc413e74 100644 --- a/radar_valuelistitem.go +++ b/radar_valuelistitem.go @@ -18,6 +18,7 @@ type RadarValueListItemListParams struct { // RadarValueListItem is the resource representing a value list item. type RadarValueListItem struct { + APIResource Created int64 `json:"created"` CreatedBy string `json:"created_by"` Deleted bool `json:"deleted"` @@ -31,6 +32,7 @@ type RadarValueListItem struct { // RadarValueListItemList is a list of value list items as retrieved from a list endpoint. type RadarValueListItemList struct { + APIResource ListMeta Data []*RadarValueListItem `json:"data"` } diff --git a/recipient.go b/recipient.go index 7b1676a194..fa9df140de 100644 --- a/recipient.go +++ b/recipient.go @@ -54,6 +54,7 @@ type RecipientListParams struct { // Recipient is the resource representing a Stripe recipient. // For more details see https://stripe.com/docs/api#recipients. type Recipient struct { + APIResource ActiveAccount *BankAccount `json:"active_account"` Cards *CardList `json:"cards"` Created int64 `json:"created"` @@ -71,6 +72,7 @@ type Recipient struct { // RecipientList is a list of recipients as retrieved from a list endpoint. type RecipientList struct { + APIResource ListMeta Data []*Recipient `json:"data"` } diff --git a/refund.go b/refund.go index 662c257d92..735e40376f 100644 --- a/refund.go +++ b/refund.go @@ -59,6 +59,7 @@ type RefundListParams struct { // Refund is the resource representing a Stripe refund. // For more details see https://stripe.com/docs/api#refunds. type Refund struct { + APIResource Amount int64 `json:"amount"` BalanceTransaction *BalanceTransaction `json:"balance_transaction"` Charge *Charge `json:"charge"` @@ -79,6 +80,7 @@ type Refund struct { // RefundList is a list object for refunds. type RefundList struct { + APIResource ListMeta Data []*Refund `json:"data"` } diff --git a/reporting_reportrun.go b/reporting_reportrun.go index d43c6575d0..289350268e 100644 --- a/reporting_reportrun.go +++ b/reporting_reportrun.go @@ -50,6 +50,7 @@ type ReportRunParameters struct { // ReportRun is the resource representing a report run. type ReportRun struct { + APIResource Created int64 `json:"created"` Error string `json:"error"` ID string `json:"id"` @@ -64,6 +65,7 @@ type ReportRun struct { // ReportRunList is a list of report runs as retrieved from a list endpoint. type ReportRunList struct { + APIResource ListMeta Data []*ReportRun `json:"data"` } diff --git a/reporting_reporttype.go b/reporting_reporttype.go index 19bf5a864c..2b605ff235 100644 --- a/reporting_reporttype.go +++ b/reporting_reporttype.go @@ -12,6 +12,7 @@ type ReportTypeParams struct { // ReportType is the resource representing a report type. type ReportType struct { + APIResource DefaultColumns []string `json:"default_columns"` Created int64 `json:"created"` DataAvailableEnd int64 `json:"data_available_end"` @@ -25,6 +26,7 @@ type ReportType struct { // ReportTypeList is a list of report types as retrieved from a list endpoint. type ReportTypeList struct { + APIResource ListMeta Data []*ReportType `json:"data"` } diff --git a/reversal.go b/reversal.go index d017016021..aa19d00793 100644 --- a/reversal.go +++ b/reversal.go @@ -19,6 +19,7 @@ type ReversalListParams struct { // Reversal represents a transfer reversal. type Reversal struct { + APIResource Amount int64 `json:"amount"` BalanceTransaction *BalanceTransaction `json:"balance_transaction"` Created int64 `json:"created"` @@ -33,6 +34,7 @@ type Reversal struct { // ReversalList is a list of object for reversals. type ReversalList struct { + APIResource ListMeta Data []*Reversal `json:"data"` } diff --git a/review.go b/review.go index 92c41c5d87..36046f5ac5 100644 --- a/review.go +++ b/review.go @@ -72,6 +72,7 @@ type ReviewSession struct { // Review is the resource representing a Radar review. // For more details see https://stripe.com/docs/api#reviews. type Review struct { + APIResource BillingZip string `json:"billing_zip"` Charge *Charge `json:"charge"` ClosedReason ReviewClosedReason `json:"closed_reason"` @@ -90,6 +91,7 @@ type Review struct { // ReviewList is a list of reviews as retrieved from a list endpoint. type ReviewList struct { + APIResource ListMeta Data []*Review `json:"data"` } diff --git a/setupintent.go b/setupintent.go index ce91669bd9..ad6935e428 100644 --- a/setupintent.go +++ b/setupintent.go @@ -170,6 +170,7 @@ type SetupIntentPaymentMethodOptions struct { // SetupIntent is the resource representing a Stripe payout. // For more details see https://stripe.com/docs/api#payment_intents. type SetupIntent struct { + APIResource Application *Application `json:"application"` CancellationReason SetupIntentCancellationReason `json:"cancellation_reason"` ClientSecret string `json:"client_secret"` @@ -194,6 +195,7 @@ type SetupIntent struct { // SetupIntentList is a list of setup intents as retrieved from a list endpoint. type SetupIntentList struct { + APIResource ListMeta Data []*SetupIntent `json:"data"` } diff --git a/sigma_scheduledqueryrun.go b/sigma_scheduledqueryrun.go index 9f9690cee9..3ab9e771ea 100644 --- a/sigma_scheduledqueryrun.go +++ b/sigma_scheduledqueryrun.go @@ -25,6 +25,7 @@ type SigmaScheduledQueryRunListParams struct { // SigmaScheduledQueryRun is the resource representing a scheduled query run. type SigmaScheduledQueryRun struct { + APIResource Created int64 `json:"created"` DataLoadTime int64 `json:"data_load_time"` Error string `json:"error"` @@ -40,6 +41,7 @@ type SigmaScheduledQueryRun struct { // SigmaScheduledQueryRunList is a list of scheduled query runs as retrieved from a list endpoint. type SigmaScheduledQueryRunList struct { + APIResource ListMeta Data []*SigmaScheduledQueryRun `json:"data"` } diff --git a/sku.go b/sku.go index 3d976d4e1b..822ea7fff7 100644 --- a/sku.go +++ b/sku.go @@ -54,6 +54,7 @@ type Inventory struct { // SKU is the resource representing a SKU. // For more details see https://stripe.com/docs/api#skus. type SKU struct { + APIResource Active bool `json:"active"` Attributes map[string]string `json:"attributes"` Created int64 `json:"created"` @@ -72,6 +73,7 @@ type SKU struct { // SKUList is a list of SKUs as returned from a list endpoint. type SKUList struct { + APIResource ListMeta Data []*SKU `json:"data"` } diff --git a/source.go b/source.go index 11f8ea13a9..fd797caa21 100644 --- a/source.go +++ b/source.go @@ -292,6 +292,7 @@ type SourceSourceOrder struct { // Source is the resource representing a Source. // For more details see https://stripe.com/docs/api#sources. type Source struct { + APIResource Amount int64 `json:"amount"` ClientSecret string `json:"client_secret"` CodeVerification *CodeVerificationFlow `json:"code_verification,omitempty"` diff --git a/sourcetransaction.go b/sourcetransaction.go index ea87590d01..380f72f4c8 100644 --- a/sourcetransaction.go +++ b/sourcetransaction.go @@ -10,6 +10,7 @@ type SourceTransactionListParams struct { // SourceTransactionList is a list object for SourceTransactions. type SourceTransactionList struct { + APIResource ListMeta Data []*SourceTransaction `json:"data"` } diff --git a/stripe.go b/stripe.go index 029b4b32fd..924260918d 100644 --- a/stripe.go +++ b/stripe.go @@ -74,6 +74,54 @@ var Key string // Public types // +// APIResponse encapsulates some common features of a response from the +// Stripe API. +type APIResponse struct { + // Header contain a map of all HTTP header keys to values. Its behavior and + // caveats are identical to that of http.Header. + Header http.Header + + // IdempotencyKey contains the idempotency key used with this request. + // Idempotency keys are a Stripe-specific concept that helps guarantee that + // requests that fail and need to be retried are not duplicated. + IdempotencyKey string + + // RawJSON contains the response body as raw bytes. + RawJSON []byte + + // RequestID contains a string that uniquely identifies the Stripe request. + // Used for debugging or support purposes. + RequestID string + + // Status is a status code and message. e.g. "200 OK" + Status string + + // StatusCode is a status code as integer. e.g. 200 + StatusCode int +} + +func newAPIResponse(res *http.Response, resBody []byte) *APIResponse { + return &APIResponse{ + Header: res.Header, + IdempotencyKey: res.Header.Get("Idempotency-Key"), + RawJSON: resBody, + RequestID: res.Header.Get("Request-Id"), + Status: res.Status, + StatusCode: res.StatusCode, + } +} + +// APIResource is a type assigned to structs that may come from Stripe API +// endpoints and contains facilities common to all of them. +type APIResource struct { + LastResponse *APIResponse `json:"-"` +} + +// SetLastResponse sets the HTTP response that returned the API resource. +func (r *APIResource) SetLastResponse(response *APIResponse) { + r.LastResponse = response +} + // AppInfo contains information about the "app" which this integration belongs // to. This should be reserved for plugins that wish to identify themselves // with Stripe. @@ -101,9 +149,9 @@ func (a *AppInfo) formatUserAgent() string { // Backend is an interface for making calls against a Stripe service. // This interface exists to enable mocking for during testing if needed. type Backend interface { - Call(method, path, key string, params ParamsContainer, v interface{}) error - CallRaw(method, path, key string, body *form.Values, params *Params, v interface{}) error - CallMultipart(method, path, key, boundary string, body *bytes.Buffer, params *Params, v interface{}) error + Call(method, path, key string, params ParamsContainer, v LastResponseSetter) error + CallRaw(method, path, key string, body *form.Values, params *Params, v LastResponseSetter) error + CallMultipart(method, path, key, boundary string, body *bytes.Buffer, params *Params, v LastResponseSetter) error SetMaxNetworkRetries(maxNetworkRetries int) } @@ -187,7 +235,7 @@ type BackendImplementation struct { } // Call is the Backend.Call implementation for invoking Stripe APIs. -func (s *BackendImplementation) Call(method, path, key string, params ParamsContainer, v interface{}) error { +func (s *BackendImplementation) Call(method, path, key string, params ParamsContainer, v LastResponseSetter) error { var body *form.Values var commonParams *Params @@ -213,7 +261,7 @@ func (s *BackendImplementation) Call(method, path, key string, params ParamsCont } // CallMultipart is the Backend.CallMultipart implementation for invoking Stripe APIs. -func (s *BackendImplementation) CallMultipart(method, path, key, boundary string, body *bytes.Buffer, params *Params, v interface{}) error { +func (s *BackendImplementation) CallMultipart(method, path, key, boundary string, body *bytes.Buffer, params *Params, v LastResponseSetter) error { contentType := "multipart/form-data; boundary=" + boundary req, err := s.NewRequest(method, path, key, contentType, params) @@ -229,7 +277,7 @@ func (s *BackendImplementation) CallMultipart(method, path, key, boundary string } // CallRaw is the implementation for invoking Stripe APIs internally without a backend. -func (s *BackendImplementation) CallRaw(method, path, key string, form *form.Values, params *Params, v interface{}) error { +func (s *BackendImplementation) CallRaw(method, path, key string, form *form.Values, params *Params, v LastResponseSetter) error { var body string if form != nil && !form.Empty() { body = form.Encode() @@ -312,7 +360,7 @@ func (s *BackendImplementation) NewRequest(method, path, key, contentType string // Do is used by Call to execute an API request and parse the response. It uses // the backend's HTTP client to execute the request and unmarshals the response // into v. It also handles unmarshaling errors returned by the API. -func (s *BackendImplementation) Do(req *http.Request, body *bytes.Buffer, v interface{}) error { +func (s *BackendImplementation) Do(req *http.Request, body *bytes.Buffer, v LastResponseSetter) error { s.LeveledLogger.Infof("Requesting %v %v%v\n", req.Method, req.URL.Host, req.URL.Path) if s.enableTelemetry { @@ -458,6 +506,8 @@ func (s *BackendImplementation) Do(req *http.Request, body *bytes.Buffer, v inte s.LeveledLogger.Debugf("Response: %s\n", string(resBody)) + v.SetLastResponse(newAPIResponse(res, resBody)) + if v != nil { return s.UnmarshalJSONVerbose(res.StatusCode, resBody, v) } @@ -513,6 +563,8 @@ func (s *BackendImplementation) ResponseToError(res *http.Response, resBody []by } raw.E.Err = typedError + raw.E.SetLastResponse(newAPIResponse(res, resBody)) + return raw.E.Error } @@ -655,6 +707,12 @@ type Backends struct { mu sync.RWMutex } +// LastResponseSetter defines a type that contains an HTTP response from a Stripe +// API endpoint. +type LastResponseSetter interface { + SetLastResponse(response *APIResponse) +} + // SupportedBackend is an enumeration of supported Stripe endpoints. // Currently supported values are "api" and "uploads". type SupportedBackend string diff --git a/stripe_test.go b/stripe_test.go index 16382f8a8f..c252220c1c 100644 --- a/stripe_test.go +++ b/stripe_test.go @@ -51,6 +51,7 @@ func TestContext(t *testing.T) { // func TestDo_Retry(t *testing.T) { type testServerResponse struct { + APIResource Message string `json:"message"` } @@ -236,6 +237,7 @@ func TestShouldRetry(t *testing.T) { func TestDo_RetryOnTimeout(t *testing.T) { type testServerResponse struct { + APIResource Message string `json:"message"` } @@ -279,9 +281,65 @@ func TestDo_RetryOnTimeout(t *testing.T) { assert.Equal(t, uint32(2), atomic.LoadUint32(&counter)) } +func TestDo_LastResponsePopulated(t *testing.T) { + type testServerResponse struct { + APIResource + Message string `json:"message"` + } + + message := "Hello, client." + expectedResponse := testServerResponse{Message: message} + rawJSON, err := json.Marshal(expectedResponse) + assert.NoError(t, err) + + testServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Idempotency-Key", "key_123") + w.Header().Set("Other-Header", "other_header") + w.Header().Set("Request-Id", "req_123") + + w.WriteHeader(http.StatusCreated) + _, err = w.Write(rawJSON) + assert.NoError(t, err) + })) + defer testServer.Close() + + backend := GetBackendWithConfig( + APIBackend, + &BackendConfig{ + LogLevel: 3, + MaxNetworkRetries: 0, + URL: testServer.URL, + }, + ).(*BackendImplementation) + + request, err := backend.NewRequest( + http.MethodGet, + "/hello", + "sk_test_123", + "application/x-www-form-urlencoded", + nil, + ) + assert.NoError(t, err) + + var resource testServerResponse + err = backend.Do(request, nil, &resource) + assert.NoError(t, err) + assert.Equal(t, message, resource.Message) + + assert.Equal(t, "key_123", resource.LastResponse.IdempotencyKey) + assert.Equal(t, "other_header", resource.LastResponse.Header.Get("Other-Header")) + assert.Equal(t, rawJSON, resource.LastResponse.RawJSON) + assert.Equal(t, "req_123", resource.LastResponse.RequestID) + assert.Equal(t, + fmt.Sprintf("%v %v", http.StatusCreated, http.StatusText(http.StatusCreated)), + resource.LastResponse.Status) + assert.Equal(t, http.StatusCreated, resource.LastResponse.StatusCode) +} + // Test that telemetry metrics are not sent by default func TestDo_TelemetryDisabled(t *testing.T) { type testServerResponse struct { + APIResource Message string `json:"message"` } @@ -341,6 +399,7 @@ func TestDo_TelemetryDisabled(t *testing.T) { // EnableTelemetry = true. func TestDo_TelemetryEnabled(t *testing.T) { type testServerResponse struct { + APIResource Message string `json:"message"` } @@ -429,6 +488,7 @@ func TestDo_TelemetryEnabled(t *testing.T) { // passed to `go test`. func TestDo_TelemetryEnabledNoDataRace(t *testing.T) { type testServerResponse struct { + APIResource Message string `json:"message"` } @@ -844,6 +904,11 @@ func TestResponseToError(t *testing.T) { assert.Equal(t, res.StatusCode, stripeErr.HTTPStatusCode) assert.Equal(t, expectedErr.Type, stripeErr.Type) + // Not exhaustive, but verify LastResponse is basically working as + // expected. + assert.Equal(t, res.Header.Get("Request-Id"), stripeErr.LastResponse.RequestID) + assert.Equal(t, res.StatusCode, stripeErr.LastResponse.StatusCode) + // Just a bogus type coercion to demonstrate how this code might be // written. Because we've assigned ErrorTypeCard as the error's type, Err // should always come out as a CardError. diff --git a/sub.go b/sub.go index 1e03e50080..abb9c0e286 100644 --- a/sub.go +++ b/sub.go @@ -222,6 +222,7 @@ type SubscriptionTransferData struct { // Subscription is the resource representing a Stripe subscription. // For more details see https://stripe.com/docs/api#subscriptions. type Subscription struct { + APIResource ApplicationFeePercent float64 `json:"application_fee_percent"` BillingCycleAnchor int64 `json:"billing_cycle_anchor"` BillingThresholds *SubscriptionBillingThresholds `json:"billing_thresholds"` @@ -272,6 +273,7 @@ type SubscriptionBillingThresholds struct { // SubscriptionList is a list object for subscriptions. type SubscriptionList struct { + APIResource ListMeta Data []*Subscription `json:"data"` } diff --git a/subitem.go b/subitem.go index bb6f1d7f35..df891b7ab8 100644 --- a/subitem.go +++ b/subitem.go @@ -36,6 +36,7 @@ type SubscriptionItemListParams struct { // SubscriptionItem is the resource representing a Stripe subscription item. // For more details see https://stripe.com/docs/api#subscription_items. type SubscriptionItem struct { + APIResource BillingThresholds SubscriptionItemBillingThresholds `json:"billing_thresholds"` Created int64 `json:"created"` Deleted bool `json:"deleted"` @@ -55,6 +56,7 @@ type SubscriptionItemBillingThresholds struct { // SubscriptionItemList is a list of invoice items as retrieved from a list endpoint. type SubscriptionItemList struct { + APIResource ListMeta Data []*SubscriptionItem `json:"data"` } diff --git a/subschedule.go b/subschedule.go index 73016f667a..619f3e3f76 100644 --- a/subschedule.go +++ b/subschedule.go @@ -186,6 +186,7 @@ type SubscriptionScheduleRenewalInterval struct { // SubscriptionSchedule is the resource representing a Stripe subscription schedule. type SubscriptionSchedule struct { + APIResource CanceledAt int64 `json:"canceled_at"` CompletedAt int64 `json:"completed_at"` Created int64 `json:"created"` @@ -206,6 +207,7 @@ type SubscriptionSchedule struct { // SubscriptionScheduleList is a list object for subscription schedules. type SubscriptionScheduleList struct { + APIResource ListMeta Data []*SubscriptionSchedule `json:"data"` } diff --git a/taxid.go b/taxid.go index 3f7b99409e..79774deeba 100644 --- a/taxid.go +++ b/taxid.go @@ -70,6 +70,7 @@ type TaxIDVerification struct { // TaxID is the resource representing a customer's tax id. // For more details see https://stripe.com/docs/api/customers/tax_id_object type TaxID struct { + APIResource Country string `json:"country"` Created int64 `json:"created"` Customer *Customer `json:"customer"` @@ -84,6 +85,7 @@ type TaxID struct { // TaxIDList is a list of tax ids as retrieved from a list endpoint. type TaxIDList struct { + APIResource ListMeta Data []*TaxID `json:"data"` } diff --git a/taxrate.go b/taxrate.go index 733087d538..d996b7be1b 100644 --- a/taxrate.go +++ b/taxrate.go @@ -37,6 +37,7 @@ type TaxRateListParams struct { // TaxRate is the resource representing a Stripe tax rate. // For more details see https://stripe.com/docs/api/tax_rates/object. type TaxRate struct { + APIResource Active bool `json:"active"` Created int64 `json:"created"` Description string `json:"description"` @@ -52,6 +53,7 @@ type TaxRate struct { // TaxRateList is a list of tax rates as retrieved from a list endpoint. type TaxRateList struct { + APIResource ListMeta Data []*TaxRate `json:"data"` } diff --git a/terminal_connectiontoken.go b/terminal_connectiontoken.go index 4d599b214c..895b2a22ce 100644 --- a/terminal_connectiontoken.go +++ b/terminal_connectiontoken.go @@ -8,6 +8,7 @@ type TerminalConnectionTokenParams struct { // TerminalConnectionToken is the resource representing a Stripe terminal connection token. type TerminalConnectionToken struct { + APIResource Location string `json:"location"` Object string `json:"object"` Secret string `json:"secret"` diff --git a/terminal_location.go b/terminal_location.go index 4ab6735595..23c36eabc4 100644 --- a/terminal_location.go +++ b/terminal_location.go @@ -14,6 +14,7 @@ type TerminalLocationListParams struct { // TerminalLocation is the resource representing a Stripe terminal location. type TerminalLocation struct { + APIResource Address *AccountAddressParams `json:"address"` Deleted bool `json:"deleted"` DisplayName string `json:"display_name"` @@ -25,6 +26,7 @@ type TerminalLocation struct { // TerminalLocationList is a list of terminal readers as retrieved from a list endpoint. type TerminalLocationList struct { + APIResource ListMeta Data []*TerminalLocation `json:"data"` } diff --git a/terminal_reader.go b/terminal_reader.go index c0c250d73f..42cf63b4cb 100644 --- a/terminal_reader.go +++ b/terminal_reader.go @@ -23,6 +23,7 @@ type TerminalReaderListParams struct { // TerminalReader is the resource representing a Stripe terminal reader. type TerminalReader struct { + APIResource Deleted bool `json:"deleted"` DeviceSwVersion string `json:"device_sw_version"` DeviceType string `json:"device_type"` @@ -39,6 +40,7 @@ type TerminalReader struct { // TerminalReaderList is a list of terminal readers as retrieved from a list endpoint. type TerminalReaderList struct { + APIResource ListMeta Data []*TerminalReader `json:"data"` Location *string `json:"location"` diff --git a/threedsecure.go b/threedsecure.go index db02779b4a..9be09a2a31 100644 --- a/threedsecure.go +++ b/threedsecure.go @@ -16,6 +16,7 @@ type ThreeDSecureParams struct { // ThreeDSecure is the resource representing a Stripe 3DS object // For more details see https://stripe.com/docs/api#three_d_secure. type ThreeDSecure struct { + APIResource Amount int64 `json:"amount"` Authenticated bool `json:"authenticated"` Card *Card `json:"card"` diff --git a/token.go b/token.go index f9958d6a1d..a6e016c6a0 100644 --- a/token.go +++ b/token.go @@ -29,6 +29,8 @@ type TokenParams struct { // Token is the resource representing a Stripe token. // For more details see https://stripe.com/docs/api#tokens. type Token struct { + APIResource + BankAccount *BankAccount `json:"bank_account"` Card *Card `json:"card"` ClientIP string `json:"client_ip"` diff --git a/topup.go b/topup.go index cf0e8527a4..fb5d30adac 100644 --- a/topup.go +++ b/topup.go @@ -30,6 +30,7 @@ type TopupListParams struct { // TopupList is a list of top-ups as retrieved from a list endpoint. type TopupList struct { + APIResource ListMeta Data []*Topup `json:"data"` } @@ -37,6 +38,7 @@ type TopupList struct { // Topup is the resource representing a Stripe top-up. // For more details see https://stripe.com/docs/api#topups. type Topup struct { + APIResource Amount int64 `json:"amount"` ArrivalDate int64 `json:"arrival_date"` BalanceTransaction *BalanceTransaction `json:"balance_transaction"` diff --git a/transfer.go b/transfer.go index 6dd77a04f5..3a5e6ebcae 100644 --- a/transfer.go +++ b/transfer.go @@ -48,6 +48,7 @@ type TransferListParams struct { // Transfer is the resource representing a Stripe transfer. // For more details see https://stripe.com/docs/api#transfers. type Transfer struct { + APIResource Amount int64 `json:"amount"` AmountReversed int64 `json:"amount_reversed"` BalanceTransaction *BalanceTransaction `json:"balance_transaction"` @@ -68,6 +69,7 @@ type Transfer struct { // TransferList is a list of transfers as retrieved from a list endpoint. type TransferList struct { + APIResource ListMeta Data []*Transfer `json:"data"` } diff --git a/usagerecord.go b/usagerecord.go index 69b5f0bcdf..46ec5c2ee0 100644 --- a/usagerecord.go +++ b/usagerecord.go @@ -9,6 +9,7 @@ const ( // UsageRecord represents a usage record. // See https://stripe.com/docs/api#usage_records type UsageRecord struct { + APIResource ID string `json:"id"` Livemode bool `json:"livemode"` Quantity int64 `json:"quantity"` diff --git a/usagerecordsummary.go b/usagerecordsummary.go index 51afd5e8c9..ef886eb27d 100644 --- a/usagerecordsummary.go +++ b/usagerecordsummary.go @@ -20,6 +20,7 @@ type UsageRecordSummaryListParams struct { // UsageRecordSummaryList is a list of usage record summaries as retrieved from a list endpoint. type UsageRecordSummaryList struct { + APIResource ListMeta Data []*UsageRecordSummary `json:"data"` } diff --git a/webhookendpoint.go b/webhookendpoint.go index 4b54e974a3..cf197e9482 100644 --- a/webhookendpoint.go +++ b/webhookendpoint.go @@ -28,6 +28,7 @@ type WebhookEndpointListParams struct { // WebhookEndpoint is the resource representing a Stripe webhook endpoint. // For more details see https://stripe.com/docs/api#webhook_endpoints. type WebhookEndpoint struct { + APIResource APIVersion string `json:"api_version"` Application string `json:"application"` Connect bool `json:"connect"` @@ -45,6 +46,7 @@ type WebhookEndpoint struct { // WebhookEndpointList is a list of webhook endpoints as retrieved from a list endpoint. type WebhookEndpointList struct { + APIResource ListMeta Data []*WebhookEndpoint `json:"data"` } From 621854921f0129b6009eb60174b2ae29ebb9d1a7 Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Wed, 15 Apr 2020 19:39:54 -0700 Subject: [PATCH 2/8] Remove all beta features from Issuing APIs --- .travis.yml | 2 +- issuing/authorization/client.go | 8 +- issuing/authorization/client_test.go | 4 +- issuing/card/client.go | 13 -- issuing/card/client_test.go | 7 - issuing/cardholder/client_test.go | 3 +- issuing/dispute/client_test.go | 5 +- issuing_authorization.go | 139 ++++---------------- issuing_card.go | 184 +++++---------------------- issuing_cardholder.go | 84 +++++------- issuing_dispute.go | 88 +------------ issuing_transaction.go | 39 +++--- testing/testing.go | 2 +- 13 files changed, 116 insertions(+), 462 deletions(-) diff --git a/.travis.yml b/.travis.yml index eaeae1b4d1..e74d750f82 100644 --- a/.travis.yml +++ b/.travis.yml @@ -33,7 +33,7 @@ cache: env: global: # If changing this number, please also change it in `testing/testing.go`. - - STRIPE_MOCK_VERSION=0.86.0 + - STRIPE_MOCK_VERSION=0.87.0 go: - "1.9.x" diff --git a/issuing/authorization/client.go b/issuing/authorization/client.go index d25d39d996..71b6c91e84 100644 --- a/issuing/authorization/client.go +++ b/issuing/authorization/client.go @@ -17,12 +17,12 @@ type Client struct { } // Approve approves an issuing authorization. -func Approve(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) { +func Approve(id string, params *stripe.IssuingAuthorizationApproveParams) (*stripe.IssuingAuthorization, error) { return getC().Approve(id, params) } // Approve updates an issuing authorization. -func (c Client) Approve(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) { +func (c Client) Approve(id string, params *stripe.IssuingAuthorizationApproveParams) (*stripe.IssuingAuthorization, error) { path := stripe.FormatURLPath("/v1/issuing/authorizations/%s/approve", id) authorization := &stripe.IssuingAuthorization{} err := c.B.Call(http.MethodPost, path, c.Key, params, authorization) @@ -30,12 +30,12 @@ func (c Client) Approve(id string, params *stripe.IssuingAuthorizationParams) (* } // Decline decline an issuing authorization. -func Decline(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) { +func Decline(id string, params *stripe.IssuingAuthorizationDeclineParams) (*stripe.IssuingAuthorization, error) { return getC().Decline(id, params) } // Decline updates an issuing authorization. -func (c Client) Decline(id string, params *stripe.IssuingAuthorizationParams) (*stripe.IssuingAuthorization, error) { +func (c Client) Decline(id string, params *stripe.IssuingAuthorizationDeclineParams) (*stripe.IssuingAuthorization, error) { path := stripe.FormatURLPath("/v1/issuing/authorizations/%s/decline", id) authorization := &stripe.IssuingAuthorization{} err := c.B.Call(http.MethodPost, path, c.Key, params, authorization) diff --git a/issuing/authorization/client_test.go b/issuing/authorization/client_test.go index 48dd45e797..439b318cb8 100644 --- a/issuing/authorization/client_test.go +++ b/issuing/authorization/client_test.go @@ -9,14 +9,14 @@ import ( ) func TestIssuingAuthorizationApprove(t *testing.T) { - authorization, err := Approve("iauth_123", &stripe.IssuingAuthorizationParams{}) + authorization, err := Approve("iauth_123", &stripe.IssuingAuthorizationApproveParams{}) assert.Nil(t, err) assert.NotNil(t, authorization) assert.Equal(t, "issuing.authorization", authorization.Object) } func TestIssuingAuthorizationDecline(t *testing.T) { - authorization, err := Decline("iauth_123", &stripe.IssuingAuthorizationParams{}) + authorization, err := Decline("iauth_123", &stripe.IssuingAuthorizationDeclineParams{}) assert.Nil(t, err) assert.NotNil(t, authorization) assert.Equal(t, "issuing.authorization", authorization.Object) diff --git a/issuing/card/client.go b/issuing/card/client.go index 443ae05327..a084fa7142 100644 --- a/issuing/card/client.go +++ b/issuing/card/client.go @@ -74,19 +74,6 @@ func (c Client) List(listParams *stripe.IssuingCardListParams) *Iter { })} } -// Details retrieves an issuing card details. -func Details(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCardDetails, error) { - return getC().Details(id, params) -} - -// Details retrieves an issuing card details. -func (c Client) Details(id string, params *stripe.IssuingCardParams) (*stripe.IssuingCardDetails, error) { - path := stripe.FormatURLPath("/v1/issuing/cards/%s/details", id) - cardDetails := &stripe.IssuingCardDetails{} - err := c.B.Call(http.MethodGet, path, c.Key, params, cardDetails) - return cardDetails, err -} - // Iter is an iterator for issuing cards. type Iter struct { *stripe.Iter diff --git a/issuing/card/client_test.go b/issuing/card/client_test.go index d00c2a1e7b..862a9e6304 100644 --- a/issuing/card/client_test.go +++ b/issuing/card/client_test.go @@ -8,13 +8,6 @@ import ( _ "github.com/stripe/stripe-go/testing" ) -func TestIssuingCardDetails(t *testing.T) { - cardDetails, err := Details("ic_123", nil) - assert.Nil(t, err) - assert.NotNil(t, cardDetails) - assert.Equal(t, "issuing.card_details", cardDetails.Object) -} - func TestIssuingCardGet(t *testing.T) { card, err := Get("ic_123", nil) assert.Nil(t, err) diff --git a/issuing/cardholder/client_test.go b/issuing/cardholder/client_test.go index 2189ca984f..26969caf81 100644 --- a/issuing/cardholder/client_test.go +++ b/issuing/cardholder/client_test.go @@ -27,7 +27,7 @@ func TestIssuingCardholderList(t *testing.T) { func TestIssuingCardholderNew(t *testing.T) { cardholder, err := New(&stripe.IssuingCardholderParams{ - Billing: &stripe.IssuingBillingParams{ + Billing: &stripe.IssuingCardholderBillingParams{ Address: &stripe.AddressParams{ Country: stripe.String("US"), Line1: stripe.String("line1"), @@ -35,7 +35,6 @@ func TestIssuingCardholderNew(t *testing.T) { PostalCode: stripe.String("90210"), State: stripe.String("CA"), }, - Name: stripe.String("billing name"), }, Individual: &stripe.IssuingCardholderIndividualParams{ DOB: &stripe.IssuingCardholderIndividualDOBParams{ diff --git a/issuing/dispute/client_test.go b/issuing/dispute/client_test.go index 4cfeb64e2f..a6a942ae8e 100644 --- a/issuing/dispute/client_test.go +++ b/issuing/dispute/client_test.go @@ -26,9 +26,7 @@ func TestIssuingDisputeList(t *testing.T) { } func TestIssuingDisputeNew(t *testing.T) { - params := &stripe.IssuingDisputeParams{} - params.AddMetadata("key", "value") - dispute, err := New(params) + dispute, err := New(&stripe.IssuingDisputeParams{}) assert.Nil(t, err) assert.NotNil(t, dispute) assert.Equal(t, "issuing.dispute", dispute.Object) @@ -36,7 +34,6 @@ func TestIssuingDisputeNew(t *testing.T) { func TestIssuingDisputeUpdate(t *testing.T) { params := &stripe.IssuingDisputeParams{} - params.AddMetadata("key", "value") dispute, err := Update("idp_123", params) assert.Nil(t, err) assert.NotNil(t, dispute) diff --git a/issuing_authorization.go b/issuing_authorization.go index c419a1c79b..90b03bce53 100644 --- a/issuing_authorization.go +++ b/issuing_authorization.go @@ -45,8 +45,7 @@ type IssuingAuthorizationRequestHistoryReason string // List of values that IssuingAuthorizationRequestHistoryReason can take. const ( - IssuingAuthorizationRequestHistoryReasonAccountComplianceDisabled IssuingAuthorizationRequestHistoryReason = "account_compliance_disabled" - IssuingAuthorizationRequestHistoryReasonAccountInactive IssuingAuthorizationRequestHistoryReason = "account_inactive" + IssuingAuthorizationRequestHistoryReasonAccountDisabled IssuingAuthorizationRequestHistoryReason = "account_disabled" IssuingAuthorizationRequestHistoryReasonCardActive IssuingAuthorizationRequestHistoryReason = "card_active" IssuingAuthorizationRequestHistoryReasonCardInactive IssuingAuthorizationRequestHistoryReason = "card_inactive" IssuingAuthorizationRequestHistoryReasonCardholderInactive IssuingAuthorizationRequestHistoryReason = "cardholder_inactive" @@ -59,14 +58,6 @@ const ( IssuingAuthorizationRequestHistoryReasonWebhookApproved IssuingAuthorizationRequestHistoryReason = "webhook_approved" IssuingAuthorizationRequestHistoryReasonWebhookDeclined IssuingAuthorizationRequestHistoryReason = "webhook_declined" IssuingAuthorizationRequestHistoryReasonWebhookTimeout IssuingAuthorizationRequestHistoryReason = "webhook_timeout" - - // The following value is deprecated. Use IssuingAuthorizationRequestHistoryReasonSpendingControls instead. - IssuingAuthorizationRequestHistoryReasonAuthorizationControls IssuingAuthorizationRequestHistoryReason = "authorization_controls" - - // The following values are deprecated. Use IssuingAuthorizationRequestHistoryReasonVerificationFailed instead - IssuingAuthorizationRequestHistoryReasonAuthenticationFailed IssuingAuthorizationRequestHistoryReason = "authentication_failed" - IssuingAuthorizationRequestHistoryReasonIncorrectCVC IssuingAuthorizationRequestHistoryReason = "incorrect_cvc" - IssuingAuthorizationRequestHistoryReasonIncorrectExpiry IssuingAuthorizationRequestHistoryReason = "incorrect_expiry" ) // IssuingAuthorizationStatus is the possible values for status for an issuing authorization. @@ -79,18 +70,6 @@ const ( IssuingAuthorizationStatusReversed IssuingAuthorizationStatus = "reversed" ) -// IssuingAuthorizationVerificationDataAuthentication is the list of possible values for the result -// of an authentication on an issuing authorization. -type IssuingAuthorizationVerificationDataAuthentication string - -// List of values that IssuingAuthorizationVerificationDataCheck can take. -const ( - IssuingAuthorizationVerificationDataAuthenticationExempt IssuingAuthorizationVerificationDataAuthentication = "exempt" - IssuingAuthorizationVerificationDataAuthenticationFailure IssuingAuthorizationVerificationDataAuthentication = "failure" - IssuingAuthorizationVerificationDataAuthenticationNone IssuingAuthorizationVerificationDataAuthentication = "none" - IssuingAuthorizationVerificationDataAuthenticationSuccess IssuingAuthorizationVerificationDataAuthentication = "success" -) - // IssuingAuthorizationVerificationDataCheck is the list of possible values for result of a check // for verification data on an issuing authorization. type IssuingAuthorizationVerificationDataCheck string @@ -102,16 +81,6 @@ const ( IssuingAuthorizationVerificationDataCheckNotProvided IssuingAuthorizationVerificationDataCheck = "not_provided" ) -// IssuingAuthorizationVerificationDataThreeDSecureResult is the list of possible values for result of 3DS. -type IssuingAuthorizationVerificationDataThreeDSecureResult string - -// List of values that IssuingAuthorizationVerificationDataThreeDSecureResult can take. -const ( - IssuingAuthorizationVerificationDataThreeDSecureResultAttemptAcknowledged IssuingAuthorizationVerificationDataThreeDSecureResult = "attempt_acknowledged" - IssuingAuthorizationVerificationDataThreeDSecureResultAuthenticated IssuingAuthorizationVerificationDataThreeDSecureResult = "authenticated" - IssuingAuthorizationVerificationDataThreeDSecureResultFailed IssuingAuthorizationVerificationDataThreeDSecureResult = "failed" -) - // IssuingAuthorizationWalletType is the list of possible values for the authorization's wallet provider. type IssuingAuthorizationWalletType string @@ -122,25 +91,20 @@ const ( IssuingAuthorizationWalletTypeSamsungPay IssuingAuthorizationWalletType = "samsung_pay" ) -// IssuingAuthorizationWalletProviderType is the list of possible values for the authorization's wallet provider. -// TODO remove in the next major version -type IssuingAuthorizationWalletProviderType string - -// List of values that IssuingAuthorizationWalletProviderType can take. -const ( - IssuingAuthorizationWalletProviderTypeApplePay IssuingAuthorizationWalletProviderType = "apple_pay" - IssuingAuthorizationWalletProviderTypeGooglePay IssuingAuthorizationWalletProviderType = "google_pay" - IssuingAuthorizationWalletProviderTypeSamsungPay IssuingAuthorizationWalletProviderType = "samsung_pay" -) - // IssuingAuthorizationParams is the set of parameters that can be used when updating an issuing authorization. type IssuingAuthorizationParams struct { Params `form:"*"` +} + +// IssuingAuthorizationApproveParams is the set of parameters that can be used when approving an issuing authorization. +type IssuingAuthorizationApproveParams struct { + Params `form:"*"` Amount *int64 `form:"amount"` +} - // The following parameter is deprecated, use Amount instead. - // TODO: remove in a future major version - HeldAmount *int64 `form:"held_amount"` +// IssuingAuthorizationDeclineParams is the set of parameters that can be used when declining an issuing authorization. +type IssuingAuthorizationDeclineParams struct { + Params `form:"*"` } // IssuingAuthorizationListParams is the set of parameters that can be used when listing issuing authorizations. @@ -153,14 +117,15 @@ type IssuingAuthorizationListParams struct { Status *string `form:"status"` } -// IssuingAuthorizationAuthorizationControls is the resource representing authorization controls on an issuing authorization. -// This is deprecated and will be removed in the next major version -type IssuingAuthorizationAuthorizationControls struct { - AllowedCategories []string `json:"allowed_categories"` - BlockedCategories []string `json:"blocked_categories"` - Currency Currency `json:"currency"` - MaxAmount int64 `json:"max_amount"` - MaxApprovals int64 `json:"max_approvals"` +// IssuingAuthorizationMerchantData is the resource representing merchant data on Issuing APIs. +type IssuingAuthorizationMerchantData struct { + Category string `json:"category"` + City string `json:"city"` + Country string `json:"country"` + Name string `json:"name"` + NetworkID string `json:"network_id"` + PostalCode string `json:"postal_code"` + State string `json:"state"` } // IssuingAuthorizationPendingRequest is the resource representing details about the pending authorization request. @@ -172,14 +137,6 @@ type IssuingAuthorizationPendingRequest struct { MerchantCurrency Currency `json:"merchant_currency"` } -// IssuingAuthorizationRequestHistoryViolatedAuthorizationControl is the resource representing an -// authorizaton control that caused the authorization to fail. -// This is deprecated and will be removed in the next major version -type IssuingAuthorizationRequestHistoryViolatedAuthorizationControl struct { - Entity IssuingAuthorizationRequestHistoryViolatedAuthorizationControlEntity `json:"entity"` - Name IssuingAuthorizationRequestHistoryViolatedAuthorizationControlName `json:"name"` -} - // IssuingAuthorizationRequestHistory is the resource representing a request history on an issuing authorization. type IssuingAuthorizationRequestHistory struct { Amount int64 `json:"amount"` @@ -189,36 +146,14 @@ type IssuingAuthorizationRequestHistory struct { MerchantAmount int64 `json:"merchant_amount"` MerchantCurrency Currency `json:"merchant_currency"` Reason IssuingAuthorizationRequestHistoryReason `json:"reason"` - - // The following properties are deprecated - // TODO: remove in the next major version - AuthorizedAmount int64 `json:"authorized_amount"` - AuthorizedCurrency Currency `json:"authorized_currency"` - HeldAmount int64 `json:"held_amount"` - HeldCurrency Currency `json:"held_currency"` - ViolatedAuthorizationControls []*IssuingAuthorizationRequestHistoryViolatedAuthorizationControl `json:"violated_authorization_controls"` -} - -// IssuingAuthorizationVerificationDataThreeDSecure is the resource representing 3DS results. -type IssuingAuthorizationVerificationDataThreeDSecure struct { - Result IssuingAuthorizationVerificationDataThreeDSecureResult `json:"result"` } // IssuingAuthorizationVerificationData is the resource representing verification data on an issuing authorization. type IssuingAuthorizationVerificationData struct { - AddressLine1Check IssuingAuthorizationVerificationDataCheck `json:"address_line1_check"` - AddressPostalCodeCheck IssuingAuthorizationVerificationDataCheck `json:"address_postal_code_check"` - CVCCheck IssuingAuthorizationVerificationDataCheck `json:"cvc_check"` - ExpiryCheck IssuingAuthorizationVerificationDataCheck `json:"expiry_check"` - ThreeDSecure *IssuingAuthorizationVerificationDataThreeDSecure `json:"three_d_secure"` - - // The property is considered deprecated. Use AddressPostalCodeCheck instead. - // TODO remove in the next major version - AddressZipCheck IssuingAuthorizationVerificationDataCheck `json:"address_zip_check"` - - // The property is considered deprecated. Use ThreeDSecure instead. - // TODO remove in the next major version - Authentication IssuingAuthorizationVerificationDataAuthentication `json:"authentication"` + AddressLine1Check IssuingAuthorizationVerificationDataCheck `json:"address_line1_check"` + AddressPostalCodeCheck IssuingAuthorizationVerificationDataCheck `json:"address_postal_code_check"` + CVCCheck IssuingAuthorizationVerificationDataCheck `json:"cvc_check"` + ExpiryCheck IssuingAuthorizationVerificationDataCheck `json:"expiry_check"` } // IssuingAuthorization is the resource representing a Stripe issuing authorization. @@ -236,7 +171,7 @@ type IssuingAuthorization struct { Livemode bool `json:"livemode"` MerchantAmount int64 `json:"merchant_amount"` MerchantCurrency Currency `json:"merchant_currency"` - MerchantData *IssuingMerchantData `json:"merchant_data"` + MerchantData *IssuingAuthorizationMerchantData `json:"merchant_data"` Metadata map[string]string `json:"metadata"` Object string `json:"object"` PendingRequest *IssuingAuthorizationPendingRequest `json:"pending_request"` @@ -245,32 +180,6 @@ type IssuingAuthorization struct { Transactions []*IssuingTransaction `json:"transactions"` VerificationData *IssuingAuthorizationVerificationData `json:"verification_data"` Wallet IssuingAuthorizationWalletType `json:"wallet"` - - // This property is deprecated and we recommend that you use Wallet instead. - // TODO: remove in the next major version - WalletProvider IssuingAuthorizationWalletProviderType `json:"wallet_provider"` - - // The following properties are considered deprecated - // TODO: remove in the next major version - AuthorizedAmount int64 `json:"authorized_amount"` - AuthorizedCurrency Currency `json:"authorized_currency"` - HeldAmount int64 `json:"held_amount"` - HeldCurrency Currency `json:"held_currency"` - IsHeldAmountControllable bool `json:"is_held_amount_controllable"` - PendingAuthorizedAmount int64 `json:"pending_authorized_amount"` - PendingHeldAmount int64 `json:"pending_held_amount"` -} - -// IssuingMerchantData is the resource representing merchant data on Issuing APIs. -type IssuingMerchantData struct { - Category string `json:"category"` - City string `json:"city"` - Country string `json:"country"` - Name string `json:"name"` - NetworkID string `json:"network_id"` - PostalCode string `json:"postal_code"` - State string `json:"state"` - URL string `json:"url"` } // IssuingAuthorizationList is a list of issuing authorizations as retrieved from a list endpoint. diff --git a/issuing_card.go b/issuing_card.go index b82cd1e530..83322bd5a3 100644 --- a/issuing_card.go +++ b/issuing_card.go @@ -2,15 +2,6 @@ package stripe import "encoding/json" -// IssuingCardPINStatus is the list of possible values for the status field of a Card PIN. -type IssuingCardPINStatus string - -// List of values that IssuingCardPINStatus can take. -const ( - IssuingCardPINStatusActive IssuingCardPINStatus = "active" - IssuingCardPINStatusBlocked IssuingCardPINStatus = "blocked" -) - // IssuingCardCancellationReason is the list of possible values for the cancellation reason // on an issuing card. type IssuingCardCancellationReason string @@ -31,25 +22,16 @@ const ( IssuingCardReplacementReasonExpired IssuingCardReplacementReason = "expired" IssuingCardReplacementReasonLost IssuingCardReplacementReason = "lost" IssuingCardReplacementReasonStolen IssuingCardReplacementReason = "stolen" - - // The following values are deprecated and will be removed in the next major version. - IssuingCardReplacementReasonDamage IssuingCardReplacementReason = "damage" - IssuingCardReplacementReasonExpiration IssuingCardReplacementReason = "expiration" - IssuingCardReplacementReasonLoss IssuingCardReplacementReason = "loss" - IssuingCardReplacementReasonTheft IssuingCardReplacementReason = "theft" ) -// IssuingCardShippingStatus is the list of possible values for the shipping status +// IssuingCardShippingCarrier is the list of possible values for the shipping carrier // on an issuing card. -type IssuingCardShippingStatus string +type IssuingCardShippingCarrier string -// List of values that IssuingCardShippingStatus can take. +// List of values that IssuingCardShippingCarrier can take. const ( - IssuingCardShippingTypeDelivered IssuingCardShippingStatus = "delivered" - IssuingCardShippingTypeFailure IssuingCardShippingStatus = "failure" - IssuingCardShippingTypePending IssuingCardShippingStatus = "pending" - IssuingCardShippingTypeReturned IssuingCardShippingStatus = "returned" - IssuingCardShippingTypeShipped IssuingCardShippingStatus = "shipped" + IssuingCardShippingCarrierFEDEX IssuingCardShippingCarrier = "fedex" + IssuingCardShippingCarrierUSPS IssuingCardShippingCarrier = "usps" ) // IssuingCardShippingService is the shipment service for a card. @@ -60,20 +42,20 @@ const ( IssuingCardShippingServiceExpress IssuingCardShippingService = "express" IssuingCardShippingServicePriority IssuingCardShippingService = "priority" IssuingCardShippingServiceStandard IssuingCardShippingService = "standard" - - // The following value is deprecated, use IssuingCardShippingServicePriority instead - IssuingCardShippingServiceOvernight IssuingCardShippingService = "overnight" ) -// IssuingCardShippingSpeed is the shipment speed for a card. -// This is deprecated, use IssuingCardShippingService instead -type IssuingCardShippingSpeed string +// IssuingCardShippingStatus is the list of possible values for the shipping status +// on an issuing card. +type IssuingCardShippingStatus string -// List of values that IssuingCardShippingSpeed can take +// List of values that IssuingCardShippingStatus can take. const ( - IssuingCardShippingSpeedExpress IssuingCardShippingSpeed = "express" - IssuingCardShippingSpeedOvernight IssuingCardShippingSpeed = "overnight" - IssuingCardShippingSpeedStandard IssuingCardShippingSpeed = "standard" + IssuingCardShippingStatusCanceled IssuingCardShippingStatus = "canceled" + IssuingCardShippingStatusDelivered IssuingCardShippingStatus = "delivered" + IssuingCardShippingStatusFailure IssuingCardShippingStatus = "failure" + IssuingCardShippingStatusPending IssuingCardShippingStatus = "pending" + IssuingCardShippingStatusReturned IssuingCardShippingStatus = "returned" + IssuingCardShippingStatusShipped IssuingCardShippingStatus = "shipped" ) // IssuingCardShippingType is the list of possible values for the shipping type @@ -108,7 +90,6 @@ const ( IssuingCardStatusActive IssuingCardStatus = "active" IssuingCardStatusCanceled IssuingCardStatus = "canceled" IssuingCardStatusInactive IssuingCardStatus = "inactive" - IssuingCardStatusPending IssuingCardStatus = "pending" ) // IssuingCardType is the type of an issuing card. @@ -120,55 +101,12 @@ const ( IssuingCardTypeVirtual IssuingCardType = "virtual" ) -// IssuingSpendingLimitInterval is the list of possible values for the interval of a given -// spending limit on an issuing card or cardholder. -// This is deprecated, use IssuingCardSpendingControlsSpendingLimitInterval instead -type IssuingSpendingLimitInterval string - -// List of values that IssuingCardShippingStatus can take. -const ( - IssuingSpendingLimitIntervalAllTime IssuingSpendingLimitInterval = "all_time" - IssuingSpendingLimitIntervalDaily IssuingSpendingLimitInterval = "daily" - IssuingSpendingLimitIntervalMonthly IssuingSpendingLimitInterval = "monthly" - IssuingSpendingLimitIntervalPerAuthorization IssuingSpendingLimitInterval = "per_authorization" - IssuingSpendingLimitIntervalWeekly IssuingSpendingLimitInterval = "weekly" - IssuingSpendingLimitIntervalYearly IssuingSpendingLimitInterval = "yearly" -) - -// IssuingAuthorizationControlsSpendingLimitsParams is the set of parameters that can be used for -// the spending limits associated with a given issuing card or cardholder. -// This is deprecated and will be removed in the next major version. -type IssuingAuthorizationControlsSpendingLimitsParams struct { - Amount *int64 `form:"amount"` - Categories []*string `form:"categories"` - Interval *string `form:"interval"` -} - -// AuthorizationControlsParams is the set of parameters that can be used for the shipping parameter. -// This is deprecated and will be removed in the next major version. -type AuthorizationControlsParams struct { - AllowedCategories []*string `form:"allowed_categories"` - BlockedCategories []*string `form:"blocked_categories"` - MaxApprovals *int64 `form:"max_approvals"` - SpendingLimits []*IssuingAuthorizationControlsSpendingLimitsParams `form:"spending_limits"` - - // The following parameter only applies to Cardholder - SpendingLimitsCurrency *string `form:"spending_limits_currency"` - - // The following parameter is deprecated - MaxAmount *int64 `form:"max_amount"` -} - // IssuingCardShippingParams is the set of parameters that can be used for the shipping parameter. type IssuingCardShippingParams struct { Address *AddressParams `form:"address"` Name string `form:"name"` Service *string `form:"service"` Type *string `form:"type"` - - // This parameter is deprecated. Use Service instead. - // TODO remove in the next major version - Speed *string `form:"speed"` } // IssuingCardSpendingControlsSpendingLimitParams is the set of parameters that can be used to @@ -184,30 +122,24 @@ type IssuingCardSpendingControlsSpendingLimitParams struct { type IssuingCardSpendingControlsParams struct { AllowedCategories []*string `form:"allowed_categories"` BlockedCategories []*string `form:"blocked_categories"` - MaxApprovals *int64 `form:"max_approvals"` SpendingLimits []*IssuingCardSpendingControlsSpendingLimitParams `form:"spending_limits"` SpendingLimitsCurrency *string `form:"spending_limits_currency"` } // IssuingCardParams is the set of parameters that can be used when creating or updating an issuing card. type IssuingCardParams struct { - Params `form:"*"` - Billing *IssuingBillingParams `form:"billing"` - CancellationReason *string `form:"cancellation_reason"` - Cardholder *string `form:"cardholder"` - Currency *string `form:"currency"` - ReplacementFor *string `form:"replacement_for"` - ReplacementReason *string `form:"replacement_reason"` - SpendingControls *IssuingCardSpendingControlsParams `form:"spending_controls"` - Status *string `form:"status"` - Shipping *IssuingCardShippingParams `form:"shipping"` - Type *string `form:"type"` - - // The following parameter is deprecated, use SpendingControls instead. - AuthorizationControls *AuthorizationControlsParams `form:"authorization_controls"` - - // The following parameter is deprecated - Name *string `form:"name"` + Params `form:"*"` + Cardholder *string `form:"cardholder"` + Currency *string `form:"currency"` + ReplacementFor *string `form:"replacement_for"` + ReplacementReason *string `form:"replacement_reason"` + SpendingControls *IssuingCardSpendingControlsParams `form:"spending_controls"` + Shipping *IssuingCardShippingParams `form:"shipping"` + Status *string `form:"status"` + Type *string `form:"type"` + + // The following parameter is only supported when updating a card + CancellationReason *string `form:"cancellation_reason"` } // IssuingCardListParams is the set of parameters that can be used when listing issuing cards. @@ -221,67 +153,19 @@ type IssuingCardListParams struct { Last4 *string `form:"last4"` Status *string `form:"status"` Type *string `form:"type"` - - // The following parameters are deprecated - Name *string `form:"name"` - Source *string `form:"source"` -} - -// IssuingCardDetails is the resource representing issuing card details. -type IssuingCardDetails struct { - APIResource - Card *IssuingCard `json:"card"` - CVC string `json:"cvc"` - ExpMonth *string `form:"exp_month"` - ExpYear *string `form:"exp_year"` - Number string `json:"number"` - Object string `json:"object"` -} - -// IssuingAuthorizationControlsSpendingLimits is the resource representing spending limits -// associated with a card or cardholder. -type IssuingAuthorizationControlsSpendingLimits struct { - Amount int64 `json:"amount"` - Categories []string `json:"categories"` - Interval IssuingSpendingLimitInterval `json:"interval"` -} - -// IssuingCardAuthorizationControls is the resource representing authorization controls on an issuing card. -// TODO: Add the Cardholder version to "un-share" between Card and Cardholder in the next major version. -type IssuingCardAuthorizationControls struct { - AllowedCategories []string `json:"allowed_categories"` - BlockedCategories []string `json:"blocked_categories"` - MaxApprovals int64 `json:"max_approvals"` - SpendingLimits []*IssuingAuthorizationControlsSpendingLimits `json:"spending_limits"` - SpendingLimitsCurrency Currency `json:"spending_limits_currency"` - - // The properties below are deprecated and can only be used for an issuing card. - // TODO remove in the next major version - Currency Currency `json:"currency"` - MaxAmount int64 `json:"max_amount"` -} - -// IssuingCardPIN contains data about the Card's PIN. -type IssuingCardPIN struct { - Status IssuingCardPINStatus `json:"status"` } // IssuingCardShipping is the resource representing shipping on an issuing card. type IssuingCardShipping struct { Address *Address `json:"address"` - Carrier string `json:"carrier"` + Carrier IssuingCardShippingCarrier `json:"carrier"` ETA int64 `json:"eta"` Name string `json:"name"` - Phone string `json:"phone"` Service IssuingCardShippingService `json:"service"` Status IssuingCardShippingStatus `json:"status"` TrackingNumber string `json:"tracking_number"` TrackingURL string `json:"tracking_url"` Type IssuingCardShippingType `json:"type"` - - // The property is deprecated. Use AddressPostalCodeCheck instead. - // TODO remove in the next major version - Speed IssuingCardShippingSpeed `json:"speed"` } // IssuingCardSpendingControlsSpendingLimit is the resource representing a spending limit @@ -297,7 +181,6 @@ type IssuingCardSpendingControlsSpendingLimit struct { type IssuingCardSpendingControls struct { AllowedCategories []string `json:"allowed_categories"` BlockedCategories []string `json:"blocked_categories"` - MaxApprovals int64 `json:"max_approvals"` SpendingLimits []*IssuingCardSpendingControlsSpendingLimit `json:"spending_limits"` SpendingLimitsCurrency Currency `json:"spending_limits_currency"` } @@ -305,19 +188,18 @@ type IssuingCardSpendingControls struct { // IssuingCard is the resource representing a Stripe issuing card. type IssuingCard struct { APIResource - Billing *IssuingBilling `json:"billing"` Brand string `json:"brand"` CancellationReason IssuingCardCancellationReason `json:"cancellation_reason"` Cardholder *IssuingCardholder `json:"cardholder"` Created int64 `json:"created"` + Currency Currency `json:"currency"` ExpMonth int64 `json:"exp_month"` ExpYear int64 `json:"exp_year"` - Last4 string `json:"last4"` ID string `json:"id"` + Last4 string `json:"last4"` Livemode bool `json:"livemode"` Metadata map[string]string `json:"metadata"` Object string `json:"object"` - PIN *IssuingCardPIN `json:"pin"` ReplacedBy *IssuingCard `json:"replaced_by"` ReplacementFor *IssuingCard `json:"replacement_for"` ReplacementReason IssuingCardReplacementReason `json:"replacement_reason"` @@ -325,12 +207,6 @@ type IssuingCard struct { SpendingControls *IssuingCardSpendingControls `json:"spending_controls"` Status IssuingCardStatus `json:"status"` Type IssuingCardType `json:"type"` - - // The following property is deprecated, use SpendingControls instead. - AuthorizationControls *IssuingCardAuthorizationControls `json:"authorization_controls"` - - // The following property is deprecated, use Cardholder.Name instead. - Name string `json:"name"` } // IssuingCardList is a list of issuing cards as retrieved from a list endpoint. diff --git a/issuing_cardholder.go b/issuing_cardholder.go index 5b9ee6b21e..b12cd09704 100644 --- a/issuing_cardholder.go +++ b/issuing_cardholder.go @@ -34,9 +34,6 @@ type IssuingCardholderStatus string const ( IssuingCardholderStatusActive IssuingCardholderStatus = "active" IssuingCardholderStatusInactive IssuingCardholderStatus = "inactive" - - // This value is deprecated - IssuingCardholderStatusPending IssuingCardholderStatus = "pending" ) // IssuingCardholderType is the type of an issuing cardholder. @@ -46,25 +43,26 @@ type IssuingCardholderType string const ( IssuingCardholderTypeCompany IssuingCardholderType = "company" IssuingCardholderTypeIndividual IssuingCardholderType = "individual" - - // This value is deprecated. Use IssuingCardholderTypeCompany instead - IssuingCardholderTypeBusinessEntity IssuingCardholderType = "business_entity" ) -// IssuingBillingParams is the set of parameters that can be used for billing with the Issuing APIs. -type IssuingBillingParams struct { +// IssuingCardholderBillingParams is the set of parameters that can be used for billing with the Issuing APIs. +type IssuingCardholderBillingParams struct { Address *AddressParams `form:"address"` - - // This parameter is deprecated - Name *string `form:"name"` } -// IssuingCardholderCompanyParams represents additional information about a -// `business_entity` cardholder. +// IssuingCardholderCompanyParams represents additional information about a company cardholder. type IssuingCardholderCompanyParams struct { TaxID *string `form:"tax_id"` } +// IssuingCardholderIndividualDOBParams represents the date of birth of the +// cardholder individual. +type IssuingCardholderIndividualDOBParams struct { + Day *int64 `form:"day"` + Month *int64 `form:"month"` + Year *int64 `form:"year"` +} + // IssuingCardholderIndividualVerificationDocumentParams represents an // identifying document, either a passport or local ID card. type IssuingCardholderIndividualVerificationDocumentParams struct { @@ -78,14 +76,6 @@ type IssuingCardholderIndividualVerificationParams struct { Document *IssuingCardholderIndividualVerificationDocumentParams `form:"document"` } -// IssuingCardholderIndividualDOBParams represents the date of birth of the -// cardholder individual. -type IssuingCardholderIndividualDOBParams struct { - Day *int64 `form:"day"` - Month *int64 `form:"month"` - Year *int64 `form:"year"` -} - // IssuingCardholderIndividualParams represents additional information about an // `individual` cardholder. type IssuingCardholderIndividualParams struct { @@ -115,7 +105,7 @@ type IssuingCardholderSpendingControlsParams struct { // IssuingCardholderParams is the set of parameters that can be used when creating or updating an issuing cardholder. type IssuingCardholderParams struct { Params `form:"*"` - Billing *IssuingBillingParams `form:"billing"` + Billing *IssuingCardholderBillingParams `form:"billing"` Company *IssuingCardholderCompanyParams `form:"company"` Email *string `form:"email"` Individual *IssuingCardholderIndividualParams `form:"individual"` @@ -124,10 +114,6 @@ type IssuingCardholderParams struct { SpendingControls *IssuingCardholderSpendingControlsParams `form:"spending_controls"` Status *string `form:"status"` Type *string `form:"type"` - - // The following parameters are deprecated - IsDefault *bool `form:"is_default"` - AuthorizationControls *AuthorizationControlsParams `form:"authorization_controls"` } // IssuingCardholderListParams is the set of parameters that can be used when listing issuing cardholders. @@ -139,24 +125,24 @@ type IssuingCardholderListParams struct { PhoneNumber *string `form:"phone_number"` Status *string `form:"status"` Type *string `form:"type"` - - // The property is considered deprecated. - // TODO remove in the next major version - IsDefault *bool `form:"is_default"` } -// IssuingBilling is the resource representing the billing hash with the Issuing APIs. -type IssuingBilling struct { +// IssuingCardholderBilling is the resource representing the billing hash with the Issuing APIs. +type IssuingCardholderBilling struct { Address *Address `json:"address"` +} - // This property is deprecated - Name string `json:"name"` +// IssuingCardholderCompany represents additional information about a company cardholder. +type IssuingCardholderCompany struct { + TaxIDProvided bool `json:"tax_id_provided"` } -// IssuingCardholderRequirements contains the verification requirements for the cardholder. -type IssuingCardholderRequirements struct { - DisabledReason IssuingCardholderRequirementsDisabledReason `json:"disabled_reason"` - PastDue []string `json:"past_due"` +// IssuingCardholderIndividualDOB represents the date of birth of the issuing card hoder +// individual. +type IssuingCardholderIndividualDOB struct { + Day int64 `json:"day"` + Month int64 `json:"month"` + Year int64 `json:"year"` } // IssuingCardholderIndividualVerificationDocument represents an identifying @@ -172,14 +158,6 @@ type IssuingCardholderIndividualVerification struct { Document *IssuingCardholderIndividualVerificationDocument `json:"document"` } -// IssuingCardholderIndividualDOB represents the date of birth of the issuing card hoder -// individual. -type IssuingCardholderIndividualDOB struct { - Day int64 `json:"day"` - Month int64 `json:"month"` - Year int64 `json:"year"` -} - // IssuingCardholderIndividual represents additional information about an // individual cardholder. type IssuingCardholderIndividual struct { @@ -189,10 +167,10 @@ type IssuingCardholderIndividual struct { Verification *IssuingCardholderIndividualVerification `json:"verification"` } -// IssuingCardholderCompany represents additional information about a -// business_entity cardholder. -type IssuingCardholderCompany struct { - TaxIDProvided bool `json:"tax_id_provided"` +// IssuingCardholderRequirements contains the verification requirements for the cardholder. +type IssuingCardholderRequirements struct { + DisabledReason IssuingCardholderRequirementsDisabledReason `json:"disabled_reason"` + PastDue []string `json:"past_due"` } // IssuingCardholderSpendingControlsSpendingLimit is the resource representing a spending limit @@ -215,8 +193,7 @@ type IssuingCardholderSpendingControls struct { // IssuingCardholder is the resource representing a Stripe issuing cardholder. type IssuingCardholder struct { APIResource - - Billing *IssuingBilling `json:"billing"` + Billing *IssuingCardholderBilling `json:"billing"` Company *IssuingCardholderCompany `json:"company"` Created int64 `json:"created"` Email string `json:"email"` @@ -231,9 +208,6 @@ type IssuingCardholder struct { SpendingControls *IssuingCardholderSpendingControls `json:"spending_controls"` Status IssuingCardholderStatus `json:"status"` Type IssuingCardholderType `json:"type"` - - // The following property is deprecated, use SpendingControls instead - AuthorizationControls *IssuingCardAuthorizationControls `json:"authorization_controls"` } // IssuingCardholderList is a list of issuing cardholders as retrieved from a list endpoint. diff --git a/issuing_dispute.go b/issuing_dispute.go index f909ffc129..9e5e06d5af 100644 --- a/issuing_dispute.go +++ b/issuing_dispute.go @@ -2,100 +2,22 @@ package stripe import "encoding/json" -// IssuingDisputeReason is the list of possible values for status on an issuing dispute. -type IssuingDisputeReason string - -// List of values that IssuingDisputeReason can take. -const ( - IssuingDisputeReasonDuplicate IssuingDisputeReason = "duplicate" - IssuingDisputeReasonFraudulent IssuingDisputeReason = "fraudulent" - IssuingDisputeReasonOther IssuingDisputeReason = "other" - IssuingDisputeReasonProductNotReceived IssuingDisputeReason = "product_not_received" -) - -// IssuingDisputeStatus is the list of possible values for status on an issuing dispute. -type IssuingDisputeStatus string - -// List of values that IssuingDisputeStatus can take. -const ( - IssuingDisputeStatusLost IssuingDisputeStatus = "lost" - IssuingDisputeStatusUnderReview IssuingDisputeStatus = "under_review" - IssuingDisputeStatusUnsubmitted IssuingDisputeStatus = "unsubmitted" - IssuingDisputeStatusWon IssuingDisputeStatus = "won" -) - -// IssuingDisputeEvidenceFraudulentParams is the subset of parameters that can be sent as evidence for an issuing dispute -// with the reason set as fraudulent. -type IssuingDisputeEvidenceFraudulentParams struct { - DisputeExplanation *string `form:"dispute_explanation"` - UncategorizedFile *string `form:"uncategorized_file"` -} - -// IssuingDisputeEvidenceOtherParams is the subset of parameters that can be sent as evidence for an issuing dispute -// with the reason set as other. -type IssuingDisputeEvidenceOtherParams struct { - DisputeExplanation *string `form:"dispute_explanation"` - UncategorizedFile *string `form:"uncategorized_file"` -} - -// IssuingDisputeEvidenceParams is the set of parameters that can be sent as evidence for an issuing dispute. -type IssuingDisputeEvidenceParams struct { - Fraudulent *IssuingDisputeEvidenceFraudulentParams `form:"fraudulent"` - Other *IssuingDisputeEvidenceOtherParams `form:"other"` -} - // IssuingDisputeParams is the set of parameters that can be used when creating or updating an issuing dispute. type IssuingDisputeParams struct { - Params `form:"*"` - Amount *int64 `form:"amount"` - Evidence *IssuingDisputeEvidenceParams `form:"evidence"` - Reason *string `form:"reason"` - DisputedTransaction *string `form:"disputed_transaction"` + Params `form:"*"` } // IssuingDisputeListParams is the set of parameters that can be used when listing issuing dispute. type IssuingDisputeListParams struct { - ListParams `form:"*"` - Created *int64 `form:"created"` - CreatedRange *RangeQueryParams `form:"created"` - DisputedTransaction *string `form:"disputed_transaction"` - Transaction *string `form:"transaction"` -} - -// IssuingDisputeEvidenceFraudulent is the resource representing the evidence hash on an issuing dispute -// with the reason set as fraudulent. -type IssuingDisputeEvidenceFraudulent struct { - DisputeExplanation string `json:"dispute_explanation"` - UncategorizedFile *File `json:"uncategorized_file"` -} - -// IssuingDisputeEvidenceOther is the resource representing the evidence hash on an issuing dispute -// with the reason set as other. -type IssuingDisputeEvidenceOther struct { - DisputeExplanation string `json:"dispute_explanation"` - UncategorizedFile *File `json:"uncategorized_file"` -} - -// IssuingDisputeEvidence is the resource representing evidence on an issuing dispute. -type IssuingDisputeEvidence struct { - Fraudulent *IssuingDisputeEvidenceFraudulent `json:"fraudulent"` - Other *IssuingDisputeEvidenceOther `json:"other"` + ListParams `form:"*"` } // IssuingDispute is the resource representing an issuing dispute. type IssuingDispute struct { APIResource - Amount int64 `json:"amount"` - Created int64 `json:"created"` - Currency Currency `json:"currency"` - Evidence *IssuingDisputeEvidence `json:"evidence"` - ID string `json:"id"` - Livemode bool `json:"livemode"` - Metadata map[string]string `json:"metadata"` - Object string `json:"object"` - Reason IssuingDisputeReason `json:"reason"` - Status IssuingDisputeStatus `json:"status"` - Transaction *IssuingTransaction `json:"transaction"` + ID string `json:"id"` + Livemode bool `json:"livemode"` + Object string `json:"object"` } // IssuingDisputeList is a list of issuing disputes as retrieved from a list endpoint. diff --git a/issuing_transaction.go b/issuing_transaction.go index f8e569d9f0..4601460d51 100644 --- a/issuing_transaction.go +++ b/issuing_transaction.go @@ -7,10 +7,8 @@ type IssuingTransactionType string // List of values that IssuingTransactionType can take. const ( - IssuingTransactionTypeCapture IssuingTransactionType = "capture" - IssuingTransactionTypeCashWithdrawal IssuingTransactionType = "cash_withdrawal" - IssuingTransactionTypeRefund IssuingTransactionType = "refund" - IssuingTransactionTypeRefundReversal IssuingTransactionType = "refund_reversal" + IssuingTransactionTypeCapture IssuingTransactionType = "capture" + IssuingTransactionTypeRefund IssuingTransactionType = "refund" ) // IssuingTransactionParams is the set of parameters that can be used when creating or updating an issuing transaction. @@ -25,28 +23,27 @@ type IssuingTransactionListParams struct { Cardholder *string `form:"cardholder"` Created *int64 `form:"created"` CreatedRange *RangeQueryParams `form:"created"` - Dispute *string `form:"dispute"` } // IssuingTransaction is the resource representing a Stripe issuing transaction. type IssuingTransaction struct { APIResource - Amount int64 `json:"amount"` - Authorization *IssuingAuthorization `json:"authorization"` - BalanceTransaction *BalanceTransaction `json:"balance_transaction"` - Card *IssuingCard `json:"card"` - Cardholder *IssuingCardholder `json:"cardholder"` - Created int64 `json:"created"` - Currency Currency `json:"currency"` - Dispute *IssuingDispute `json:"dispute"` - ID string `json:"id"` - Livemode bool `json:"livemode"` - MerchantData *IssuingMerchantData `json:"merchant_data"` - MerchantAmount int64 `json:"merchant_amount"` - MerchantCurrency Currency `json:"merchant_currency"` - Metadata map[string]string `json:"metadata"` - Object string `json:"object"` - Type IssuingTransactionType `json:"type"` + Amount int64 `json:"amount"` + Authorization *IssuingAuthorization `json:"authorization"` + BalanceTransaction *BalanceTransaction `json:"balance_transaction"` + Card *IssuingCard `json:"card"` + Cardholder *IssuingCardholder `json:"cardholder"` + Created int64 `json:"created"` + Currency Currency `json:"currency"` + Dispute *IssuingDispute `json:"dispute"` + ID string `json:"id"` + Livemode bool `json:"livemode"` + MerchantData *IssuingAuthorizationMerchantData `json:"merchant_data"` + MerchantAmount int64 `json:"merchant_amount"` + MerchantCurrency Currency `json:"merchant_currency"` + Metadata map[string]string `json:"metadata"` + Object string `json:"object"` + Type IssuingTransactionType `json:"type"` } // IssuingTransactionList is a list of issuing transactions as retrieved from a list endpoint. diff --git a/testing/testing.go b/testing/testing.go index 63fc045da7..f85d4b702c 100644 --- a/testing/testing.go +++ b/testing/testing.go @@ -25,7 +25,7 @@ const ( // added in a more recent version of stripe-mock, we can show people a // better error message instead of the test suite crashing with a bunch of // confusing 404 errors or the like. - MockMinimumVersion = "0.86.0" + MockMinimumVersion = "0.87.0" // TestMerchantID is a token that can be used to represent a merchant ID in // simple tests. From ef1f87b78eb4914cfcae9a4e03e7f3a50a8f6462 Mon Sep 17 00:00:00 2001 From: Remi Jannel Date: Wed, 15 Apr 2020 19:42:59 -0700 Subject: [PATCH 3/8] Multiple breaking API changes * `PaymentIntent` is now expandable on `Charge` * `Percentage` was removed as a filter when listing `TaxRate` * Removed `RenewalInterval` on `SubscriptionSchedule` * Removed `Country` and `RoutingNumber` from `ChargePaymentMethodDetailsAcssDebit` --- charge.go | 8 +++----- subschedule.go | 7 ------- taxrate.go | 20 +++++--------------- 3 files changed, 8 insertions(+), 27 deletions(-) diff --git a/charge.go b/charge.go index 7ae10d2647..99bdb21a27 100644 --- a/charge.go +++ b/charge.go @@ -193,10 +193,8 @@ type ChargePaymentMethodDetailsAchDebit struct { // ChargePaymentMethodDetailsAcssDebit represents details about the ACSS Debit PaymentMethod. type ChargePaymentMethodDetailsAcssDebit struct { - Country string `json:"country"` - Fingerprint string `json:"fingerprint"` - Last4 string `json:"last4"` - RoutingNumber string `json:"routing_number"` + Fingerprint string `json:"fingerprint"` + Last4 string `json:"last4"` } // ChargePaymentMethodDetailsAlipay represents details about the Alipay PaymentMethod. @@ -487,7 +485,7 @@ type Charge struct { OnBehalfOf *Account `json:"on_behalf_of"` Outcome *ChargeOutcome `json:"outcome"` Paid bool `json:"paid"` - PaymentIntent string `json:"payment_intent"` + PaymentIntent *PaymentIntent `json:"payment_intent"` PaymentMethod string `json:"payment_method"` PaymentMethodDetails *ChargePaymentMethodDetails `json:"payment_method_details"` ReceiptEmail string `json:"receipt_email"` diff --git a/subschedule.go b/subschedule.go index 619f3e3f76..2d09fe353d 100644 --- a/subschedule.go +++ b/subschedule.go @@ -178,12 +178,6 @@ type SubscriptionSchedulePhase struct { TaxPercent float64 `json:"tax_percent"` } -// SubscriptionScheduleRenewalInterval represents the interval and duration of a schedule. -type SubscriptionScheduleRenewalInterval struct { - Interval PlanInterval `form:"interval"` - Length int64 `form:"length"` -} - // SubscriptionSchedule is the resource representing a Stripe subscription schedule. type SubscriptionSchedule struct { APIResource @@ -200,7 +194,6 @@ type SubscriptionSchedule struct { Object string `json:"object"` Phases []*SubscriptionSchedulePhase `json:"phases"` ReleasedSubscription *Subscription `json:"released_subscription"` - RenewalInterval *SubscriptionScheduleRenewalInterval `json:"renewal_interval"` Status SubscriptionScheduleStatus `json:"status"` Subscription *Subscription `json:"subscription"` } diff --git a/taxrate.go b/taxrate.go index d996b7be1b..0048170b2e 100644 --- a/taxrate.go +++ b/taxrate.go @@ -14,24 +14,14 @@ type TaxRateParams struct { Percentage *float64 `form:"percentage"` } -// TaxRatePercentageRangeQueryParams are used to filter tax rates by specific percentage values. -type TaxRatePercentageRangeQueryParams struct { - GreaterThan float64 `form:"gt"` - GreaterThanOrEqual float64 `form:"gte"` - LesserThan float64 `form:"lt"` - LesserThanOrEqual float64 `form:"lte"` -} - // TaxRateListParams is the set of parameters that can be used when listing tax rates. // For more detail see https://stripe.com/docs/api/tax_rates/list. type TaxRateListParams struct { - ListParams `form:"*"` - Active *bool `form:"active"` - Created *int64 `form:"created"` - CreatedRange *RangeQueryParams `form:"created"` - Inclusive *bool `form:"inclusive"` - Percentage *float64 `form:"percentage"` - PercentageRange *TaxRatePercentageRangeQueryParams `form:"percentage"` + ListParams `form:"*"` + Active *bool `form:"active"` + Created *int64 `form:"created"` + CreatedRange *RangeQueryParams `form:"created"` + Inclusive *bool `form:"inclusive"` } // TaxRate is the resource representing a Stripe tax rate. From d19dd49eef32879f0625f001eb80f011d4fa910a Mon Sep 17 00:00:00 2001 From: Brandur Date: Fri, 10 Apr 2020 12:00:28 -0700 Subject: [PATCH 4/8] Start using Go Modules Similar to the original implementation for Go Modules in #712, here we add a `go.mod` and `go.sum`, then proceed to use Go Modules style import paths everywhere that include the current major revision. Unfortunately, this may still cause trouble for Dep users who are trying to upgrade stripe-go, but the project's now had two years to help its users with basic Go Module awareness, and has chosen not to do so. It's received no commits of any kind since August 2019, and therefore would be considered unmaintained by most definitions. Elsewhere, Go Modules now seem to be the only and obvious way forward, so we're likely to see more and more users on them. `scripts/check_api_clients/main.go` is also updated to be smarter about breaking down package paths which may now include the major. [1] https://github.com/golang/dep/pull/1963 --- README.md | 54 ++------ account.go | 2 +- account/client.go | 4 +- account/client_test.go | 4 +- account_test.go | 2 +- accountlink/client.go | 2 +- accountlink/client_test.go | 4 +- applepaydomain/client.go | 4 +- applepaydomain/client_test.go | 4 +- balance/client.go | 2 +- balance/client_test.go | 2 +- balancetransaction/client.go | 4 +- balancetransaction/client_test.go | 4 +- bankaccount.go | 2 +- bankaccount/client.go | 4 +- bankaccount/client_test.go | 4 +- bankaccount_test.go | 2 +- bitcoinreceiver/client.go | 4 +- bitcoinreceiver/client_test.go | 4 +- bitcointransaction/client.go | 4 +- bitcointransaction/client_test.go | 4 +- capability/client.go | 4 +- capability/client_test.go | 4 +- card.go | 2 +- card/client.go | 4 +- card/client_test.go | 4 +- card_test.go | 2 +- charge/client.go | 4 +- charge/client_test.go | 4 +- charge_test.go | 2 +- checkout/session/client.go | 4 +- checkout/session/client_test.go | 4 +- client/api.go | 150 +++++++++++----------- countryspec/client.go | 4 +- countryspec/client_test.go | 4 +- coupon/client.go | 4 +- coupon/client_test.go | 4 +- creditnote/client.go | 4 +- creditnote/client_test.go | 4 +- customer/client.go | 4 +- customer/client_test.go | 4 +- customerbalancetransaction/client.go | 4 +- customerbalancetransaction/client_test.go | 4 +- discount/client.go | 2 +- discount/client_test.go | 2 +- dispute/client.go | 4 +- dispute/client_test.go | 4 +- ephemeralkey/client.go | 2 +- ephemeralkey/client_test.go | 4 +- event/client.go | 4 +- event/client_test.go | 4 +- example_test.go | 10 +- exchangerate/client.go | 4 +- exchangerate/client_test.go | 4 +- fee/client.go | 4 +- fee/client_test.go | 4 +- feerefund/client.go | 4 +- feerefund/client_test.go | 4 +- file.go | 2 +- file/client.go | 4 +- file/client_test.go | 4 +- filelink/client.go | 4 +- filelink/client_test.go | 4 +- go.mod | 8 ++ go.sum | 18 +++ invoice.go | 2 +- invoice/client.go | 4 +- invoice/client_test.go | 4 +- invoice_test.go | 2 +- invoiceitem/client.go | 4 +- invoiceitem/client_test.go | 4 +- issuing/authorization/client.go | 4 +- issuing/authorization/client_test.go | 4 +- issuing/card/client.go | 4 +- issuing/card/client_test.go | 4 +- issuing/cardholder/client.go | 4 +- issuing/cardholder/client_test.go | 4 +- issuing/dispute/client.go | 4 +- issuing/dispute/client_test.go | 4 +- issuing/transaction/client.go | 4 +- issuing/transaction/client_test.go | 4 +- iter.go | 2 +- iter_test.go | 2 +- loginlink/client.go | 2 +- loginlink/client_test.go | 4 +- mandate/client.go | 2 +- mandate/client_test.go | 2 +- oauth/client.go | 4 +- oauth/client_test.go | 4 +- order/client.go | 4 +- order/client_test.go | 4 +- order_test.go | 2 +- orderreturn/client.go | 4 +- orderreturn/client_test.go | 4 +- params.go | 2 +- params_test.go | 6 +- paymentintent/client.go | 4 +- paymentintent/client_test.go | 4 +- paymentmethod/client.go | 4 +- paymentmethod/client_test.go | 4 +- paymentsource.go | 2 +- paymentsource/client.go | 4 +- paymentsource/client_test.go | 4 +- paymentsource_test.go | 2 +- payout/client.go | 4 +- payout/client_test.go | 4 +- person/client.go | 4 +- person/client_test.go | 4 +- plan.go | 2 +- plan/client.go | 4 +- plan/client_test.go | 4 +- plan_test.go | 2 +- product/client.go | 4 +- product/client_test.go | 4 +- radar/earlyfraudwarning/client.go | 4 +- radar/earlyfraudwarning/client_test.go | 4 +- radar/valuelist/client.go | 4 +- radar/valuelist/client_test.go | 4 +- radar/valuelistitem/client.go | 4 +- radar/valuelistitem/client_test.go | 4 +- recipient.go | 2 +- recipient/client.go | 4 +- recipient/client_test.go | 4 +- recipient_test.go | 2 +- refund/client.go | 4 +- refund/client_test.go | 4 +- reporting/reportrun/client.go | 4 +- reporting/reportrun/client_test.go | 4 +- reporting/reporttype/client.go | 4 +- reporting/reporttype/client_test.go | 4 +- reversal/client.go | 4 +- reversal/client_test.go | 4 +- review/client.go | 4 +- review/client_test.go | 4 +- scripts/check_api_clients/main.go | 16 ++- setupintent/client.go | 4 +- setupintent/client_test.go | 4 +- sigma/scheduledqueryrun/client.go | 4 +- sigma/scheduledqueryrun/client_test.go | 4 +- sku/client.go | 4 +- sku/client_test.go | 4 +- source.go | 2 +- source/client.go | 2 +- source/client_test.go | 4 +- source_test.go | 2 +- sourcetransaction/client.go | 4 +- sourcetransaction/client_test.go | 4 +- stripe.go | 2 +- sub.go | 2 +- sub/client.go | 4 +- sub/client_test.go | 4 +- sub_test.go | 2 +- subitem/client.go | 4 +- subitem/client_test.go | 4 +- subschedule.go | 2 +- subschedule/client.go | 4 +- subschedule/client_test.go | 4 +- subschedule_test.go | 2 +- taxid/client.go | 4 +- taxid/client_test.go | 4 +- taxrate/client.go | 4 +- taxrate/client_test.go | 4 +- terminal/connectiontoken/client.go | 2 +- terminal/connectiontoken/client_test.go | 4 +- terminal/location/client.go | 4 +- terminal/location/client_test.go | 4 +- terminal/reader/client.go | 4 +- terminal/reader/client_test.go | 4 +- testing/testing.go | 4 +- threedsecure/client.go | 2 +- threedsecure/client_test.go | 4 +- token/client.go | 2 +- token/client_test.go | 4 +- topup/client.go | 4 +- topup/client_test.go | 4 +- transfer/client.go | 4 +- transfer/client_test.go | 4 +- usagerecord/client.go | 2 +- usagerecord/client_test.go | 4 +- usagerecord_test.go | 2 +- usagerecordsummary/client.go | 4 +- usagerecordsummary/client_test.go | 4 +- webhook/client.go | 2 +- webhook/client_handler_test.go | 2 +- webhookendpoint/client.go | 4 +- webhookendpoint/client_test.go | 4 +- 186 files changed, 444 insertions(+), 446 deletions(-) create mode 100644 go.mod create mode 100644 go.sum diff --git a/README.md b/README.md index bcec7cbf6d..5fe4bd747e 100644 --- a/README.md +++ b/README.md @@ -18,38 +18,8 @@ Then, import it using: ``` go import ( - "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/customer" -) -``` - -### Go Module Support - -The library currently *does not* ship with first-class support for Go -modules. We put in support for it before, but ran into compatibility problems -for existing installations using Dep (see discussion in [closer to the bottom -of this thread][gomodvsdep]), and [reverted support][gomodrevert]. Our current -plan is to wait for better module compatibility in Dep (see a [preliminary -patch here][depgomodsupport]), give the release a little grace time to become -more widely distributed, then bring support back. - -For now, require stripe-go in `go.mod` with a version but without a *version -suffix* in the path like so: - -``` go -module github.com/my/package - -require ( - github.com/stripe/stripe-go v70.15.0 -) -``` - -And use the same style of import paths as above: - -``` go -import ( - "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/customer" + "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/customer" ) ``` @@ -139,8 +109,8 @@ To use a key, pass it to `API`'s `Init` function: ```go import ( - "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/client" + "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/client" ) stripe := &client.API{} @@ -161,8 +131,8 @@ import ( "google.golang.org/appengine" "google.golang.org/appengine/urlfetch" - "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/client" + "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/client" ) func handler(w http.ResponseWriter, r *http.Request) { @@ -196,8 +166,8 @@ client. ```go import ( - "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/$resource$" + "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/$resource$" ) // Setup @@ -236,8 +206,8 @@ individual key. ```go import ( - "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/client" + "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/client" ) // Setup @@ -274,8 +244,8 @@ problem by configuring the maximum number of retries: ```go import ( - "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/client" + "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/client" ) config := &stripe.BackendConfig{ diff --git a/account.go b/account.go index 79d72faabc..8551878e4d 100644 --- a/account.go +++ b/account.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // AccountType is the type of an account. diff --git a/account/client.go b/account/client.go index 1d23cbbc71..847a6db361 100644 --- a/account/client.go +++ b/account/client.go @@ -6,8 +6,8 @@ package account import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke APIs related to accounts. diff --git a/account/client_test.go b/account/client_test.go index e0e793e5aa..a36af408bc 100644 --- a/account/client_test.go +++ b/account/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestAccountDel(t *testing.T) { diff --git a/account_test.go b/account_test.go index cd848060b7..6518a6bfc1 100644 --- a/account_test.go +++ b/account_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestAccountExternalAccountParams_AppendTo(t *testing.T) { diff --git a/accountlink/client.go b/accountlink/client.go index dbf15a1c80..930d068931 100644 --- a/accountlink/client.go +++ b/accountlink/client.go @@ -6,7 +6,7 @@ package accountlink import ( "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke APIs related to account links. diff --git a/accountlink/client_test.go b/accountlink/client_test.go index 3028e59c24..4a4f3fb600 100644 --- a/accountlink/client_test.go +++ b/accountlink/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestAccountLinkNew(t *testing.T) { diff --git a/applepaydomain/client.go b/applepaydomain/client.go index 48c7bb6fec..eac3c74f22 100644 --- a/applepaydomain/client.go +++ b/applepaydomain/client.go @@ -4,8 +4,8 @@ package applepaydomain import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /apple_pay/domains and Apple Pay domain-related APIs. diff --git a/applepaydomain/client_test.go b/applepaydomain/client_test.go index 5da0937643..a52fde46fa 100644 --- a/applepaydomain/client_test.go +++ b/applepaydomain/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestApplePayDomainDel(t *testing.T) { diff --git a/balance/client.go b/balance/client.go index 812da0cf7a..97fd9484c8 100644 --- a/balance/client.go +++ b/balance/client.go @@ -4,7 +4,7 @@ package balance import ( "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke /balance and transaction-related APIs. diff --git a/balance/client_test.go b/balance/client_test.go index 33c63f6ada..cd802f06ca 100644 --- a/balance/client_test.go +++ b/balance/client_test.go @@ -4,7 +4,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - _ "github.com/stripe/stripe-go/testing" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestBalanceGet(t *testing.T) { diff --git a/balancetransaction/client.go b/balancetransaction/client.go index 66213b118f..8004fa107a 100644 --- a/balancetransaction/client.go +++ b/balancetransaction/client.go @@ -4,8 +4,8 @@ package balancetransaction import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /balance_transactions APIs. diff --git a/balancetransaction/client_test.go b/balancetransaction/client_test.go index a8784867bf..6222f129a5 100644 --- a/balancetransaction/client_test.go +++ b/balancetransaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestBalanceTransactionGet(t *testing.T) { diff --git a/bankaccount.go b/bankaccount.go index 4b20e4d2cf..b3503ec27a 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strconv" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // BankAccountStatus is the list of allowed values for the bank account's status. diff --git a/bankaccount/client.go b/bankaccount/client.go index cbbff09301..534ef1d74b 100644 --- a/bankaccount/client.go +++ b/bankaccount/client.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /bank_accounts APIs. diff --git a/bankaccount/client_test.go b/bankaccount/client_test.go index 29680382f7..e9321f9404 100644 --- a/bankaccount/client_test.go +++ b/bankaccount/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestBankAccountDel_ByAccount(t *testing.T) { diff --git a/bankaccount_test.go b/bankaccount_test.go index c273d6d338..4451309411 100644 --- a/bankaccount_test.go +++ b/bankaccount_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestBankAccount_UnmarshalJSON(t *testing.T) { diff --git a/bitcoinreceiver/client.go b/bitcoinreceiver/client.go index 1dbf274a3b..6733bdebd1 100644 --- a/bitcoinreceiver/client.go +++ b/bitcoinreceiver/client.go @@ -7,8 +7,8 @@ package bitcoinreceiver import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /bitcoin/receivers APIs. diff --git a/bitcoinreceiver/client_test.go b/bitcoinreceiver/client_test.go index e5f932d5e5..70897d4772 100644 --- a/bitcoinreceiver/client_test.go +++ b/bitcoinreceiver/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestBitcoinReceiverGet(t *testing.T) { diff --git a/bitcointransaction/client.go b/bitcointransaction/client.go index 7950dbb7e2..367c449413 100644 --- a/bitcointransaction/client.go +++ b/bitcointransaction/client.go @@ -4,8 +4,8 @@ package bitcointransaction import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /bitcoin/receivers/:receiver_id/transactions APIs. diff --git a/bitcointransaction/client_test.go b/bitcointransaction/client_test.go index 4256d60184..6b286e7231 100644 --- a/bitcointransaction/client_test.go +++ b/bitcointransaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestBitcoinTransactionList(t *testing.T) { diff --git a/capability/client.go b/capability/client.go index 3e2a7faa67..e9dd476326 100644 --- a/capability/client.go +++ b/capability/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /accounts/capabilities APIs. diff --git a/capability/client_test.go b/capability/client_test.go index e3819df8fc..ae95acd39d 100644 --- a/capability/client_test.go +++ b/capability/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestCapabilityGet(t *testing.T) { diff --git a/card.go b/card.go index b27a1c2d54..ffb87c3dfb 100644 --- a/card.go +++ b/card.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strconv" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // CardAvailablePayoutMethod is a set of available payout methods for the card. diff --git a/card/client.go b/card/client.go index 2fe4cb12c7..d108c70d96 100644 --- a/card/client.go +++ b/card/client.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /cards APIs. diff --git a/card/client_test.go b/card/client_test.go index 13ea00a71b..a8fe3c2ba6 100644 --- a/card/client_test.go +++ b/card/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestCardDel(t *testing.T) { diff --git a/card_test.go b/card_test.go index dc896b94fa..bb401f8a64 100644 --- a/card_test.go +++ b/card_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestCardListParams_AppendTo(t *testing.T) { diff --git a/charge/client.go b/charge/client.go index a5f17ae979..7046ab3136 100644 --- a/charge/client.go +++ b/charge/client.go @@ -6,8 +6,8 @@ package charge import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke APIs related to charges. diff --git a/charge/client_test.go b/charge/client_test.go index 20d8c307b7..0bf690c595 100644 --- a/charge/client_test.go +++ b/charge/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestChargeCapture(t *testing.T) { diff --git a/charge_test.go b/charge_test.go index a3a56bb7e7..24c67765f0 100644 --- a/charge_test.go +++ b/charge_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestCharge_UnmarshalJSON(t *testing.T) { diff --git a/checkout/session/client.go b/checkout/session/client.go index e0e8f7a89e..27da0f563b 100644 --- a/checkout/session/client.go +++ b/checkout/session/client.go @@ -4,8 +4,8 @@ package session import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /checkout_sessions APIs. diff --git a/checkout/session/client_test.go b/checkout/session/client_test.go index b142666d29..d7ae4639b0 100644 --- a/checkout/session/client_test.go +++ b/checkout/session/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestCheckoutSessionGet(t *testing.T) { diff --git a/client/api.go b/client/api.go index ccb6ba48af..fc4e7d1fde 100644 --- a/client/api.go +++ b/client/api.go @@ -2,81 +2,81 @@ package client import ( - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/account" - "github.com/stripe/stripe-go/accountlink" - "github.com/stripe/stripe-go/applepaydomain" - "github.com/stripe/stripe-go/balance" - "github.com/stripe/stripe-go/balancetransaction" - "github.com/stripe/stripe-go/bankaccount" - "github.com/stripe/stripe-go/bitcoinreceiver" - "github.com/stripe/stripe-go/bitcointransaction" - "github.com/stripe/stripe-go/capability" - "github.com/stripe/stripe-go/card" - "github.com/stripe/stripe-go/charge" - checkoutsession "github.com/stripe/stripe-go/checkout/session" - "github.com/stripe/stripe-go/countryspec" - "github.com/stripe/stripe-go/coupon" - "github.com/stripe/stripe-go/creditnote" - "github.com/stripe/stripe-go/customer" - "github.com/stripe/stripe-go/customerbalancetransaction" - "github.com/stripe/stripe-go/discount" - "github.com/stripe/stripe-go/dispute" - "github.com/stripe/stripe-go/ephemeralkey" - "github.com/stripe/stripe-go/event" - "github.com/stripe/stripe-go/exchangerate" - "github.com/stripe/stripe-go/fee" - "github.com/stripe/stripe-go/feerefund" - "github.com/stripe/stripe-go/file" - "github.com/stripe/stripe-go/filelink" - "github.com/stripe/stripe-go/invoice" - "github.com/stripe/stripe-go/invoiceitem" - "github.com/stripe/stripe-go/issuing/authorization" - issuingcard "github.com/stripe/stripe-go/issuing/card" - "github.com/stripe/stripe-go/issuing/cardholder" - issuingdispute "github.com/stripe/stripe-go/issuing/dispute" - "github.com/stripe/stripe-go/issuing/transaction" - "github.com/stripe/stripe-go/loginlink" - "github.com/stripe/stripe-go/mandate" - "github.com/stripe/stripe-go/oauth" - "github.com/stripe/stripe-go/order" - "github.com/stripe/stripe-go/orderreturn" - "github.com/stripe/stripe-go/paymentintent" - "github.com/stripe/stripe-go/paymentmethod" - "github.com/stripe/stripe-go/paymentsource" - "github.com/stripe/stripe-go/payout" - "github.com/stripe/stripe-go/person" - "github.com/stripe/stripe-go/plan" - "github.com/stripe/stripe-go/product" - "github.com/stripe/stripe-go/radar/earlyfraudwarning" - "github.com/stripe/stripe-go/radar/valuelist" - "github.com/stripe/stripe-go/radar/valuelistitem" - "github.com/stripe/stripe-go/recipient" - "github.com/stripe/stripe-go/refund" - "github.com/stripe/stripe-go/reporting/reportrun" - "github.com/stripe/stripe-go/reporting/reporttype" - "github.com/stripe/stripe-go/reversal" - "github.com/stripe/stripe-go/review" - "github.com/stripe/stripe-go/setupintent" - "github.com/stripe/stripe-go/sigma/scheduledqueryrun" - "github.com/stripe/stripe-go/sku" - "github.com/stripe/stripe-go/source" - "github.com/stripe/stripe-go/sourcetransaction" - "github.com/stripe/stripe-go/sub" - "github.com/stripe/stripe-go/subitem" - "github.com/stripe/stripe-go/subschedule" - "github.com/stripe/stripe-go/taxid" - "github.com/stripe/stripe-go/taxrate" - terminalconnectiontoken "github.com/stripe/stripe-go/terminal/connectiontoken" - terminallocation "github.com/stripe/stripe-go/terminal/location" - terminalreader "github.com/stripe/stripe-go/terminal/reader" - "github.com/stripe/stripe-go/threedsecure" - "github.com/stripe/stripe-go/token" - "github.com/stripe/stripe-go/topup" - "github.com/stripe/stripe-go/transfer" - "github.com/stripe/stripe-go/usagerecord" - "github.com/stripe/stripe-go/usagerecordsummary" - "github.com/stripe/stripe-go/webhookendpoint" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/account" + "github.com/stripe/stripe-go/v71/accountlink" + "github.com/stripe/stripe-go/v71/applepaydomain" + "github.com/stripe/stripe-go/v71/balance" + "github.com/stripe/stripe-go/v71/balancetransaction" + "github.com/stripe/stripe-go/v71/bankaccount" + "github.com/stripe/stripe-go/v71/bitcoinreceiver" + "github.com/stripe/stripe-go/v71/bitcointransaction" + "github.com/stripe/stripe-go/v71/capability" + "github.com/stripe/stripe-go/v71/card" + "github.com/stripe/stripe-go/v71/charge" + checkoutsession "github.com/stripe/stripe-go/v71/checkout/session" + "github.com/stripe/stripe-go/v71/countryspec" + "github.com/stripe/stripe-go/v71/coupon" + "github.com/stripe/stripe-go/v71/creditnote" + "github.com/stripe/stripe-go/v71/customer" + "github.com/stripe/stripe-go/v71/customerbalancetransaction" + "github.com/stripe/stripe-go/v71/discount" + "github.com/stripe/stripe-go/v71/dispute" + "github.com/stripe/stripe-go/v71/ephemeralkey" + "github.com/stripe/stripe-go/v71/event" + "github.com/stripe/stripe-go/v71/exchangerate" + "github.com/stripe/stripe-go/v71/fee" + "github.com/stripe/stripe-go/v71/feerefund" + "github.com/stripe/stripe-go/v71/file" + "github.com/stripe/stripe-go/v71/filelink" + "github.com/stripe/stripe-go/v71/invoice" + "github.com/stripe/stripe-go/v71/invoiceitem" + "github.com/stripe/stripe-go/v71/issuing/authorization" + issuingcard "github.com/stripe/stripe-go/v71/issuing/card" + "github.com/stripe/stripe-go/v71/issuing/cardholder" + issuingdispute "github.com/stripe/stripe-go/v71/issuing/dispute" + "github.com/stripe/stripe-go/v71/issuing/transaction" + "github.com/stripe/stripe-go/v71/loginlink" + "github.com/stripe/stripe-go/v71/mandate" + "github.com/stripe/stripe-go/v71/oauth" + "github.com/stripe/stripe-go/v71/order" + "github.com/stripe/stripe-go/v71/orderreturn" + "github.com/stripe/stripe-go/v71/paymentintent" + "github.com/stripe/stripe-go/v71/paymentmethod" + "github.com/stripe/stripe-go/v71/paymentsource" + "github.com/stripe/stripe-go/v71/payout" + "github.com/stripe/stripe-go/v71/person" + "github.com/stripe/stripe-go/v71/plan" + "github.com/stripe/stripe-go/v71/product" + "github.com/stripe/stripe-go/v71/radar/earlyfraudwarning" + "github.com/stripe/stripe-go/v71/radar/valuelist" + "github.com/stripe/stripe-go/v71/radar/valuelistitem" + "github.com/stripe/stripe-go/v71/recipient" + "github.com/stripe/stripe-go/v71/refund" + "github.com/stripe/stripe-go/v71/reporting/reportrun" + "github.com/stripe/stripe-go/v71/reporting/reporttype" + "github.com/stripe/stripe-go/v71/reversal" + "github.com/stripe/stripe-go/v71/review" + "github.com/stripe/stripe-go/v71/setupintent" + "github.com/stripe/stripe-go/v71/sigma/scheduledqueryrun" + "github.com/stripe/stripe-go/v71/sku" + "github.com/stripe/stripe-go/v71/source" + "github.com/stripe/stripe-go/v71/sourcetransaction" + "github.com/stripe/stripe-go/v71/sub" + "github.com/stripe/stripe-go/v71/subitem" + "github.com/stripe/stripe-go/v71/subschedule" + "github.com/stripe/stripe-go/v71/taxid" + "github.com/stripe/stripe-go/v71/taxrate" + terminalconnectiontoken "github.com/stripe/stripe-go/v71/terminal/connectiontoken" + terminallocation "github.com/stripe/stripe-go/v71/terminal/location" + terminalreader "github.com/stripe/stripe-go/v71/terminal/reader" + "github.com/stripe/stripe-go/v71/threedsecure" + "github.com/stripe/stripe-go/v71/token" + "github.com/stripe/stripe-go/v71/topup" + "github.com/stripe/stripe-go/v71/transfer" + "github.com/stripe/stripe-go/v71/usagerecord" + "github.com/stripe/stripe-go/v71/usagerecordsummary" + "github.com/stripe/stripe-go/v71/webhookendpoint" ) // API is the Stripe client. It contains all the different resources available. diff --git a/countryspec/client.go b/countryspec/client.go index 3c80fe8407..1f64b63ff0 100644 --- a/countryspec/client.go +++ b/countryspec/client.go @@ -4,8 +4,8 @@ package countryspec import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /country_specs and countryspec-related APIs. diff --git a/countryspec/client_test.go b/countryspec/client_test.go index feefa7cd44..bfc19f4137 100644 --- a/countryspec/client_test.go +++ b/countryspec/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestCountrySpecGet(t *testing.T) { diff --git a/coupon/client.go b/coupon/client.go index da17e9eeb1..895ca23087 100644 --- a/coupon/client.go +++ b/coupon/client.go @@ -4,8 +4,8 @@ package coupon import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /coupons APIs. diff --git a/coupon/client_test.go b/coupon/client_test.go index 898c44d7ff..f1e09083d2 100644 --- a/coupon/client_test.go +++ b/coupon/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestCouponDel(t *testing.T) { diff --git a/creditnote/client.go b/creditnote/client.go index ffff8ea546..a7b8795404 100644 --- a/creditnote/client.go +++ b/creditnote/client.go @@ -4,8 +4,8 @@ package creditnote import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is the client used to invoke /credit_notes APIs. diff --git a/creditnote/client_test.go b/creditnote/client_test.go index 6cb48887ec..b26bc2f247 100644 --- a/creditnote/client_test.go +++ b/creditnote/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestCreditNoteGet(t *testing.T) { diff --git a/customer/client.go b/customer/client.go index d7cacd5107..ad9140e36e 100644 --- a/customer/client.go +++ b/customer/client.go @@ -4,8 +4,8 @@ package customer import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /customers APIs. diff --git a/customer/client_test.go b/customer/client_test.go index 78d3dd5101..131298141a 100644 --- a/customer/client_test.go +++ b/customer/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestCustomerDel(t *testing.T) { diff --git a/customerbalancetransaction/client.go b/customerbalancetransaction/client.go index dc9501ac78..537066d62e 100644 --- a/customerbalancetransaction/client.go +++ b/customerbalancetransaction/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /balance_transactions APIs. diff --git a/customerbalancetransaction/client_test.go b/customerbalancetransaction/client_test.go index e9a7b44c3c..67d3593014 100644 --- a/customerbalancetransaction/client_test.go +++ b/customerbalancetransaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestCustomerBalanceTransactionGet(t *testing.T) { diff --git a/discount/client.go b/discount/client.go index c001277cd8..90dadda23d 100644 --- a/discount/client.go +++ b/discount/client.go @@ -4,7 +4,7 @@ package discount import ( "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke discount-related APIs. diff --git a/discount/client_test.go b/discount/client_test.go index 06638943f8..557edaa40f 100644 --- a/discount/client_test.go +++ b/discount/client_test.go @@ -4,7 +4,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - _ "github.com/stripe/stripe-go/testing" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestDiscountDel(t *testing.T) { diff --git a/dispute/client.go b/dispute/client.go index d577b7e5c1..071d90ebdb 100644 --- a/dispute/client.go +++ b/dispute/client.go @@ -3,8 +3,8 @@ package dispute import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke dispute-related APIs. diff --git a/dispute/client_test.go b/dispute/client_test.go index 9975053fe8..f306b44fdb 100644 --- a/dispute/client_test.go +++ b/dispute/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestDisputeClose(t *testing.T) { diff --git a/ephemeralkey/client.go b/ephemeralkey/client.go index c727c7c957..0847202f1a 100644 --- a/ephemeralkey/client.go +++ b/ephemeralkey/client.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke /ephemeral_keys APIs. diff --git a/ephemeralkey/client_test.go b/ephemeralkey/client_test.go index 0842e37ffc..38ecd3f54d 100644 --- a/ephemeralkey/client_test.go +++ b/ephemeralkey/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestEphemeralKeyDel(t *testing.T) { diff --git a/event/client.go b/event/client.go index 69209bcde8..f7eb1c35e3 100644 --- a/event/client.go +++ b/event/client.go @@ -4,8 +4,8 @@ package event import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /events APIs. diff --git a/event/client_test.go b/event/client_test.go index f6ab6e1fdf..999649ef15 100644 --- a/event/client_test.go +++ b/event/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestEventGet(t *testing.T) { diff --git a/example_test.go b/example_test.go index 641a57f020..3eb30a9e26 100644 --- a/example_test.go +++ b/example_test.go @@ -3,11 +3,11 @@ package stripe_test import ( "log" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/charge" - "github.com/stripe/stripe-go/customer" - "github.com/stripe/stripe-go/invoice" - "github.com/stripe/stripe-go/plan" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/charge" + "github.com/stripe/stripe-go/v71/customer" + "github.com/stripe/stripe-go/v71/invoice" + "github.com/stripe/stripe-go/v71/plan" ) func ExampleCharge_new() { diff --git a/exchangerate/client.go b/exchangerate/client.go index 8930c12505..1264f41ece 100644 --- a/exchangerate/client.go +++ b/exchangerate/client.go @@ -4,8 +4,8 @@ package exchangerate import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /exchange_rates and exchangerates-related APIs. diff --git a/exchangerate/client_test.go b/exchangerate/client_test.go index fbdc707c08..1333695354 100644 --- a/exchangerate/client_test.go +++ b/exchangerate/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestExchangeRateGet(t *testing.T) { diff --git a/fee/client.go b/fee/client.go index 0d47d5d188..43f34da5a7 100644 --- a/fee/client.go +++ b/fee/client.go @@ -4,8 +4,8 @@ package fee import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke application_fees APIs. diff --git a/fee/client_test.go b/fee/client_test.go index 7e32b35717..2a015d8b92 100644 --- a/fee/client_test.go +++ b/fee/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestApplicationFeeGet(t *testing.T) { diff --git a/feerefund/client.go b/feerefund/client.go index f9a422768c..7b848cd447 100644 --- a/feerefund/client.go +++ b/feerefund/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /application_fees/refunds APIs. diff --git a/feerefund/client_test.go b/feerefund/client_test.go index 0c5b96c2a8..75e7cb2035 100644 --- a/feerefund/client_test.go +++ b/feerefund/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestFeeRefundGet(t *testing.T) { diff --git a/file.go b/file.go index ef04dc0247..fa69ce539e 100644 --- a/file.go +++ b/file.go @@ -8,7 +8,7 @@ import ( "net/url" "path/filepath" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // FilePurpose is the purpose of a particular file. diff --git a/file/client.go b/file/client.go index 11f23d7417..213e17ebde 100644 --- a/file/client.go +++ b/file/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke file APIs. diff --git a/file/client_test.go b/file/client_test.go index 45ba36ac75..f5916310be 100644 --- a/file/client_test.go +++ b/file/client_test.go @@ -16,8 +16,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) const ( diff --git a/filelink/client.go b/filelink/client.go index d130a681b2..d3dd1fa8a5 100644 --- a/filelink/client.go +++ b/filelink/client.go @@ -6,8 +6,8 @@ package filelink import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke APIs related to file links. diff --git a/filelink/client_test.go b/filelink/client_test.go index 1da5504dec..28c9e47bcb 100644 --- a/filelink/client_test.go +++ b/filelink/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestFileLinkGet(t *testing.T) { diff --git a/go.mod b/go.mod new file mode 100644 index 0000000000..9ec6cdcb98 --- /dev/null +++ b/go.mod @@ -0,0 +1,8 @@ +module github.com/stripe/stripe-go/v71 + +go 1.13 + +require ( + github.com/stretchr/testify v1.5.1 + golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000000..55769bb10a --- /dev/null +++ b/go.sum @@ -0,0 +1,18 @@ +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= +github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e h1:3G+cUijn7XD+S4eJFddp53Pv7+slrESplyjG25HgL+k= +golang.org/x/net v0.0.0-20200324143707-d3edc9973b7e/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= diff --git a/invoice.go b/invoice.go index ea67e8bbb5..6b0a6e5544 100644 --- a/invoice.go +++ b/invoice.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // InvoiceLineType is the list of allowed values for the invoice line's type. diff --git a/invoice/client.go b/invoice/client.go index a8d30e322e..4ae850268c 100644 --- a/invoice/client.go +++ b/invoice/client.go @@ -4,8 +4,8 @@ package invoice import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is the client used to invoke /invoices APIs. diff --git a/invoice/client_test.go b/invoice/client_test.go index 18ee151501..ff21478b9f 100644 --- a/invoice/client_test.go +++ b/invoice/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestInvoiceGet(t *testing.T) { diff --git a/invoice_test.go b/invoice_test.go index 748ed25bf3..5d4bf0e0fd 100644 --- a/invoice_test.go +++ b/invoice_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestInvoiceParams_AppendTo(t *testing.T) { diff --git a/invoiceitem/client.go b/invoiceitem/client.go index 410fe3c31c..4d6e3d31b7 100644 --- a/invoiceitem/client.go +++ b/invoiceitem/client.go @@ -4,8 +4,8 @@ package invoiceitem import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /invoiceitems APIs. diff --git a/invoiceitem/client_test.go b/invoiceitem/client_test.go index 04c37627e6..79c6374554 100644 --- a/invoiceitem/client_test.go +++ b/invoiceitem/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestInvoiceItemDel(t *testing.T) { diff --git a/issuing/authorization/client.go b/issuing/authorization/client.go index 71b6c91e84..97ddac4a55 100644 --- a/issuing/authorization/client.go +++ b/issuing/authorization/client.go @@ -6,8 +6,8 @@ package authorization import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /issuing/authorizations APIs. diff --git a/issuing/authorization/client_test.go b/issuing/authorization/client_test.go index 439b318cb8..b0e10264e6 100644 --- a/issuing/authorization/client_test.go +++ b/issuing/authorization/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestIssuingAuthorizationApprove(t *testing.T) { diff --git a/issuing/card/client.go b/issuing/card/client.go index a084fa7142..0124debc67 100644 --- a/issuing/card/client.go +++ b/issuing/card/client.go @@ -6,8 +6,8 @@ package card import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /issuing/cards APIs. diff --git a/issuing/card/client_test.go b/issuing/card/client_test.go index 862a9e6304..dc66f78f7d 100644 --- a/issuing/card/client_test.go +++ b/issuing/card/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestIssuingCardGet(t *testing.T) { diff --git a/issuing/cardholder/client.go b/issuing/cardholder/client.go index f0eb849209..ab1ec7380c 100644 --- a/issuing/cardholder/client.go +++ b/issuing/cardholder/client.go @@ -6,8 +6,8 @@ package cardholder import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /issuing/cardholders APIs. diff --git a/issuing/cardholder/client_test.go b/issuing/cardholder/client_test.go index 26969caf81..3a46a2f291 100644 --- a/issuing/cardholder/client_test.go +++ b/issuing/cardholder/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestIssuingCardholderGet(t *testing.T) { diff --git a/issuing/dispute/client.go b/issuing/dispute/client.go index 14d24bbee0..866374dbad 100644 --- a/issuing/dispute/client.go +++ b/issuing/dispute/client.go @@ -6,8 +6,8 @@ package dispute import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /issuing/disputes APIs. diff --git a/issuing/dispute/client_test.go b/issuing/dispute/client_test.go index a6a942ae8e..cef09a1034 100644 --- a/issuing/dispute/client_test.go +++ b/issuing/dispute/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestIssuingDisputeGet(t *testing.T) { diff --git a/issuing/transaction/client.go b/issuing/transaction/client.go index 85590a9f88..66a0b90e96 100644 --- a/issuing/transaction/client.go +++ b/issuing/transaction/client.go @@ -6,8 +6,8 @@ package transaction import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /issuing/transactions APIs. diff --git a/issuing/transaction/client_test.go b/issuing/transaction/client_test.go index f96a82843d..d4de7e97bc 100644 --- a/issuing/transaction/client_test.go +++ b/issuing/transaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestIssuingTransactionGet(t *testing.T) { diff --git a/iter.go b/iter.go index c11b621f25..4a9fcf3695 100644 --- a/iter.go +++ b/iter.go @@ -3,7 +3,7 @@ package stripe import ( "reflect" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // diff --git a/iter_test.go b/iter_test.go index c09873e165..edba5e7ee4 100644 --- a/iter_test.go +++ b/iter_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestIterEmpty(t *testing.T) { diff --git a/loginlink/client.go b/loginlink/client.go index fa602a1357..7129077556 100644 --- a/loginlink/client.go +++ b/loginlink/client.go @@ -5,7 +5,7 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke /login_links APIs. diff --git a/loginlink/client_test.go b/loginlink/client_test.go index cd059757d7..577be9be2b 100644 --- a/loginlink/client_test.go +++ b/loginlink/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestLoginLinkNew(t *testing.T) { diff --git a/mandate/client.go b/mandate/client.go index dab04c5585..cdc9c8fb4f 100644 --- a/mandate/client.go +++ b/mandate/client.go @@ -4,7 +4,7 @@ package mandate import ( "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke mandates APIs. diff --git a/mandate/client_test.go b/mandate/client_test.go index ab4574c138..b430a82bf8 100644 --- a/mandate/client_test.go +++ b/mandate/client_test.go @@ -4,7 +4,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - _ "github.com/stripe/stripe-go/testing" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestMandateMethodGet(t *testing.T) { diff --git a/oauth/client.go b/oauth/client.go index 23a905695a..4d6f66df1e 100644 --- a/oauth/client.go +++ b/oauth/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /oauth and related APIs. diff --git a/oauth/client_test.go b/oauth/client_test.go index 2d1f68e6a1..a304e298da 100644 --- a/oauth/client_test.go +++ b/oauth/client_test.go @@ -7,8 +7,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestAuthorizeURL(t *testing.T) { diff --git a/order/client.go b/order/client.go index 12d8224173..6400d66292 100644 --- a/order/client.go +++ b/order/client.go @@ -3,8 +3,8 @@ package order import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /orders APIs. diff --git a/order/client_test.go b/order/client_test.go index 78e4567114..43e53503a3 100644 --- a/order/client_test.go +++ b/order/client_test.go @@ -8,8 +8,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestOrderGet(t *testing.T) { diff --git a/order_test.go b/order_test.go index 7b39064ba7..90016aad9f 100644 --- a/order_test.go +++ b/order_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestOrder_UnmarshalJSON(t *testing.T) { diff --git a/orderreturn/client.go b/orderreturn/client.go index e57bf69723..c03bf8dc1e 100644 --- a/orderreturn/client.go +++ b/orderreturn/client.go @@ -3,8 +3,8 @@ package orderreturn import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /orders APIs. diff --git a/orderreturn/client_test.go b/orderreturn/client_test.go index c65d72a72f..38b153f76b 100644 --- a/orderreturn/client_test.go +++ b/orderreturn/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestOrderReturnGet(t *testing.T) { diff --git a/params.go b/params.go index dd782ece74..4667110566 100644 --- a/params.go +++ b/params.go @@ -9,7 +9,7 @@ import ( "net/url" "time" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // diff --git a/params_test.go b/params_test.go index 717d2dfbd3..22e367d6df 100644 --- a/params_test.go +++ b/params_test.go @@ -5,9 +5,9 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" - . "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" + . "github.com/stripe/stripe-go/v71/testing" ) func TestRangeQueryParamsAppendTo(t *testing.T) { diff --git a/paymentintent/client.go b/paymentintent/client.go index f428f2ef7f..9b5f178a23 100644 --- a/paymentintent/client.go +++ b/paymentintent/client.go @@ -6,8 +6,8 @@ package paymentintent import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke APIs related to payment intents. diff --git a/paymentintent/client_test.go b/paymentintent/client_test.go index 2153d8e878..26d04a52a5 100644 --- a/paymentintent/client_test.go +++ b/paymentintent/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestPaymentIntentCancel(t *testing.T) { diff --git a/paymentmethod/client.go b/paymentmethod/client.go index 0888ec57ab..60e5f84bd6 100644 --- a/paymentmethod/client.go +++ b/paymentmethod/client.go @@ -4,8 +4,8 @@ package paymentmethod import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke pms APIs. diff --git a/paymentmethod/client_test.go b/paymentmethod/client_test.go index e0d4a6c7ae..3535bf1060 100644 --- a/paymentmethod/client_test.go +++ b/paymentmethod/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestPaymentMethodAttach(t *testing.T) { diff --git a/paymentsource.go b/paymentsource.go index 4e00ce6046..2cf028d8a7 100644 --- a/paymentsource.go +++ b/paymentsource.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // PaymentSourceType consts represent valid payment sources. diff --git a/paymentsource/client.go b/paymentsource/client.go index 55d710045c..9a745e050a 100644 --- a/paymentsource/client.go +++ b/paymentsource/client.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /sources APIs. diff --git a/paymentsource/client_test.go b/paymentsource/client_test.go index 9b683ae240..27918c266f 100644 --- a/paymentsource/client_test.go +++ b/paymentsource/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSourceGet(t *testing.T) { diff --git a/paymentsource_test.go b/paymentsource_test.go index 7928ca53d1..0c10727939 100644 --- a/paymentsource_test.go +++ b/paymentsource_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestSourceParams_AppendTo(t *testing.T) { diff --git a/payout/client.go b/payout/client.go index bebfa580eb..71e7b00ebd 100644 --- a/payout/client.go +++ b/payout/client.go @@ -4,8 +4,8 @@ package payout import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /payouts APIs. diff --git a/payout/client_test.go b/payout/client_test.go index ed4554a3e8..efc54ebc64 100644 --- a/payout/client_test.go +++ b/payout/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestPayoutCancel(t *testing.T) { diff --git a/person/client.go b/person/client.go index 49617286a5..8f09b0c7ca 100644 --- a/person/client.go +++ b/person/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /accounts/persons APIs. diff --git a/person/client_test.go b/person/client_test.go index e572eb4da3..1497442488 100644 --- a/person/client_test.go +++ b/person/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestPersonDel(t *testing.T) { diff --git a/plan.go b/plan.go index d8aae7fb0d..91e2f4f6d4 100644 --- a/plan.go +++ b/plan.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strconv" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // PlanInterval is the list of allowed values for a plan's interval. diff --git a/plan/client.go b/plan/client.go index 4df0c60104..15e9ae4aa5 100644 --- a/plan/client.go +++ b/plan/client.go @@ -4,8 +4,8 @@ package plan import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /plans APIs. diff --git a/plan/client_test.go b/plan/client_test.go index dd05e70345..c64fdd374f 100644 --- a/plan/client_test.go +++ b/plan/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestPlanDel(t *testing.T) { diff --git a/plan_test.go b/plan_test.go index 2855fbfaed..cbb0b7ee2c 100644 --- a/plan_test.go +++ b/plan_test.go @@ -6,7 +6,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestPlan_Unmarshal(t *testing.T) { diff --git a/product/client.go b/product/client.go index 9c0dfd5c67..a65e07c691 100644 --- a/product/client.go +++ b/product/client.go @@ -3,8 +3,8 @@ package product import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /products APIs. diff --git a/product/client_test.go b/product/client_test.go index d0c191a1a8..9d22572891 100644 --- a/product/client_test.go +++ b/product/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestProductDel(t *testing.T) { diff --git a/radar/earlyfraudwarning/client.go b/radar/earlyfraudwarning/client.go index a782f05136..46699de92f 100644 --- a/radar/earlyfraudwarning/client.go +++ b/radar/earlyfraudwarning/client.go @@ -7,8 +7,8 @@ package earlyfraudwarning import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to interact with the /radar/early_fraud_warnings API. diff --git a/radar/earlyfraudwarning/client_test.go b/radar/earlyfraudwarning/client_test.go index 3f4ae08b6d..cd8ec12ce1 100644 --- a/radar/earlyfraudwarning/client_test.go +++ b/radar/earlyfraudwarning/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestRadarEarlyFraudWarningGet(t *testing.T) { diff --git a/radar/valuelist/client.go b/radar/valuelist/client.go index f2d3f40eb0..b9de9ab0be 100644 --- a/radar/valuelist/client.go +++ b/radar/valuelist/client.go @@ -6,8 +6,8 @@ package valuelist import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /radar/value_lists APIs. diff --git a/radar/valuelist/client_test.go b/radar/valuelist/client_test.go index de4116db70..1e61a799b6 100644 --- a/radar/valuelist/client_test.go +++ b/radar/valuelist/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestRadarValueListDel(t *testing.T) { diff --git a/radar/valuelistitem/client.go b/radar/valuelistitem/client.go index 66408f6c7b..c21efee6c0 100644 --- a/radar/valuelistitem/client.go +++ b/radar/valuelistitem/client.go @@ -6,8 +6,8 @@ package valuelistitem import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /radar/value_list_items APIs. diff --git a/radar/valuelistitem/client_test.go b/radar/valuelistitem/client_test.go index f3c4e567d9..c0d4204f15 100644 --- a/radar/valuelistitem/client_test.go +++ b/radar/valuelistitem/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestRadarValueListItemDel(t *testing.T) { diff --git a/recipient.go b/recipient.go index fa9df140de..0b68e59d16 100644 --- a/recipient.go +++ b/recipient.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // RecipientType is the list of allowed values for the recipient's type. diff --git a/recipient/client.go b/recipient/client.go index 35ba3080fd..29df4b2529 100644 --- a/recipient/client.go +++ b/recipient/client.go @@ -4,8 +4,8 @@ package recipient import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /recipients APIs. diff --git a/recipient/client_test.go b/recipient/client_test.go index 92b683eb6a..a861881e07 100644 --- a/recipient/client_test.go +++ b/recipient/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestRecipientDel(t *testing.T) { diff --git a/recipient_test.go b/recipient_test.go index e9184ca01c..e2798e234c 100644 --- a/recipient_test.go +++ b/recipient_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestRecipientParams_AppendTo(t *testing.T) { diff --git a/refund/client.go b/refund/client.go index 1d0084422f..7bb02422c7 100644 --- a/refund/client.go +++ b/refund/client.go @@ -4,8 +4,8 @@ package refund import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /refunds APIs. diff --git a/refund/client_test.go b/refund/client_test.go index d54b12a330..aadfc24215 100644 --- a/refund/client_test.go +++ b/refund/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestRefundGet(t *testing.T) { diff --git a/reporting/reportrun/client.go b/reporting/reportrun/client.go index c4150823e5..d99bebe99b 100644 --- a/reporting/reportrun/client.go +++ b/reporting/reportrun/client.go @@ -6,8 +6,8 @@ package reportrun import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /reporting/report_runs APIs. diff --git a/reporting/reportrun/client_test.go b/reporting/reportrun/client_test.go index 9815327176..0fd8a75491 100644 --- a/reporting/reportrun/client_test.go +++ b/reporting/reportrun/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestReportRunGet(t *testing.T) { diff --git a/reporting/reporttype/client.go b/reporting/reporttype/client.go index 05946a8d40..650c54660d 100644 --- a/reporting/reporttype/client.go +++ b/reporting/reporttype/client.go @@ -6,8 +6,8 @@ package reporttype import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /reporting/report_types APIs. diff --git a/reporting/reporttype/client_test.go b/reporting/reporttype/client_test.go index 42784a1aac..7e14f5f040 100644 --- a/reporting/reporttype/client_test.go +++ b/reporting/reporttype/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestReportTestGet(t *testing.T) { diff --git a/reversal/client.go b/reversal/client.go index be5ab28bfd..b0b6a9d90d 100644 --- a/reversal/client.go +++ b/reversal/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /transfers/reversals APIs. diff --git a/reversal/client_test.go b/reversal/client_test.go index 3fa10badc8..aa8ef0a043 100644 --- a/reversal/client_test.go +++ b/reversal/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestReversalGet(t *testing.T) { diff --git a/review/client.go b/review/client.go index fb42feb2a5..ce9cef0e8b 100644 --- a/review/client.go +++ b/review/client.go @@ -4,8 +4,8 @@ package review import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /reviews APIs. diff --git a/review/client_test.go b/review/client_test.go index 2f4e2c0a92..5732449eea 100644 --- a/review/client_test.go +++ b/review/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestReviewApprove(t *testing.T) { diff --git a/scripts/check_api_clients/main.go b/scripts/check_api_clients/main.go index 29c9082924..8e66d68f3b 100644 --- a/scripts/check_api_clients/main.go +++ b/scripts/check_api_clients/main.go @@ -12,6 +12,7 @@ import ( "io/ioutil" "os" "path/filepath" + "regexp" "sort" "strings" ) @@ -204,6 +205,11 @@ func getClientAPIPackages(fset *token.FileSet) (map[string]struct{}, error) { return nil, err } + // Regular expression that targets just the last segment(s) of the package + // path like `coupon` or `issuing/card`. Note that double quotes on either + // side are also stripped. + packagePathRE := regexp.MustCompile(`"github.com/stripe/stripe-go/v[0-9]+/(.*)"`) + // First we need to make a map of any packages that are being imported // in ways that don't map perfectly well with the package paths that we'll // extract by looking for clients in `.go` files. @@ -222,13 +228,9 @@ func getClientAPIPackages(fset *token.FileSet) (map[string]struct{}, error) { for _, importSpec := range f.Imports { path := importSpec.Path.Value - // The import path is quoted, so trim quotes off either ended. - path = strings.TrimPrefix(path, `"`) - path = strings.TrimSuffix(path, `"`) - - // Trim the fully qualified prefix off the front of the path to make - // translation easier for us after. - path = strings.TrimPrefix(path, "github.com/stripe/stripe-go/") + // Trim to just the last segment(s) of the package path like `coupon` + // or `issuing/card`. + path = packagePathRE.ReplaceAllString(path, "$1") // A non-nil `Name` is an alias. Save the alias to our map with the // relative package path. diff --git a/setupintent/client.go b/setupintent/client.go index c051c0e4ce..ca53282d08 100644 --- a/setupintent/client.go +++ b/setupintent/client.go @@ -6,8 +6,8 @@ package setupintent import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke APIs related to setup intents. diff --git a/setupintent/client_test.go b/setupintent/client_test.go index 61d268e2f2..16cd9838f0 100644 --- a/setupintent/client_test.go +++ b/setupintent/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSetupIntentCancel(t *testing.T) { diff --git a/sigma/scheduledqueryrun/client.go b/sigma/scheduledqueryrun/client.go index 06e8eaac97..4bd6a086ef 100644 --- a/sigma/scheduledqueryrun/client.go +++ b/sigma/scheduledqueryrun/client.go @@ -6,8 +6,8 @@ package scheduledqueryrun import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /sigma/scheduled_query_runs APIs. diff --git a/sigma/scheduledqueryrun/client_test.go b/sigma/scheduledqueryrun/client_test.go index 9d87b781a6..79454ff26d 100644 --- a/sigma/scheduledqueryrun/client_test.go +++ b/sigma/scheduledqueryrun/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSigmaScheduledQueryRunGet(t *testing.T) { diff --git a/sku/client.go b/sku/client.go index 961914aa5a..c3d91c6e84 100644 --- a/sku/client.go +++ b/sku/client.go @@ -3,8 +3,8 @@ package sku import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /skus APIs. diff --git a/sku/client_test.go b/sku/client_test.go index ec7aaecc18..3d062cf6f6 100644 --- a/sku/client_test.go +++ b/sku/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSKUDel(t *testing.T) { diff --git a/source.go b/source.go index fd797caa21..3ef88a4b29 100644 --- a/source.go +++ b/source.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // SourceCodeVerificationFlowStatus represents the possible statuses of a code verification flow. diff --git a/source/client.go b/source/client.go index ea043b773c..52a9aea15e 100644 --- a/source/client.go +++ b/source/client.go @@ -4,7 +4,7 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke /sources APIs. diff --git a/source/client_test.go b/source/client_test.go index 9fad7e22ed..95bc136a1e 100644 --- a/source/client_test.go +++ b/source/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSourceGet(t *testing.T) { diff --git a/source_test.go b/source_test.go index 1302767001..51d4991f82 100644 --- a/source_test.go +++ b/source_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestSourceObjectParams_AppendTo(t *testing.T) { diff --git a/sourcetransaction/client.go b/sourcetransaction/client.go index 989cdce484..cc35593e1e 100644 --- a/sourcetransaction/client.go +++ b/sourcetransaction/client.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /sources/:source_id/transactions APIs. diff --git a/sourcetransaction/client_test.go b/sourcetransaction/client_test.go index b0ad674c04..a07095a2ac 100644 --- a/sourcetransaction/client_test.go +++ b/sourcetransaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSourceTransactionList(t *testing.T) { diff --git a/stripe.go b/stripe.go index 924260918d..5e9eb33e94 100644 --- a/stripe.go +++ b/stripe.go @@ -19,7 +19,7 @@ import ( "sync" "time" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // diff --git a/sub.go b/sub.go index abb9c0e286..8ee36b7eba 100644 --- a/sub.go +++ b/sub.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // SubscriptionStatus is the list of allowed values for the subscription's status. diff --git a/sub/client.go b/sub/client.go index a27dd74606..b8007070f0 100644 --- a/sub/client.go +++ b/sub/client.go @@ -4,8 +4,8 @@ package sub import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /subscriptions APIs. diff --git a/sub/client_test.go b/sub/client_test.go index 53bcf82854..de414013ab 100644 --- a/sub/client_test.go +++ b/sub/client_test.go @@ -5,8 +5,8 @@ import ( "time" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSubscriptionCancel(t *testing.T) { diff --git a/sub_test.go b/sub_test.go index 5d70db29c5..e9823e4cca 100644 --- a/sub_test.go +++ b/sub_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestSubscriptionParams_AppendTo(t *testing.T) { diff --git a/subitem/client.go b/subitem/client.go index ac4f3c3cb6..1171232c0e 100644 --- a/subitem/client.go +++ b/subitem/client.go @@ -4,8 +4,8 @@ package subitem import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /subscriptions APIs. diff --git a/subitem/client_test.go b/subitem/client_test.go index 558328c6a0..fdc3ba4022 100644 --- a/subitem/client_test.go +++ b/subitem/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSubscriptionItemDel(t *testing.T) { diff --git a/subschedule.go b/subschedule.go index 2d09fe353d..cd2326919a 100644 --- a/subschedule.go +++ b/subschedule.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) // SubscriptionScheduleEndBehavior describe what happens to a schedule when it ends. diff --git a/subschedule/client.go b/subschedule/client.go index 933d0c85be..8ff174c5e5 100644 --- a/subschedule/client.go +++ b/subschedule/client.go @@ -4,8 +4,8 @@ package subschedule import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /subscription_schedules APIs. diff --git a/subschedule/client_test.go b/subschedule/client_test.go index 8322c19c5c..b08283c765 100644 --- a/subschedule/client_test.go +++ b/subschedule/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestSubscriptionScheduleCancel(t *testing.T) { diff --git a/subschedule_test.go b/subschedule_test.go index 78e62bacc0..438d324bea 100644 --- a/subschedule_test.go +++ b/subschedule_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestSubscriptionScheduleParams_AppendTo(t *testing.T) { diff --git a/taxid/client.go b/taxid/client.go index bc21f0047b..cea4d682e0 100644 --- a/taxid/client.go +++ b/taxid/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /tax_ids APIs. diff --git a/taxid/client_test.go b/taxid/client_test.go index 04199761e8..124054894a 100644 --- a/taxid/client_test.go +++ b/taxid/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestTaxIDDel(t *testing.T) { diff --git a/taxrate/client.go b/taxrate/client.go index f8b694c6ac..9ac1b95298 100644 --- a/taxrate/client.go +++ b/taxrate/client.go @@ -4,8 +4,8 @@ package taxrate import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /tax_rates APIs. diff --git a/taxrate/client_test.go b/taxrate/client_test.go index 86136f8324..2243359d30 100644 --- a/taxrate/client_test.go +++ b/taxrate/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestTaxRateGet(t *testing.T) { diff --git a/terminal/connectiontoken/client.go b/terminal/connectiontoken/client.go index d4862212fc..5019a8fa60 100644 --- a/terminal/connectiontoken/client.go +++ b/terminal/connectiontoken/client.go @@ -4,7 +4,7 @@ package connectiontoken import ( "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke /terminal/connection_tokens APIs. diff --git a/terminal/connectiontoken/client_test.go b/terminal/connectiontoken/client_test.go index 06fe7b3460..b6891e318f 100644 --- a/terminal/connectiontoken/client_test.go +++ b/terminal/connectiontoken/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestTerminalConnectionTokenNew(t *testing.T) { diff --git a/terminal/location/client.go b/terminal/location/client.go index ef479868a0..d211c78e84 100644 --- a/terminal/location/client.go +++ b/terminal/location/client.go @@ -4,8 +4,8 @@ package location import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invokte /terminal/locations APIs diff --git a/terminal/location/client_test.go b/terminal/location/client_test.go index 986257d72d..bd6d01401a 100644 --- a/terminal/location/client_test.go +++ b/terminal/location/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestTerminalLocationDel(t *testing.T) { diff --git a/terminal/reader/client.go b/terminal/reader/client.go index d757a54014..1c10316ae8 100644 --- a/terminal/reader/client.go +++ b/terminal/reader/client.go @@ -4,8 +4,8 @@ package reader import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /terminal/readers APIs. diff --git a/terminal/reader/client_test.go b/terminal/reader/client_test.go index babb69e566..3f004bb62e 100644 --- a/terminal/reader/client_test.go +++ b/terminal/reader/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestTerminalReaderDel(t *testing.T) { diff --git a/testing/testing.go b/testing/testing.go index f85d4b702c..a1aa8d9add 100644 --- a/testing/testing.go +++ b/testing/testing.go @@ -8,8 +8,8 @@ import ( "strconv" "strings" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" "golang.org/x/net/http2" ) diff --git a/threedsecure/client.go b/threedsecure/client.go index 16a5769696..0cfa789c82 100644 --- a/threedsecure/client.go +++ b/threedsecure/client.go @@ -7,7 +7,7 @@ package threedsecure import ( "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke /3d_secure APIs. diff --git a/threedsecure/client_test.go b/threedsecure/client_test.go index 4af2e2a79c..7238bb7741 100644 --- a/threedsecure/client_test.go +++ b/threedsecure/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestThreeDSecureGet(t *testing.T) { diff --git a/token/client.go b/token/client.go index 9382373b2c..d1c826165a 100644 --- a/token/client.go +++ b/token/client.go @@ -4,7 +4,7 @@ package token import ( "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke /tokens APIs. diff --git a/token/client_test.go b/token/client_test.go index b9e4704280..d21f0f2416 100644 --- a/token/client_test.go +++ b/token/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestTokenGet(t *testing.T) { diff --git a/topup/client.go b/topup/client.go index f71a420ede..9bdc849324 100644 --- a/topup/client.go +++ b/topup/client.go @@ -3,8 +3,8 @@ package topup import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /topups APIs. diff --git a/topup/client_test.go b/topup/client_test.go index 7ed4949dd1..e4ed77cd59 100644 --- a/topup/client_test.go +++ b/topup/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestTopupCancel(t *testing.T) { diff --git a/transfer/client.go b/transfer/client.go index e9ae0303e0..723ccda595 100644 --- a/transfer/client.go +++ b/transfer/client.go @@ -4,8 +4,8 @@ package transfer import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /transfers APIs. diff --git a/transfer/client_test.go b/transfer/client_test.go index 59d0357f82..21fb6d0859 100644 --- a/transfer/client_test.go +++ b/transfer/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestTransferGet(t *testing.T) { diff --git a/usagerecord/client.go b/usagerecord/client.go index f06208bad3..cbb73f6174 100644 --- a/usagerecord/client.go +++ b/usagerecord/client.go @@ -4,7 +4,7 @@ package usagerecord import ( "net/http" - stripe "github.com/stripe/stripe-go" + stripe "github.com/stripe/stripe-go/v71" ) // Client is used to invoke APIs related to usage records. diff --git a/usagerecord/client_test.go b/usagerecord/client_test.go index 9ed13fc9a1..8c295b5efd 100644 --- a/usagerecord/client_test.go +++ b/usagerecord/client_test.go @@ -5,8 +5,8 @@ import ( "time" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestUsageRecordNew(t *testing.T) { diff --git a/usagerecord_test.go b/usagerecord_test.go index 728a5c4b84..92866d205c 100644 --- a/usagerecord_test.go +++ b/usagerecord_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/form" + "github.com/stripe/stripe-go/v71/form" ) func TestUsageRecordParams_AppendTo(t *testing.T) { diff --git a/usagerecordsummary/client.go b/usagerecordsummary/client.go index 783451bd60..70632cda9f 100644 --- a/usagerecordsummary/client.go +++ b/usagerecordsummary/client.go @@ -4,8 +4,8 @@ package usagerecordsummary import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke APIs related to usage record summaries. diff --git a/usagerecordsummary/client_test.go b/usagerecordsummary/client_test.go index 7686730d5f..5bc0a1c27b 100644 --- a/usagerecordsummary/client_test.go +++ b/usagerecordsummary/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestUsageRecordSummaryList(t *testing.T) { diff --git a/webhook/client.go b/webhook/client.go index 51b414f8ac..a6c8a82d48 100644 --- a/webhook/client.go +++ b/webhook/client.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "github.com/stripe/stripe-go" + "github.com/stripe/stripe-go/v71" ) // diff --git a/webhook/client_handler_test.go b/webhook/client_handler_test.go index ef692d27a6..712378f5c8 100644 --- a/webhook/client_handler_test.go +++ b/webhook/client_handler_test.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/stripe/stripe-go/webhook" + "github.com/stripe/stripe-go/v71/webhook" ) func Example() { diff --git a/webhookendpoint/client.go b/webhookendpoint/client.go index a808dc9478..f85cb84867 100644 --- a/webhookendpoint/client.go +++ b/webhookendpoint/client.go @@ -4,8 +4,8 @@ package webhookendpoint import ( "net/http" - stripe "github.com/stripe/stripe-go" - "github.com/stripe/stripe-go/form" + stripe "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/form" ) // Client is used to invoke /webhook_endpoints APIs. diff --git a/webhookendpoint/client_test.go b/webhookendpoint/client_test.go index 7dd463709e..f151ba4ce4 100644 --- a/webhookendpoint/client_test.go +++ b/webhookendpoint/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go" - _ "github.com/stripe/stripe-go/testing" + stripe "github.com/stripe/stripe-go/v71" + _ "github.com/stripe/stripe-go/v71/testing" ) func TestWebhookEndpointDel(t *testing.T) { From e3934e75071a04659edf8b8e9a102138054466fb Mon Sep 17 00:00:00 2001 From: Brandur Date: Fri, 10 Apr 2020 14:35:12 -0700 Subject: [PATCH 5/8] Change v71 back to v70 Move back down to current major version so that we can test that our release script will bump it to v71 properly when the time comes. --- README.md | 24 ++-- account.go | 2 +- account/client.go | 4 +- account/client_test.go | 4 +- account_test.go | 2 +- accountlink/client.go | 2 +- accountlink/client_test.go | 4 +- applepaydomain/client.go | 4 +- applepaydomain/client_test.go | 4 +- balance/client.go | 2 +- balance/client_test.go | 2 +- balancetransaction/client.go | 4 +- balancetransaction/client_test.go | 4 +- bankaccount.go | 2 +- bankaccount/client.go | 4 +- bankaccount/client_test.go | 4 +- bankaccount_test.go | 2 +- bitcoinreceiver/client.go | 4 +- bitcoinreceiver/client_test.go | 4 +- bitcointransaction/client.go | 4 +- bitcointransaction/client_test.go | 4 +- capability/client.go | 4 +- capability/client_test.go | 4 +- card.go | 2 +- card/client.go | 4 +- card/client_test.go | 4 +- card_test.go | 2 +- charge/client.go | 4 +- charge/client_test.go | 4 +- charge_test.go | 2 +- checkout/session/client.go | 4 +- checkout/session/client_test.go | 4 +- client/api.go | 150 +++++++++++----------- countryspec/client.go | 4 +- countryspec/client_test.go | 4 +- coupon/client.go | 4 +- coupon/client_test.go | 4 +- creditnote/client.go | 4 +- creditnote/client_test.go | 4 +- customer/client.go | 4 +- customer/client_test.go | 4 +- customerbalancetransaction/client.go | 4 +- customerbalancetransaction/client_test.go | 4 +- discount/client.go | 2 +- discount/client_test.go | 2 +- dispute/client.go | 4 +- dispute/client_test.go | 4 +- ephemeralkey/client.go | 2 +- ephemeralkey/client_test.go | 4 +- event/client.go | 4 +- event/client_test.go | 4 +- example_test.go | 10 +- exchangerate/client.go | 4 +- exchangerate/client_test.go | 4 +- fee/client.go | 4 +- fee/client_test.go | 4 +- feerefund/client.go | 4 +- feerefund/client_test.go | 4 +- file.go | 2 +- file/client.go | 4 +- file/client_test.go | 4 +- filelink/client.go | 4 +- filelink/client_test.go | 4 +- go.mod | 2 +- invoice.go | 2 +- invoice/client.go | 4 +- invoice/client_test.go | 4 +- invoice_test.go | 2 +- invoiceitem/client.go | 4 +- invoiceitem/client_test.go | 4 +- issuing/authorization/client.go | 4 +- issuing/authorization/client_test.go | 4 +- issuing/card/client.go | 4 +- issuing/card/client_test.go | 4 +- issuing/cardholder/client.go | 4 +- issuing/cardholder/client_test.go | 4 +- issuing/dispute/client.go | 4 +- issuing/dispute/client_test.go | 4 +- issuing/transaction/client.go | 4 +- issuing/transaction/client_test.go | 4 +- iter.go | 2 +- iter_test.go | 2 +- loginlink/client.go | 2 +- loginlink/client_test.go | 4 +- mandate/client.go | 2 +- mandate/client_test.go | 2 +- oauth/client.go | 4 +- oauth/client_test.go | 4 +- order/client.go | 4 +- order/client_test.go | 4 +- order_test.go | 2 +- orderreturn/client.go | 4 +- orderreturn/client_test.go | 4 +- params.go | 2 +- params_test.go | 6 +- paymentintent/client.go | 4 +- paymentintent/client_test.go | 4 +- paymentmethod/client.go | 4 +- paymentmethod/client_test.go | 4 +- paymentsource.go | 2 +- paymentsource/client.go | 4 +- paymentsource/client_test.go | 4 +- paymentsource_test.go | 2 +- payout/client.go | 4 +- payout/client_test.go | 4 +- person/client.go | 4 +- person/client_test.go | 4 +- plan.go | 2 +- plan/client.go | 4 +- plan/client_test.go | 4 +- plan_test.go | 2 +- product/client.go | 4 +- product/client_test.go | 4 +- radar/earlyfraudwarning/client.go | 4 +- radar/earlyfraudwarning/client_test.go | 4 +- radar/valuelist/client.go | 4 +- radar/valuelist/client_test.go | 4 +- radar/valuelistitem/client.go | 4 +- radar/valuelistitem/client_test.go | 4 +- recipient.go | 2 +- recipient/client.go | 4 +- recipient/client_test.go | 4 +- recipient_test.go | 2 +- refund/client.go | 4 +- refund/client_test.go | 4 +- reporting/reportrun/client.go | 4 +- reporting/reportrun/client_test.go | 4 +- reporting/reporttype/client.go | 4 +- reporting/reporttype/client_test.go | 4 +- reversal/client.go | 4 +- reversal/client_test.go | 4 +- review/client.go | 4 +- review/client_test.go | 4 +- setupintent/client.go | 4 +- setupintent/client_test.go | 4 +- sigma/scheduledqueryrun/client.go | 4 +- sigma/scheduledqueryrun/client_test.go | 4 +- sku/client.go | 4 +- sku/client_test.go | 4 +- source.go | 2 +- source/client.go | 2 +- source/client_test.go | 4 +- source_test.go | 2 +- sourcetransaction/client.go | 4 +- sourcetransaction/client_test.go | 4 +- stripe.go | 2 +- sub.go | 2 +- sub/client.go | 4 +- sub/client_test.go | 4 +- sub_test.go | 2 +- subitem/client.go | 4 +- subitem/client_test.go | 4 +- subschedule.go | 2 +- subschedule/client.go | 4 +- subschedule/client_test.go | 4 +- subschedule_test.go | 2 +- taxid/client.go | 4 +- taxid/client_test.go | 4 +- taxrate/client.go | 4 +- taxrate/client_test.go | 4 +- terminal/connectiontoken/client.go | 2 +- terminal/connectiontoken/client_test.go | 4 +- terminal/location/client.go | 4 +- terminal/location/client_test.go | 4 +- terminal/reader/client.go | 4 +- terminal/reader/client_test.go | 4 +- testing/testing.go | 4 +- threedsecure/client.go | 2 +- threedsecure/client_test.go | 4 +- token/client.go | 2 +- token/client_test.go | 4 +- topup/client.go | 4 +- topup/client_test.go | 4 +- transfer/client.go | 4 +- transfer/client_test.go | 4 +- usagerecord/client.go | 2 +- usagerecord/client_test.go | 4 +- usagerecord_test.go | 2 +- usagerecordsummary/client.go | 4 +- usagerecordsummary/client_test.go | 4 +- webhook/client.go | 2 +- webhook/client_handler_test.go | 2 +- webhookendpoint/client.go | 4 +- webhookendpoint/client_test.go | 4 +- 184 files changed, 410 insertions(+), 410 deletions(-) diff --git a/README.md b/README.md index 5fe4bd747e..0afd3d49fa 100644 --- a/README.md +++ b/README.md @@ -18,8 +18,8 @@ Then, import it using: ``` go import ( - "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/customer" + "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/customer" ) ``` @@ -109,8 +109,8 @@ To use a key, pass it to `API`'s `Init` function: ```go import ( - "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/client" + "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/client" ) stripe := &client.API{} @@ -131,8 +131,8 @@ import ( "google.golang.org/appengine" "google.golang.org/appengine/urlfetch" - "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/client" + "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/client" ) func handler(w http.ResponseWriter, r *http.Request) { @@ -166,8 +166,8 @@ client. ```go import ( - "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/$resource$" + "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/$resource$" ) // Setup @@ -206,8 +206,8 @@ individual key. ```go import ( - "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/client" + "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/client" ) // Setup @@ -244,8 +244,8 @@ problem by configuring the maximum number of retries: ```go import ( - "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/client" + "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/client" ) config := &stripe.BackendConfig{ diff --git a/account.go b/account.go index 8551878e4d..d791fd8576 100644 --- a/account.go +++ b/account.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // AccountType is the type of an account. diff --git a/account/client.go b/account/client.go index 847a6db361..d8eca5fc49 100644 --- a/account/client.go +++ b/account/client.go @@ -6,8 +6,8 @@ package account import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke APIs related to accounts. diff --git a/account/client_test.go b/account/client_test.go index a36af408bc..ed18691218 100644 --- a/account/client_test.go +++ b/account/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestAccountDel(t *testing.T) { diff --git a/account_test.go b/account_test.go index 6518a6bfc1..f7b0cb07fe 100644 --- a/account_test.go +++ b/account_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestAccountExternalAccountParams_AppendTo(t *testing.T) { diff --git a/accountlink/client.go b/accountlink/client.go index 930d068931..644d6c8b0f 100644 --- a/accountlink/client.go +++ b/accountlink/client.go @@ -6,7 +6,7 @@ package accountlink import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke APIs related to account links. diff --git a/accountlink/client_test.go b/accountlink/client_test.go index 4a4f3fb600..943e9c4933 100644 --- a/accountlink/client_test.go +++ b/accountlink/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestAccountLinkNew(t *testing.T) { diff --git a/applepaydomain/client.go b/applepaydomain/client.go index eac3c74f22..b67e20888a 100644 --- a/applepaydomain/client.go +++ b/applepaydomain/client.go @@ -4,8 +4,8 @@ package applepaydomain import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /apple_pay/domains and Apple Pay domain-related APIs. diff --git a/applepaydomain/client_test.go b/applepaydomain/client_test.go index a52fde46fa..194b367a47 100644 --- a/applepaydomain/client_test.go +++ b/applepaydomain/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestApplePayDomainDel(t *testing.T) { diff --git a/balance/client.go b/balance/client.go index 97fd9484c8..d5aa8d0a42 100644 --- a/balance/client.go +++ b/balance/client.go @@ -4,7 +4,7 @@ package balance import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke /balance and transaction-related APIs. diff --git a/balance/client_test.go b/balance/client_test.go index cd802f06ca..d1faa39825 100644 --- a/balance/client_test.go +++ b/balance/client_test.go @@ -4,7 +4,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - _ "github.com/stripe/stripe-go/v71/testing" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestBalanceGet(t *testing.T) { diff --git a/balancetransaction/client.go b/balancetransaction/client.go index 8004fa107a..14bce81ad3 100644 --- a/balancetransaction/client.go +++ b/balancetransaction/client.go @@ -4,8 +4,8 @@ package balancetransaction import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /balance_transactions APIs. diff --git a/balancetransaction/client_test.go b/balancetransaction/client_test.go index 6222f129a5..52590073c3 100644 --- a/balancetransaction/client_test.go +++ b/balancetransaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestBalanceTransactionGet(t *testing.T) { diff --git a/bankaccount.go b/bankaccount.go index b3503ec27a..21fe29c947 100644 --- a/bankaccount.go +++ b/bankaccount.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strconv" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // BankAccountStatus is the list of allowed values for the bank account's status. diff --git a/bankaccount/client.go b/bankaccount/client.go index 534ef1d74b..07521df1c2 100644 --- a/bankaccount/client.go +++ b/bankaccount/client.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /bank_accounts APIs. diff --git a/bankaccount/client_test.go b/bankaccount/client_test.go index e9321f9404..5efe5ad646 100644 --- a/bankaccount/client_test.go +++ b/bankaccount/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestBankAccountDel_ByAccount(t *testing.T) { diff --git a/bankaccount_test.go b/bankaccount_test.go index 4451309411..3934586d30 100644 --- a/bankaccount_test.go +++ b/bankaccount_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestBankAccount_UnmarshalJSON(t *testing.T) { diff --git a/bitcoinreceiver/client.go b/bitcoinreceiver/client.go index 6733bdebd1..4b3061f05b 100644 --- a/bitcoinreceiver/client.go +++ b/bitcoinreceiver/client.go @@ -7,8 +7,8 @@ package bitcoinreceiver import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /bitcoin/receivers APIs. diff --git a/bitcoinreceiver/client_test.go b/bitcoinreceiver/client_test.go index 70897d4772..6e97a53a31 100644 --- a/bitcoinreceiver/client_test.go +++ b/bitcoinreceiver/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestBitcoinReceiverGet(t *testing.T) { diff --git a/bitcointransaction/client.go b/bitcointransaction/client.go index 367c449413..95405e2ce9 100644 --- a/bitcointransaction/client.go +++ b/bitcointransaction/client.go @@ -4,8 +4,8 @@ package bitcointransaction import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /bitcoin/receivers/:receiver_id/transactions APIs. diff --git a/bitcointransaction/client_test.go b/bitcointransaction/client_test.go index 6b286e7231..bdee867f95 100644 --- a/bitcointransaction/client_test.go +++ b/bitcointransaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestBitcoinTransactionList(t *testing.T) { diff --git a/capability/client.go b/capability/client.go index e9dd476326..b3cd69e85c 100644 --- a/capability/client.go +++ b/capability/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /accounts/capabilities APIs. diff --git a/capability/client_test.go b/capability/client_test.go index ae95acd39d..5c87ad6de6 100644 --- a/capability/client_test.go +++ b/capability/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestCapabilityGet(t *testing.T) { diff --git a/card.go b/card.go index ffb87c3dfb..d503ed5efb 100644 --- a/card.go +++ b/card.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strconv" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // CardAvailablePayoutMethod is a set of available payout methods for the card. diff --git a/card/client.go b/card/client.go index d108c70d96..5eeac07a83 100644 --- a/card/client.go +++ b/card/client.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /cards APIs. diff --git a/card/client_test.go b/card/client_test.go index a8fe3c2ba6..4a40a1622e 100644 --- a/card/client_test.go +++ b/card/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestCardDel(t *testing.T) { diff --git a/card_test.go b/card_test.go index bb401f8a64..a222d8c53d 100644 --- a/card_test.go +++ b/card_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestCardListParams_AppendTo(t *testing.T) { diff --git a/charge/client.go b/charge/client.go index 7046ab3136..242b7e8a52 100644 --- a/charge/client.go +++ b/charge/client.go @@ -6,8 +6,8 @@ package charge import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke APIs related to charges. diff --git a/charge/client_test.go b/charge/client_test.go index 0bf690c595..91407a4e73 100644 --- a/charge/client_test.go +++ b/charge/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestChargeCapture(t *testing.T) { diff --git a/charge_test.go b/charge_test.go index 24c67765f0..c78a396f4a 100644 --- a/charge_test.go +++ b/charge_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestCharge_UnmarshalJSON(t *testing.T) { diff --git a/checkout/session/client.go b/checkout/session/client.go index 27da0f563b..c772ff1225 100644 --- a/checkout/session/client.go +++ b/checkout/session/client.go @@ -4,8 +4,8 @@ package session import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /checkout_sessions APIs. diff --git a/checkout/session/client_test.go b/checkout/session/client_test.go index d7ae4639b0..551dd8bca3 100644 --- a/checkout/session/client_test.go +++ b/checkout/session/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestCheckoutSessionGet(t *testing.T) { diff --git a/client/api.go b/client/api.go index fc4e7d1fde..4e8f9b551d 100644 --- a/client/api.go +++ b/client/api.go @@ -2,81 +2,81 @@ package client import ( - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/account" - "github.com/stripe/stripe-go/v71/accountlink" - "github.com/stripe/stripe-go/v71/applepaydomain" - "github.com/stripe/stripe-go/v71/balance" - "github.com/stripe/stripe-go/v71/balancetransaction" - "github.com/stripe/stripe-go/v71/bankaccount" - "github.com/stripe/stripe-go/v71/bitcoinreceiver" - "github.com/stripe/stripe-go/v71/bitcointransaction" - "github.com/stripe/stripe-go/v71/capability" - "github.com/stripe/stripe-go/v71/card" - "github.com/stripe/stripe-go/v71/charge" - checkoutsession "github.com/stripe/stripe-go/v71/checkout/session" - "github.com/stripe/stripe-go/v71/countryspec" - "github.com/stripe/stripe-go/v71/coupon" - "github.com/stripe/stripe-go/v71/creditnote" - "github.com/stripe/stripe-go/v71/customer" - "github.com/stripe/stripe-go/v71/customerbalancetransaction" - "github.com/stripe/stripe-go/v71/discount" - "github.com/stripe/stripe-go/v71/dispute" - "github.com/stripe/stripe-go/v71/ephemeralkey" - "github.com/stripe/stripe-go/v71/event" - "github.com/stripe/stripe-go/v71/exchangerate" - "github.com/stripe/stripe-go/v71/fee" - "github.com/stripe/stripe-go/v71/feerefund" - "github.com/stripe/stripe-go/v71/file" - "github.com/stripe/stripe-go/v71/filelink" - "github.com/stripe/stripe-go/v71/invoice" - "github.com/stripe/stripe-go/v71/invoiceitem" - "github.com/stripe/stripe-go/v71/issuing/authorization" - issuingcard "github.com/stripe/stripe-go/v71/issuing/card" - "github.com/stripe/stripe-go/v71/issuing/cardholder" - issuingdispute "github.com/stripe/stripe-go/v71/issuing/dispute" - "github.com/stripe/stripe-go/v71/issuing/transaction" - "github.com/stripe/stripe-go/v71/loginlink" - "github.com/stripe/stripe-go/v71/mandate" - "github.com/stripe/stripe-go/v71/oauth" - "github.com/stripe/stripe-go/v71/order" - "github.com/stripe/stripe-go/v71/orderreturn" - "github.com/stripe/stripe-go/v71/paymentintent" - "github.com/stripe/stripe-go/v71/paymentmethod" - "github.com/stripe/stripe-go/v71/paymentsource" - "github.com/stripe/stripe-go/v71/payout" - "github.com/stripe/stripe-go/v71/person" - "github.com/stripe/stripe-go/v71/plan" - "github.com/stripe/stripe-go/v71/product" - "github.com/stripe/stripe-go/v71/radar/earlyfraudwarning" - "github.com/stripe/stripe-go/v71/radar/valuelist" - "github.com/stripe/stripe-go/v71/radar/valuelistitem" - "github.com/stripe/stripe-go/v71/recipient" - "github.com/stripe/stripe-go/v71/refund" - "github.com/stripe/stripe-go/v71/reporting/reportrun" - "github.com/stripe/stripe-go/v71/reporting/reporttype" - "github.com/stripe/stripe-go/v71/reversal" - "github.com/stripe/stripe-go/v71/review" - "github.com/stripe/stripe-go/v71/setupintent" - "github.com/stripe/stripe-go/v71/sigma/scheduledqueryrun" - "github.com/stripe/stripe-go/v71/sku" - "github.com/stripe/stripe-go/v71/source" - "github.com/stripe/stripe-go/v71/sourcetransaction" - "github.com/stripe/stripe-go/v71/sub" - "github.com/stripe/stripe-go/v71/subitem" - "github.com/stripe/stripe-go/v71/subschedule" - "github.com/stripe/stripe-go/v71/taxid" - "github.com/stripe/stripe-go/v71/taxrate" - terminalconnectiontoken "github.com/stripe/stripe-go/v71/terminal/connectiontoken" - terminallocation "github.com/stripe/stripe-go/v71/terminal/location" - terminalreader "github.com/stripe/stripe-go/v71/terminal/reader" - "github.com/stripe/stripe-go/v71/threedsecure" - "github.com/stripe/stripe-go/v71/token" - "github.com/stripe/stripe-go/v71/topup" - "github.com/stripe/stripe-go/v71/transfer" - "github.com/stripe/stripe-go/v71/usagerecord" - "github.com/stripe/stripe-go/v71/usagerecordsummary" - "github.com/stripe/stripe-go/v71/webhookendpoint" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/account" + "github.com/stripe/stripe-go/v70/accountlink" + "github.com/stripe/stripe-go/v70/applepaydomain" + "github.com/stripe/stripe-go/v70/balance" + "github.com/stripe/stripe-go/v70/balancetransaction" + "github.com/stripe/stripe-go/v70/bankaccount" + "github.com/stripe/stripe-go/v70/bitcoinreceiver" + "github.com/stripe/stripe-go/v70/bitcointransaction" + "github.com/stripe/stripe-go/v70/capability" + "github.com/stripe/stripe-go/v70/card" + "github.com/stripe/stripe-go/v70/charge" + checkoutsession "github.com/stripe/stripe-go/v70/checkout/session" + "github.com/stripe/stripe-go/v70/countryspec" + "github.com/stripe/stripe-go/v70/coupon" + "github.com/stripe/stripe-go/v70/creditnote" + "github.com/stripe/stripe-go/v70/customer" + "github.com/stripe/stripe-go/v70/customerbalancetransaction" + "github.com/stripe/stripe-go/v70/discount" + "github.com/stripe/stripe-go/v70/dispute" + "github.com/stripe/stripe-go/v70/ephemeralkey" + "github.com/stripe/stripe-go/v70/event" + "github.com/stripe/stripe-go/v70/exchangerate" + "github.com/stripe/stripe-go/v70/fee" + "github.com/stripe/stripe-go/v70/feerefund" + "github.com/stripe/stripe-go/v70/file" + "github.com/stripe/stripe-go/v70/filelink" + "github.com/stripe/stripe-go/v70/invoice" + "github.com/stripe/stripe-go/v70/invoiceitem" + "github.com/stripe/stripe-go/v70/issuing/authorization" + issuingcard "github.com/stripe/stripe-go/v70/issuing/card" + "github.com/stripe/stripe-go/v70/issuing/cardholder" + issuingdispute "github.com/stripe/stripe-go/v70/issuing/dispute" + "github.com/stripe/stripe-go/v70/issuing/transaction" + "github.com/stripe/stripe-go/v70/loginlink" + "github.com/stripe/stripe-go/v70/mandate" + "github.com/stripe/stripe-go/v70/oauth" + "github.com/stripe/stripe-go/v70/order" + "github.com/stripe/stripe-go/v70/orderreturn" + "github.com/stripe/stripe-go/v70/paymentintent" + "github.com/stripe/stripe-go/v70/paymentmethod" + "github.com/stripe/stripe-go/v70/paymentsource" + "github.com/stripe/stripe-go/v70/payout" + "github.com/stripe/stripe-go/v70/person" + "github.com/stripe/stripe-go/v70/plan" + "github.com/stripe/stripe-go/v70/product" + "github.com/stripe/stripe-go/v70/radar/earlyfraudwarning" + "github.com/stripe/stripe-go/v70/radar/valuelist" + "github.com/stripe/stripe-go/v70/radar/valuelistitem" + "github.com/stripe/stripe-go/v70/recipient" + "github.com/stripe/stripe-go/v70/refund" + "github.com/stripe/stripe-go/v70/reporting/reportrun" + "github.com/stripe/stripe-go/v70/reporting/reporttype" + "github.com/stripe/stripe-go/v70/reversal" + "github.com/stripe/stripe-go/v70/review" + "github.com/stripe/stripe-go/v70/setupintent" + "github.com/stripe/stripe-go/v70/sigma/scheduledqueryrun" + "github.com/stripe/stripe-go/v70/sku" + "github.com/stripe/stripe-go/v70/source" + "github.com/stripe/stripe-go/v70/sourcetransaction" + "github.com/stripe/stripe-go/v70/sub" + "github.com/stripe/stripe-go/v70/subitem" + "github.com/stripe/stripe-go/v70/subschedule" + "github.com/stripe/stripe-go/v70/taxid" + "github.com/stripe/stripe-go/v70/taxrate" + terminalconnectiontoken "github.com/stripe/stripe-go/v70/terminal/connectiontoken" + terminallocation "github.com/stripe/stripe-go/v70/terminal/location" + terminalreader "github.com/stripe/stripe-go/v70/terminal/reader" + "github.com/stripe/stripe-go/v70/threedsecure" + "github.com/stripe/stripe-go/v70/token" + "github.com/stripe/stripe-go/v70/topup" + "github.com/stripe/stripe-go/v70/transfer" + "github.com/stripe/stripe-go/v70/usagerecord" + "github.com/stripe/stripe-go/v70/usagerecordsummary" + "github.com/stripe/stripe-go/v70/webhookendpoint" ) // API is the Stripe client. It contains all the different resources available. diff --git a/countryspec/client.go b/countryspec/client.go index 1f64b63ff0..5f0951ba50 100644 --- a/countryspec/client.go +++ b/countryspec/client.go @@ -4,8 +4,8 @@ package countryspec import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /country_specs and countryspec-related APIs. diff --git a/countryspec/client_test.go b/countryspec/client_test.go index bfc19f4137..807b9164e7 100644 --- a/countryspec/client_test.go +++ b/countryspec/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestCountrySpecGet(t *testing.T) { diff --git a/coupon/client.go b/coupon/client.go index 895ca23087..1e2e43528b 100644 --- a/coupon/client.go +++ b/coupon/client.go @@ -4,8 +4,8 @@ package coupon import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /coupons APIs. diff --git a/coupon/client_test.go b/coupon/client_test.go index f1e09083d2..48919e6431 100644 --- a/coupon/client_test.go +++ b/coupon/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestCouponDel(t *testing.T) { diff --git a/creditnote/client.go b/creditnote/client.go index a7b8795404..5adc46e4d5 100644 --- a/creditnote/client.go +++ b/creditnote/client.go @@ -4,8 +4,8 @@ package creditnote import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is the client used to invoke /credit_notes APIs. diff --git a/creditnote/client_test.go b/creditnote/client_test.go index b26bc2f247..feef766b7d 100644 --- a/creditnote/client_test.go +++ b/creditnote/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestCreditNoteGet(t *testing.T) { diff --git a/customer/client.go b/customer/client.go index ad9140e36e..6d72f6dc72 100644 --- a/customer/client.go +++ b/customer/client.go @@ -4,8 +4,8 @@ package customer import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /customers APIs. diff --git a/customer/client_test.go b/customer/client_test.go index 131298141a..4fed324d86 100644 --- a/customer/client_test.go +++ b/customer/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestCustomerDel(t *testing.T) { diff --git a/customerbalancetransaction/client.go b/customerbalancetransaction/client.go index 537066d62e..49f4d16a56 100644 --- a/customerbalancetransaction/client.go +++ b/customerbalancetransaction/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /balance_transactions APIs. diff --git a/customerbalancetransaction/client_test.go b/customerbalancetransaction/client_test.go index 67d3593014..e2a9d22961 100644 --- a/customerbalancetransaction/client_test.go +++ b/customerbalancetransaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestCustomerBalanceTransactionGet(t *testing.T) { diff --git a/discount/client.go b/discount/client.go index 90dadda23d..d49ba3bfaa 100644 --- a/discount/client.go +++ b/discount/client.go @@ -4,7 +4,7 @@ package discount import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke discount-related APIs. diff --git a/discount/client_test.go b/discount/client_test.go index 557edaa40f..fd442aa9ee 100644 --- a/discount/client_test.go +++ b/discount/client_test.go @@ -4,7 +4,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - _ "github.com/stripe/stripe-go/v71/testing" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestDiscountDel(t *testing.T) { diff --git a/dispute/client.go b/dispute/client.go index 071d90ebdb..f8f367af2a 100644 --- a/dispute/client.go +++ b/dispute/client.go @@ -3,8 +3,8 @@ package dispute import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke dispute-related APIs. diff --git a/dispute/client_test.go b/dispute/client_test.go index f306b44fdb..8c25c98d9f 100644 --- a/dispute/client_test.go +++ b/dispute/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestDisputeClose(t *testing.T) { diff --git a/ephemeralkey/client.go b/ephemeralkey/client.go index 0847202f1a..eee6cfa83b 100644 --- a/ephemeralkey/client.go +++ b/ephemeralkey/client.go @@ -5,7 +5,7 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke /ephemeral_keys APIs. diff --git a/ephemeralkey/client_test.go b/ephemeralkey/client_test.go index 38ecd3f54d..d1c6d73b3d 100644 --- a/ephemeralkey/client_test.go +++ b/ephemeralkey/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestEphemeralKeyDel(t *testing.T) { diff --git a/event/client.go b/event/client.go index f7eb1c35e3..03f25ce2d9 100644 --- a/event/client.go +++ b/event/client.go @@ -4,8 +4,8 @@ package event import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /events APIs. diff --git a/event/client_test.go b/event/client_test.go index 999649ef15..4525733816 100644 --- a/event/client_test.go +++ b/event/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestEventGet(t *testing.T) { diff --git a/example_test.go b/example_test.go index 3eb30a9e26..a5089c9670 100644 --- a/example_test.go +++ b/example_test.go @@ -3,11 +3,11 @@ package stripe_test import ( "log" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/charge" - "github.com/stripe/stripe-go/v71/customer" - "github.com/stripe/stripe-go/v71/invoice" - "github.com/stripe/stripe-go/v71/plan" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/charge" + "github.com/stripe/stripe-go/v70/customer" + "github.com/stripe/stripe-go/v70/invoice" + "github.com/stripe/stripe-go/v70/plan" ) func ExampleCharge_new() { diff --git a/exchangerate/client.go b/exchangerate/client.go index 1264f41ece..378e588ba5 100644 --- a/exchangerate/client.go +++ b/exchangerate/client.go @@ -4,8 +4,8 @@ package exchangerate import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /exchange_rates and exchangerates-related APIs. diff --git a/exchangerate/client_test.go b/exchangerate/client_test.go index 1333695354..668d65dfb1 100644 --- a/exchangerate/client_test.go +++ b/exchangerate/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestExchangeRateGet(t *testing.T) { diff --git a/fee/client.go b/fee/client.go index 43f34da5a7..7d0f38cb67 100644 --- a/fee/client.go +++ b/fee/client.go @@ -4,8 +4,8 @@ package fee import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke application_fees APIs. diff --git a/fee/client_test.go b/fee/client_test.go index 2a015d8b92..13124e500e 100644 --- a/fee/client_test.go +++ b/fee/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestApplicationFeeGet(t *testing.T) { diff --git a/feerefund/client.go b/feerefund/client.go index 7b848cd447..1d7cd6fbf8 100644 --- a/feerefund/client.go +++ b/feerefund/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /application_fees/refunds APIs. diff --git a/feerefund/client_test.go b/feerefund/client_test.go index 75e7cb2035..2a98cefd1c 100644 --- a/feerefund/client_test.go +++ b/feerefund/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestFeeRefundGet(t *testing.T) { diff --git a/file.go b/file.go index fa69ce539e..b4c599875e 100644 --- a/file.go +++ b/file.go @@ -8,7 +8,7 @@ import ( "net/url" "path/filepath" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // FilePurpose is the purpose of a particular file. diff --git a/file/client.go b/file/client.go index 213e17ebde..0da8ff9dfe 100644 --- a/file/client.go +++ b/file/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke file APIs. diff --git a/file/client_test.go b/file/client_test.go index f5916310be..e13c7ce0a4 100644 --- a/file/client_test.go +++ b/file/client_test.go @@ -16,8 +16,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) const ( diff --git a/filelink/client.go b/filelink/client.go index d3dd1fa8a5..2ea9088de4 100644 --- a/filelink/client.go +++ b/filelink/client.go @@ -6,8 +6,8 @@ package filelink import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke APIs related to file links. diff --git a/filelink/client_test.go b/filelink/client_test.go index 28c9e47bcb..90cec0907a 100644 --- a/filelink/client_test.go +++ b/filelink/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestFileLinkGet(t *testing.T) { diff --git a/go.mod b/go.mod index 9ec6cdcb98..3d63ceb550 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/stripe/stripe-go/v71 +module github.com/stripe/stripe-go/v70 go 1.13 diff --git a/invoice.go b/invoice.go index 6b0a6e5544..04baa03f87 100644 --- a/invoice.go +++ b/invoice.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // InvoiceLineType is the list of allowed values for the invoice line's type. diff --git a/invoice/client.go b/invoice/client.go index 4ae850268c..fc91b56631 100644 --- a/invoice/client.go +++ b/invoice/client.go @@ -4,8 +4,8 @@ package invoice import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is the client used to invoke /invoices APIs. diff --git a/invoice/client_test.go b/invoice/client_test.go index ff21478b9f..0b0904fd36 100644 --- a/invoice/client_test.go +++ b/invoice/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestInvoiceGet(t *testing.T) { diff --git a/invoice_test.go b/invoice_test.go index 5d4bf0e0fd..2f333fbee7 100644 --- a/invoice_test.go +++ b/invoice_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestInvoiceParams_AppendTo(t *testing.T) { diff --git a/invoiceitem/client.go b/invoiceitem/client.go index 4d6e3d31b7..5fb8c9ab06 100644 --- a/invoiceitem/client.go +++ b/invoiceitem/client.go @@ -4,8 +4,8 @@ package invoiceitem import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /invoiceitems APIs. diff --git a/invoiceitem/client_test.go b/invoiceitem/client_test.go index 79c6374554..cad783ebd9 100644 --- a/invoiceitem/client_test.go +++ b/invoiceitem/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestInvoiceItemDel(t *testing.T) { diff --git a/issuing/authorization/client.go b/issuing/authorization/client.go index 97ddac4a55..43a5b67369 100644 --- a/issuing/authorization/client.go +++ b/issuing/authorization/client.go @@ -6,8 +6,8 @@ package authorization import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /issuing/authorizations APIs. diff --git a/issuing/authorization/client_test.go b/issuing/authorization/client_test.go index b0e10264e6..f4e20aa01b 100644 --- a/issuing/authorization/client_test.go +++ b/issuing/authorization/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestIssuingAuthorizationApprove(t *testing.T) { diff --git a/issuing/card/client.go b/issuing/card/client.go index 0124debc67..e53152f027 100644 --- a/issuing/card/client.go +++ b/issuing/card/client.go @@ -6,8 +6,8 @@ package card import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /issuing/cards APIs. diff --git a/issuing/card/client_test.go b/issuing/card/client_test.go index dc66f78f7d..a193b338a6 100644 --- a/issuing/card/client_test.go +++ b/issuing/card/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestIssuingCardGet(t *testing.T) { diff --git a/issuing/cardholder/client.go b/issuing/cardholder/client.go index ab1ec7380c..e8ae2b1267 100644 --- a/issuing/cardholder/client.go +++ b/issuing/cardholder/client.go @@ -6,8 +6,8 @@ package cardholder import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /issuing/cardholders APIs. diff --git a/issuing/cardholder/client_test.go b/issuing/cardholder/client_test.go index 3a46a2f291..b0756e812f 100644 --- a/issuing/cardholder/client_test.go +++ b/issuing/cardholder/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestIssuingCardholderGet(t *testing.T) { diff --git a/issuing/dispute/client.go b/issuing/dispute/client.go index 866374dbad..47f55e9f88 100644 --- a/issuing/dispute/client.go +++ b/issuing/dispute/client.go @@ -6,8 +6,8 @@ package dispute import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /issuing/disputes APIs. diff --git a/issuing/dispute/client_test.go b/issuing/dispute/client_test.go index cef09a1034..eddf4e369e 100644 --- a/issuing/dispute/client_test.go +++ b/issuing/dispute/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestIssuingDisputeGet(t *testing.T) { diff --git a/issuing/transaction/client.go b/issuing/transaction/client.go index 66a0b90e96..d510dd04d6 100644 --- a/issuing/transaction/client.go +++ b/issuing/transaction/client.go @@ -6,8 +6,8 @@ package transaction import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /issuing/transactions APIs. diff --git a/issuing/transaction/client_test.go b/issuing/transaction/client_test.go index d4de7e97bc..5b04877aa3 100644 --- a/issuing/transaction/client_test.go +++ b/issuing/transaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestIssuingTransactionGet(t *testing.T) { diff --git a/iter.go b/iter.go index 4a9fcf3695..8b29bfe901 100644 --- a/iter.go +++ b/iter.go @@ -3,7 +3,7 @@ package stripe import ( "reflect" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // diff --git a/iter_test.go b/iter_test.go index edba5e7ee4..74bc5a2a88 100644 --- a/iter_test.go +++ b/iter_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestIterEmpty(t *testing.T) { diff --git a/loginlink/client.go b/loginlink/client.go index 7129077556..093be18e8e 100644 --- a/loginlink/client.go +++ b/loginlink/client.go @@ -5,7 +5,7 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke /login_links APIs. diff --git a/loginlink/client_test.go b/loginlink/client_test.go index 577be9be2b..f4f3b2ade3 100644 --- a/loginlink/client_test.go +++ b/loginlink/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestLoginLinkNew(t *testing.T) { diff --git a/mandate/client.go b/mandate/client.go index cdc9c8fb4f..2e9db16579 100644 --- a/mandate/client.go +++ b/mandate/client.go @@ -4,7 +4,7 @@ package mandate import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke mandates APIs. diff --git a/mandate/client_test.go b/mandate/client_test.go index b430a82bf8..80814fa530 100644 --- a/mandate/client_test.go +++ b/mandate/client_test.go @@ -4,7 +4,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - _ "github.com/stripe/stripe-go/v71/testing" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestMandateMethodGet(t *testing.T) { diff --git a/oauth/client.go b/oauth/client.go index 4d6f66df1e..50cb709fa5 100644 --- a/oauth/client.go +++ b/oauth/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /oauth and related APIs. diff --git a/oauth/client_test.go b/oauth/client_test.go index a304e298da..dd98735fd7 100644 --- a/oauth/client_test.go +++ b/oauth/client_test.go @@ -7,8 +7,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestAuthorizeURL(t *testing.T) { diff --git a/order/client.go b/order/client.go index 6400d66292..d8280a38ca 100644 --- a/order/client.go +++ b/order/client.go @@ -3,8 +3,8 @@ package order import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /orders APIs. diff --git a/order/client_test.go b/order/client_test.go index 43e53503a3..a22921bc98 100644 --- a/order/client_test.go +++ b/order/client_test.go @@ -8,8 +8,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestOrderGet(t *testing.T) { diff --git a/order_test.go b/order_test.go index 90016aad9f..ec7b7569c7 100644 --- a/order_test.go +++ b/order_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestOrder_UnmarshalJSON(t *testing.T) { diff --git a/orderreturn/client.go b/orderreturn/client.go index c03bf8dc1e..e057f365a0 100644 --- a/orderreturn/client.go +++ b/orderreturn/client.go @@ -3,8 +3,8 @@ package orderreturn import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /orders APIs. diff --git a/orderreturn/client_test.go b/orderreturn/client_test.go index 38b153f76b..ebc57e4f98 100644 --- a/orderreturn/client_test.go +++ b/orderreturn/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestOrderReturnGet(t *testing.T) { diff --git a/params.go b/params.go index 4667110566..acc1d82143 100644 --- a/params.go +++ b/params.go @@ -9,7 +9,7 @@ import ( "net/url" "time" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // diff --git a/params_test.go b/params_test.go index 22e367d6df..749e85ea29 100644 --- a/params_test.go +++ b/params_test.go @@ -5,9 +5,9 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" - . "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" + . "github.com/stripe/stripe-go/v70/testing" ) func TestRangeQueryParamsAppendTo(t *testing.T) { diff --git a/paymentintent/client.go b/paymentintent/client.go index 9b5f178a23..801555f33b 100644 --- a/paymentintent/client.go +++ b/paymentintent/client.go @@ -6,8 +6,8 @@ package paymentintent import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke APIs related to payment intents. diff --git a/paymentintent/client_test.go b/paymentintent/client_test.go index 26d04a52a5..4ae05150e1 100644 --- a/paymentintent/client_test.go +++ b/paymentintent/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestPaymentIntentCancel(t *testing.T) { diff --git a/paymentmethod/client.go b/paymentmethod/client.go index 60e5f84bd6..813d35c0ab 100644 --- a/paymentmethod/client.go +++ b/paymentmethod/client.go @@ -4,8 +4,8 @@ package paymentmethod import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke pms APIs. diff --git a/paymentmethod/client_test.go b/paymentmethod/client_test.go index 3535bf1060..eb7450d026 100644 --- a/paymentmethod/client_test.go +++ b/paymentmethod/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestPaymentMethodAttach(t *testing.T) { diff --git a/paymentsource.go b/paymentsource.go index 2cf028d8a7..c83a429c20 100644 --- a/paymentsource.go +++ b/paymentsource.go @@ -4,7 +4,7 @@ import ( "encoding/json" "fmt" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // PaymentSourceType consts represent valid payment sources. diff --git a/paymentsource/client.go b/paymentsource/client.go index 9a745e050a..3105e0aac9 100644 --- a/paymentsource/client.go +++ b/paymentsource/client.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /sources APIs. diff --git a/paymentsource/client_test.go b/paymentsource/client_test.go index 27918c266f..88fe7d07c9 100644 --- a/paymentsource/client_test.go +++ b/paymentsource/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSourceGet(t *testing.T) { diff --git a/paymentsource_test.go b/paymentsource_test.go index 0c10727939..c1f3c47da5 100644 --- a/paymentsource_test.go +++ b/paymentsource_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestSourceParams_AppendTo(t *testing.T) { diff --git a/payout/client.go b/payout/client.go index 71e7b00ebd..994d6c4309 100644 --- a/payout/client.go +++ b/payout/client.go @@ -4,8 +4,8 @@ package payout import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /payouts APIs. diff --git a/payout/client_test.go b/payout/client_test.go index efc54ebc64..fa21da8c55 100644 --- a/payout/client_test.go +++ b/payout/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestPayoutCancel(t *testing.T) { diff --git a/person/client.go b/person/client.go index 8f09b0c7ca..30b2a1c27e 100644 --- a/person/client.go +++ b/person/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /accounts/persons APIs. diff --git a/person/client_test.go b/person/client_test.go index 1497442488..706e1482e4 100644 --- a/person/client_test.go +++ b/person/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestPersonDel(t *testing.T) { diff --git a/plan.go b/plan.go index 91e2f4f6d4..509fd74ba5 100644 --- a/plan.go +++ b/plan.go @@ -4,7 +4,7 @@ import ( "encoding/json" "strconv" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // PlanInterval is the list of allowed values for a plan's interval. diff --git a/plan/client.go b/plan/client.go index 15e9ae4aa5..c946bc9d01 100644 --- a/plan/client.go +++ b/plan/client.go @@ -4,8 +4,8 @@ package plan import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /plans APIs. diff --git a/plan/client_test.go b/plan/client_test.go index c64fdd374f..02e35a0675 100644 --- a/plan/client_test.go +++ b/plan/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestPlanDel(t *testing.T) { diff --git a/plan_test.go b/plan_test.go index cbb0b7ee2c..d1385b6171 100644 --- a/plan_test.go +++ b/plan_test.go @@ -6,7 +6,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestPlan_Unmarshal(t *testing.T) { diff --git a/product/client.go b/product/client.go index a65e07c691..e741c8c6fd 100644 --- a/product/client.go +++ b/product/client.go @@ -3,8 +3,8 @@ package product import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /products APIs. diff --git a/product/client_test.go b/product/client_test.go index 9d22572891..01c6eeeee5 100644 --- a/product/client_test.go +++ b/product/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestProductDel(t *testing.T) { diff --git a/radar/earlyfraudwarning/client.go b/radar/earlyfraudwarning/client.go index 46699de92f..d9a52238f3 100644 --- a/radar/earlyfraudwarning/client.go +++ b/radar/earlyfraudwarning/client.go @@ -7,8 +7,8 @@ package earlyfraudwarning import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to interact with the /radar/early_fraud_warnings API. diff --git a/radar/earlyfraudwarning/client_test.go b/radar/earlyfraudwarning/client_test.go index cd8ec12ce1..7b93263aed 100644 --- a/radar/earlyfraudwarning/client_test.go +++ b/radar/earlyfraudwarning/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestRadarEarlyFraudWarningGet(t *testing.T) { diff --git a/radar/valuelist/client.go b/radar/valuelist/client.go index b9de9ab0be..40415c6fe1 100644 --- a/radar/valuelist/client.go +++ b/radar/valuelist/client.go @@ -6,8 +6,8 @@ package valuelist import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /radar/value_lists APIs. diff --git a/radar/valuelist/client_test.go b/radar/valuelist/client_test.go index 1e61a799b6..064f4d81ac 100644 --- a/radar/valuelist/client_test.go +++ b/radar/valuelist/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestRadarValueListDel(t *testing.T) { diff --git a/radar/valuelistitem/client.go b/radar/valuelistitem/client.go index c21efee6c0..bc480a3a51 100644 --- a/radar/valuelistitem/client.go +++ b/radar/valuelistitem/client.go @@ -6,8 +6,8 @@ package valuelistitem import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /radar/value_list_items APIs. diff --git a/radar/valuelistitem/client_test.go b/radar/valuelistitem/client_test.go index c0d4204f15..a885572bf8 100644 --- a/radar/valuelistitem/client_test.go +++ b/radar/valuelistitem/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestRadarValueListItemDel(t *testing.T) { diff --git a/recipient.go b/recipient.go index 0b68e59d16..52fb9843a0 100644 --- a/recipient.go +++ b/recipient.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // RecipientType is the list of allowed values for the recipient's type. diff --git a/recipient/client.go b/recipient/client.go index 29df4b2529..85e577501d 100644 --- a/recipient/client.go +++ b/recipient/client.go @@ -4,8 +4,8 @@ package recipient import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /recipients APIs. diff --git a/recipient/client_test.go b/recipient/client_test.go index a861881e07..fab0f1865c 100644 --- a/recipient/client_test.go +++ b/recipient/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestRecipientDel(t *testing.T) { diff --git a/recipient_test.go b/recipient_test.go index e2798e234c..2ab04c7c35 100644 --- a/recipient_test.go +++ b/recipient_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestRecipientParams_AppendTo(t *testing.T) { diff --git a/refund/client.go b/refund/client.go index 7bb02422c7..83bf8ad6c2 100644 --- a/refund/client.go +++ b/refund/client.go @@ -4,8 +4,8 @@ package refund import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /refunds APIs. diff --git a/refund/client_test.go b/refund/client_test.go index aadfc24215..f3320e2b30 100644 --- a/refund/client_test.go +++ b/refund/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestRefundGet(t *testing.T) { diff --git a/reporting/reportrun/client.go b/reporting/reportrun/client.go index d99bebe99b..9732ae10ce 100644 --- a/reporting/reportrun/client.go +++ b/reporting/reportrun/client.go @@ -6,8 +6,8 @@ package reportrun import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /reporting/report_runs APIs. diff --git a/reporting/reportrun/client_test.go b/reporting/reportrun/client_test.go index 0fd8a75491..d8debae62d 100644 --- a/reporting/reportrun/client_test.go +++ b/reporting/reportrun/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestReportRunGet(t *testing.T) { diff --git a/reporting/reporttype/client.go b/reporting/reporttype/client.go index 650c54660d..7feedaef65 100644 --- a/reporting/reporttype/client.go +++ b/reporting/reporttype/client.go @@ -6,8 +6,8 @@ package reporttype import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /reporting/report_types APIs. diff --git a/reporting/reporttype/client_test.go b/reporting/reporttype/client_test.go index 7e14f5f040..13080fa6d7 100644 --- a/reporting/reporttype/client_test.go +++ b/reporting/reporttype/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestReportTestGet(t *testing.T) { diff --git a/reversal/client.go b/reversal/client.go index b0b6a9d90d..4c06a6c1a8 100644 --- a/reversal/client.go +++ b/reversal/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /transfers/reversals APIs. diff --git a/reversal/client_test.go b/reversal/client_test.go index aa8ef0a043..a92b6388fb 100644 --- a/reversal/client_test.go +++ b/reversal/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestReversalGet(t *testing.T) { diff --git a/review/client.go b/review/client.go index ce9cef0e8b..4a734769df 100644 --- a/review/client.go +++ b/review/client.go @@ -4,8 +4,8 @@ package review import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /reviews APIs. diff --git a/review/client_test.go b/review/client_test.go index 5732449eea..22be2e9227 100644 --- a/review/client_test.go +++ b/review/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestReviewApprove(t *testing.T) { diff --git a/setupintent/client.go b/setupintent/client.go index ca53282d08..15f3ada107 100644 --- a/setupintent/client.go +++ b/setupintent/client.go @@ -6,8 +6,8 @@ package setupintent import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke APIs related to setup intents. diff --git a/setupintent/client_test.go b/setupintent/client_test.go index 16cd9838f0..788985e9d5 100644 --- a/setupintent/client_test.go +++ b/setupintent/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSetupIntentCancel(t *testing.T) { diff --git a/sigma/scheduledqueryrun/client.go b/sigma/scheduledqueryrun/client.go index 4bd6a086ef..9767a33745 100644 --- a/sigma/scheduledqueryrun/client.go +++ b/sigma/scheduledqueryrun/client.go @@ -6,8 +6,8 @@ package scheduledqueryrun import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /sigma/scheduled_query_runs APIs. diff --git a/sigma/scheduledqueryrun/client_test.go b/sigma/scheduledqueryrun/client_test.go index 79454ff26d..0087f80867 100644 --- a/sigma/scheduledqueryrun/client_test.go +++ b/sigma/scheduledqueryrun/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSigmaScheduledQueryRunGet(t *testing.T) { diff --git a/sku/client.go b/sku/client.go index c3d91c6e84..cff762cf78 100644 --- a/sku/client.go +++ b/sku/client.go @@ -3,8 +3,8 @@ package sku import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /skus APIs. diff --git a/sku/client_test.go b/sku/client_test.go index 3d062cf6f6..86b84041ce 100644 --- a/sku/client_test.go +++ b/sku/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSKUDel(t *testing.T) { diff --git a/source.go b/source.go index 3ef88a4b29..893e1b6ee1 100644 --- a/source.go +++ b/source.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // SourceCodeVerificationFlowStatus represents the possible statuses of a code verification flow. diff --git a/source/client.go b/source/client.go index 52a9aea15e..d99399d32d 100644 --- a/source/client.go +++ b/source/client.go @@ -4,7 +4,7 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke /sources APIs. diff --git a/source/client_test.go b/source/client_test.go index 95bc136a1e..d985e8a26e 100644 --- a/source/client_test.go +++ b/source/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSourceGet(t *testing.T) { diff --git a/source_test.go b/source_test.go index 51d4991f82..3177bf5f20 100644 --- a/source_test.go +++ b/source_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestSourceObjectParams_AppendTo(t *testing.T) { diff --git a/sourcetransaction/client.go b/sourcetransaction/client.go index cc35593e1e..08b90e9355 100644 --- a/sourcetransaction/client.go +++ b/sourcetransaction/client.go @@ -5,8 +5,8 @@ import ( "errors" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /sources/:source_id/transactions APIs. diff --git a/sourcetransaction/client_test.go b/sourcetransaction/client_test.go index a07095a2ac..69965e903a 100644 --- a/sourcetransaction/client_test.go +++ b/sourcetransaction/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSourceTransactionList(t *testing.T) { diff --git a/stripe.go b/stripe.go index 5e9eb33e94..6aaf455ffc 100644 --- a/stripe.go +++ b/stripe.go @@ -19,7 +19,7 @@ import ( "sync" "time" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // diff --git a/sub.go b/sub.go index 8ee36b7eba..a1782b79df 100644 --- a/sub.go +++ b/sub.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // SubscriptionStatus is the list of allowed values for the subscription's status. diff --git a/sub/client.go b/sub/client.go index b8007070f0..7635a95603 100644 --- a/sub/client.go +++ b/sub/client.go @@ -4,8 +4,8 @@ package sub import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /subscriptions APIs. diff --git a/sub/client_test.go b/sub/client_test.go index de414013ab..0be7654e65 100644 --- a/sub/client_test.go +++ b/sub/client_test.go @@ -5,8 +5,8 @@ import ( "time" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSubscriptionCancel(t *testing.T) { diff --git a/sub_test.go b/sub_test.go index e9823e4cca..eb2a974e91 100644 --- a/sub_test.go +++ b/sub_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestSubscriptionParams_AppendTo(t *testing.T) { diff --git a/subitem/client.go b/subitem/client.go index 1171232c0e..3cdb5f9a04 100644 --- a/subitem/client.go +++ b/subitem/client.go @@ -4,8 +4,8 @@ package subitem import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /subscriptions APIs. diff --git a/subitem/client_test.go b/subitem/client_test.go index fdc3ba4022..97680e6bdc 100644 --- a/subitem/client_test.go +++ b/subitem/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSubscriptionItemDel(t *testing.T) { diff --git a/subschedule.go b/subschedule.go index cd2326919a..e972afd436 100644 --- a/subschedule.go +++ b/subschedule.go @@ -3,7 +3,7 @@ package stripe import ( "encoding/json" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) // SubscriptionScheduleEndBehavior describe what happens to a schedule when it ends. diff --git a/subschedule/client.go b/subschedule/client.go index 8ff174c5e5..8c4fbac1fc 100644 --- a/subschedule/client.go +++ b/subschedule/client.go @@ -4,8 +4,8 @@ package subschedule import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /subscription_schedules APIs. diff --git a/subschedule/client_test.go b/subschedule/client_test.go index b08283c765..71242aea0e 100644 --- a/subschedule/client_test.go +++ b/subschedule/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestSubscriptionScheduleCancel(t *testing.T) { diff --git a/subschedule_test.go b/subschedule_test.go index 438d324bea..69b2af0703 100644 --- a/subschedule_test.go +++ b/subschedule_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestSubscriptionScheduleParams_AppendTo(t *testing.T) { diff --git a/taxid/client.go b/taxid/client.go index cea4d682e0..203b7b2259 100644 --- a/taxid/client.go +++ b/taxid/client.go @@ -5,8 +5,8 @@ import ( "fmt" "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /tax_ids APIs. diff --git a/taxid/client_test.go b/taxid/client_test.go index 124054894a..087c0a3fd1 100644 --- a/taxid/client_test.go +++ b/taxid/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestTaxIDDel(t *testing.T) { diff --git a/taxrate/client.go b/taxrate/client.go index 9ac1b95298..c7e5637bb2 100644 --- a/taxrate/client.go +++ b/taxrate/client.go @@ -4,8 +4,8 @@ package taxrate import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /tax_rates APIs. diff --git a/taxrate/client_test.go b/taxrate/client_test.go index 2243359d30..fb366b41a2 100644 --- a/taxrate/client_test.go +++ b/taxrate/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestTaxRateGet(t *testing.T) { diff --git a/terminal/connectiontoken/client.go b/terminal/connectiontoken/client.go index 5019a8fa60..559dba202d 100644 --- a/terminal/connectiontoken/client.go +++ b/terminal/connectiontoken/client.go @@ -4,7 +4,7 @@ package connectiontoken import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke /terminal/connection_tokens APIs. diff --git a/terminal/connectiontoken/client_test.go b/terminal/connectiontoken/client_test.go index b6891e318f..87cbfe1372 100644 --- a/terminal/connectiontoken/client_test.go +++ b/terminal/connectiontoken/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestTerminalConnectionTokenNew(t *testing.T) { diff --git a/terminal/location/client.go b/terminal/location/client.go index d211c78e84..ac8be100b9 100644 --- a/terminal/location/client.go +++ b/terminal/location/client.go @@ -4,8 +4,8 @@ package location import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invokte /terminal/locations APIs diff --git a/terminal/location/client_test.go b/terminal/location/client_test.go index bd6d01401a..deb8a9dd47 100644 --- a/terminal/location/client_test.go +++ b/terminal/location/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestTerminalLocationDel(t *testing.T) { diff --git a/terminal/reader/client.go b/terminal/reader/client.go index 1c10316ae8..7a60556147 100644 --- a/terminal/reader/client.go +++ b/terminal/reader/client.go @@ -4,8 +4,8 @@ package reader import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /terminal/readers APIs. diff --git a/terminal/reader/client_test.go b/terminal/reader/client_test.go index 3f004bb62e..403edaddd2 100644 --- a/terminal/reader/client_test.go +++ b/terminal/reader/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestTerminalReaderDel(t *testing.T) { diff --git a/testing/testing.go b/testing/testing.go index a1aa8d9add..a911ce3d39 100644 --- a/testing/testing.go +++ b/testing/testing.go @@ -8,8 +8,8 @@ import ( "strconv" "strings" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" "golang.org/x/net/http2" ) diff --git a/threedsecure/client.go b/threedsecure/client.go index 0cfa789c82..fb30d40074 100644 --- a/threedsecure/client.go +++ b/threedsecure/client.go @@ -7,7 +7,7 @@ package threedsecure import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke /3d_secure APIs. diff --git a/threedsecure/client_test.go b/threedsecure/client_test.go index 7238bb7741..827f832fd0 100644 --- a/threedsecure/client_test.go +++ b/threedsecure/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestThreeDSecureGet(t *testing.T) { diff --git a/token/client.go b/token/client.go index d1c826165a..48e1e8fd0c 100644 --- a/token/client.go +++ b/token/client.go @@ -4,7 +4,7 @@ package token import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke /tokens APIs. diff --git a/token/client_test.go b/token/client_test.go index d21f0f2416..36dd08efc3 100644 --- a/token/client_test.go +++ b/token/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestTokenGet(t *testing.T) { diff --git a/topup/client.go b/topup/client.go index 9bdc849324..987b73c40b 100644 --- a/topup/client.go +++ b/topup/client.go @@ -3,8 +3,8 @@ package topup import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /topups APIs. diff --git a/topup/client_test.go b/topup/client_test.go index e4ed77cd59..870c48a2dc 100644 --- a/topup/client_test.go +++ b/topup/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestTopupCancel(t *testing.T) { diff --git a/transfer/client.go b/transfer/client.go index 723ccda595..80048cf0d8 100644 --- a/transfer/client.go +++ b/transfer/client.go @@ -4,8 +4,8 @@ package transfer import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /transfers APIs. diff --git a/transfer/client_test.go b/transfer/client_test.go index 21fb6d0859..a27146090f 100644 --- a/transfer/client_test.go +++ b/transfer/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestTransferGet(t *testing.T) { diff --git a/usagerecord/client.go b/usagerecord/client.go index cbb73f6174..ded670291b 100644 --- a/usagerecord/client.go +++ b/usagerecord/client.go @@ -4,7 +4,7 @@ package usagerecord import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" + stripe "github.com/stripe/stripe-go/v70" ) // Client is used to invoke APIs related to usage records. diff --git a/usagerecord/client_test.go b/usagerecord/client_test.go index 8c295b5efd..0ac55c1ed2 100644 --- a/usagerecord/client_test.go +++ b/usagerecord/client_test.go @@ -5,8 +5,8 @@ import ( "time" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestUsageRecordNew(t *testing.T) { diff --git a/usagerecord_test.go b/usagerecord_test.go index 92866d205c..8d454bb43e 100644 --- a/usagerecord_test.go +++ b/usagerecord_test.go @@ -5,7 +5,7 @@ import ( "testing" assert "github.com/stretchr/testify/require" - "github.com/stripe/stripe-go/v71/form" + "github.com/stripe/stripe-go/v70/form" ) func TestUsageRecordParams_AppendTo(t *testing.T) { diff --git a/usagerecordsummary/client.go b/usagerecordsummary/client.go index 70632cda9f..ad15a7a529 100644 --- a/usagerecordsummary/client.go +++ b/usagerecordsummary/client.go @@ -4,8 +4,8 @@ package usagerecordsummary import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke APIs related to usage record summaries. diff --git a/usagerecordsummary/client_test.go b/usagerecordsummary/client_test.go index 5bc0a1c27b..05626872d2 100644 --- a/usagerecordsummary/client_test.go +++ b/usagerecordsummary/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestUsageRecordSummaryList(t *testing.T) { diff --git a/webhook/client.go b/webhook/client.go index a6c8a82d48..1ad41dd8fb 100644 --- a/webhook/client.go +++ b/webhook/client.go @@ -11,7 +11,7 @@ import ( "strings" "time" - "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v70" ) // diff --git a/webhook/client_handler_test.go b/webhook/client_handler_test.go index 712378f5c8..f51df899ae 100644 --- a/webhook/client_handler_test.go +++ b/webhook/client_handler_test.go @@ -6,7 +6,7 @@ import ( "log" "net/http" - "github.com/stripe/stripe-go/v71/webhook" + "github.com/stripe/stripe-go/v70/webhook" ) func Example() { diff --git a/webhookendpoint/client.go b/webhookendpoint/client.go index f85cb84867..c17c4ce8d3 100644 --- a/webhookendpoint/client.go +++ b/webhookendpoint/client.go @@ -4,8 +4,8 @@ package webhookendpoint import ( "net/http" - stripe "github.com/stripe/stripe-go/v71" - "github.com/stripe/stripe-go/v71/form" + stripe "github.com/stripe/stripe-go/v70" + "github.com/stripe/stripe-go/v70/form" ) // Client is used to invoke /webhook_endpoints APIs. diff --git a/webhookendpoint/client_test.go b/webhookendpoint/client_test.go index f151ba4ce4..f0fffa8b37 100644 --- a/webhookendpoint/client_test.go +++ b/webhookendpoint/client_test.go @@ -4,8 +4,8 @@ import ( "testing" assert "github.com/stretchr/testify/require" - stripe "github.com/stripe/stripe-go/v71" - _ "github.com/stripe/stripe-go/v71/testing" + stripe "github.com/stripe/stripe-go/v70" + _ "github.com/stripe/stripe-go/v70/testing" ) func TestWebhookEndpointDel(t *testing.T) { From 4769892a57b50c65d1e92f627f9f1ec815083ad8 Mon Sep 17 00:00:00 2001 From: Brandur Date: Thu, 16 Apr 2020 19:03:11 -0700 Subject: [PATCH 6/8] Clean up logging for next major (#1070) ## Background For a very long time, stripe-go logged by way of the `Printfer` interface: ``` go type Printfer interface { Printf(format string, v ...interface{}) } ``` `Printfer` had a few problems: it didn't allow any kind of granularity around logging levels, didn't allow us to behave well by sending errors to `stderr` and other output to `stdout`, and wasn't interoperable with any popular Go loggers (it was interoperable with the one in the stdlib's `log`, but serious programs tend to move away from that). A while back, I introduced the new `LeveledLogger` interface, which corrected the deficiencies with `Printfer`. We made quite a bit of effort to stay compatible with the existing configuration options around logging like the `Logger` and `LogLevel` globals, while also adding new ones for the leveled logger like `DefaultLeveledLogger`. The downside of that is it made reasoning about the different combinations complicated. For example, you had to know that if both `Logger` and `DefaultLeveledLogger` were set, then the former would take precedence, which isn't necessarily obvious. ## Changes in this patch Since we're on the verge of a major, I've taken the liberty of cleaning up all the old logging infrastructure. This involves removing its types, interfaces, helpers, global configuration options, and local configuration options. We're left with a much simpler setup with just `stripe.DefaultLeveledLogger` and `BackendConfig.LeveledLogger`. Users who were already using the leveled logger (as recommended in the README for sometime) won't have to change anything, nor will users who had no logging configured. Users on the old infrastructure will have to make some config tweaks, but ones that are quite easy. And since we're changing logging things anyway: I've made a small tweak such that if left unset by the user, the default logger now logs errors only (instead of errors + informational). This is a more reasonable default on Unix systems where programs are generally not expected to be noisy over stdout. If a user wants to get informational messages back, it's a very easy configuration tweak to `DefaultLeveledLogger`. --- README.md | 3 +- log.go | 91 +++------------------------------------------- log_test.go | 86 +------------------------------------------ stripe.go | 37 ++++--------------- stripe_test.go | 54 +++++++++++---------------- testing/testing.go | 6 +-- 6 files changed, 41 insertions(+), 236 deletions(-) diff --git a/README.md b/README.md index 0afd3d49fa..01eb3584b7 100644 --- a/README.md +++ b/README.md @@ -269,7 +269,8 @@ retries are safe. ### Configuring Logging -Configure logging using the global `DefaultLeveledLogger` variable: +By default, the library logs error messages only (which are sent to `stderr`). +Configure default logging using the global `DefaultLeveledLogger` variable: ```go stripe.DefaultLeveledLogger = &stripe.LeveledLogger{ diff --git a/log.go b/log.go index 7604216b09..b52d7ac56b 100644 --- a/log.go +++ b/log.go @@ -3,7 +3,6 @@ package stripe import ( "fmt" "io" - "log" "os" ) @@ -12,6 +11,9 @@ import ( // const ( + // LevelNull sets a logger to show no messages at all. + LevelNull Level = 0 + // LevelError sets a logger to show error messages only. LevelError Level = 1 @@ -26,11 +28,6 @@ const ( // LevelDebug sets a logger to show informational messages or anything more // severe. LevelDebug Level = 4 - - // Older deprecated levels for Printfer-style logging. - printferLevelError = 1 - printferLevelInfo = 2 - printferLevelDebug = 3 ) // @@ -49,27 +46,9 @@ const ( // This Logger will be inherited by any backends created by default, but will // be overridden if a backend is created with GetBackendWithConfig with a // custom LeveledLogger set. -var DefaultLeveledLogger LeveledLoggerInterface - -// LogLevel is the logging level for this library. -// 0: no logging -// 1: errors only -// 2: errors + informational (default) -// 3: errors + informational + debug -// -// Deprecated: Logging should be configured with DefaultLeveledLogger instead. -var LogLevel = 2 - -// Logger controls how stripe performs logging at a package level. It is useful -// to customise if you need it prefixed for your application to meet other -// requirements. -// -// This Logger will be inherited by any backends created by default, but will -// be overridden if a backend is created with GetBackendWithConfig with a -// custom Logger set. -// -// Deprecated: Logging should be configured with DefaultLeveledLogger instead. -var Logger Printfer +var DefaultLeveledLogger LeveledLoggerInterface = &LeveledLogger{ + Level: LevelError, +} // // Public types @@ -161,61 +140,3 @@ type LeveledLoggerInterface interface { // Warnf logs a warning message using Printf conventions. Warnf(format string, v ...interface{}) } - -// Printfer is an interface to be implemented by Logger. -type Printfer interface { - Printf(format string, v ...interface{}) -} - -// -// Private types -// - -// Level represents a deprecated logging level. -type printferLevel uint32 - -type leveledLoggerPrintferShim struct { - level printferLevel - logger Printfer -} - -// Debugf logs a debug message using Printf conventions. -func (l *leveledLoggerPrintferShim) Debugf(format string, v ...interface{}) { - if l.level >= printferLevelDebug { - l.logger.Printf(format+"\n", v...) - } -} - -// Errorf logs a warning message using Printf conventions. -func (l *leveledLoggerPrintferShim) Errorf(format string, v ...interface{}) { - if l.level >= printferLevelError { - l.logger.Printf(format+"\n", v...) - } -} - -// Infof logs an informational message using Printf conventions. -func (l *leveledLoggerPrintferShim) Infof(format string, v ...interface{}) { - if l.level >= printferLevelInfo { - l.logger.Printf(format+"\n", v...) - } -} - -// Warnf logs a warning message using Printf conventions. -func (l *leveledLoggerPrintferShim) Warnf(format string, v ...interface{}) { - // The original Stripe log level system didn't have a concept for warnings, - // so just reuse the same levels as error. - if l.level >= printferLevelError { - l.logger.Printf(format+"\n", v...) - } -} - -// -// Private functions -// - -func init() { - // Defaults to logging nothing, but also makes sure that we have a logger - // so that we don't panic on a `nil` when the library tries to log - // something. - Logger = log.New(os.Stderr, "", log.LstdFlags) -} diff --git a/log_test.go b/log_test.go index 6f7ce0b0b3..c1592f1801 100644 --- a/log_test.go +++ b/log_test.go @@ -2,7 +2,6 @@ package stripe import ( "bytes" - "log" "testing" assert "github.com/stretchr/testify/require" @@ -13,14 +12,7 @@ import ( // func TestDefaultLeveledLogger(t *testing.T) { - // We don't set DefaultLeveledLogger by default for backwards compatibility - // reasons. If we did, then it would override Logger, which many people - // have been setting over the years. - assert.Nil(t, DefaultLeveledLogger) - - // Logger continues to be set by default so that we have a non-nil object - // to log against. - _, ok := Logger.(*log.Logger) + _, ok := DefaultLeveledLogger.(*LeveledLogger) assert.True(t, ok) } @@ -114,82 +106,6 @@ func TestLeveledLoggerErrorf(t *testing.T) { } } -// -// leveledLoggerPrintferShim -// - -func TestLeveledLoggerPrintferShimDebugf(t *testing.T) { - var stdout bytes.Buffer - logger := &leveledLoggerPrintferShim{logger: log.New(&stdout, "", 0)} - - { - clearBuffers(&stdout) - logger.level = printferLevelDebug - - logger.Debugf("test") - assert.Equal(t, "test\n", stdout.String()) - } - - // Expect no logging - for _, level := range []printferLevel{printferLevelInfo, printferLevelError} { - clearBuffers(&stdout) - logger.level = level - - logger.Debugf("test") - assert.Equal(t, "", stdout.String()) - } -} - -func TestLeveledLoggerPrintferShimInfof(t *testing.T) { - var stdout bytes.Buffer - logger := &leveledLoggerPrintferShim{logger: log.New(&stdout, "", 0)} - - for _, level := range []printferLevel{printferLevelDebug, printferLevelInfo} { - clearBuffers(&stdout) - logger.level = level - - logger.Infof("test") - assert.Equal(t, "test\n", stdout.String()) - } - - // Expect no logging - for _, level := range []printferLevel{printferLevelError} { - clearBuffers(&stdout) - logger.level = level - - logger.Infof("test") - assert.Equal(t, "", stdout.String()) - } -} - -// Note: behaves identically to Errorf because historically there was no -// warning level. -func TestLeveledLoggerPrintferShimWarnf(t *testing.T) { - var stdout bytes.Buffer - logger := &leveledLoggerPrintferShim{logger: log.New(&stdout, "", 0)} - - for _, level := range []printferLevel{printferLevelDebug, printferLevelInfo, printferLevelError} { - clearBuffers(&stdout) - logger.level = level - - logger.Warnf("test") - assert.Equal(t, "test\n", stdout.String()) - } -} - -func TestLeveledLoggerPrintferShimErrorf(t *testing.T) { - var stdout bytes.Buffer - logger := &leveledLoggerPrintferShim{logger: log.New(&stdout, "", 0)} - - for _, level := range []printferLevel{printferLevelDebug, printferLevelInfo, printferLevelError} { - clearBuffers(&stdout) - logger.level = level - - logger.Errorf("test") - assert.Equal(t, "test\n", stdout.String()) - } -} - // // Private functions // diff --git a/stripe.go b/stripe.go index 6aaf455ffc..891a9f1810 100644 --- a/stripe.go +++ b/stripe.go @@ -176,27 +176,13 @@ type BackendConfig struct { // also provides out-of-the-box compatibility with a Logrus Logger, but may // require a thin shim for use with other logging libraries that use less // standard conventions like Zap. - LeveledLogger LeveledLoggerInterface - - // LogLevel is the logging level of the library and defined by: - // - // 0: no logging - // 1: errors only - // 2: errors + informational (default) - // 3: errors + informational + debug - // - // Defaults to 0 (no logging), so please make sure to set this if you want - // to see logging output in your custom configuration. - // - // Deprecated: Logging should be configured with LeveledLogger instead. - LogLevel int - - // Logger is where this backend will write its logs. // - // If left unset, it'll be set to Logger. + // Defaults to DefaultLeveledLogger. // - // Deprecated: Logging should be configured with LeveledLogger instead. - Logger Printfer + // To set a logger that logs nothing, set this to a stripe.LeveledLogger + // with a Level of LevelNull (simply setting this field to nil will not + // work). + LeveledLogger LeveledLoggerInterface // MaxNetworkRetries sets maximum number of times that the library will // retry requests that appear to have failed due to an intermittent @@ -813,9 +799,7 @@ func GetBackend(backendType SupportedBackend) Backend { backendType, &BackendConfig{ HTTPClient: httpClient, - LeveledLogger: DefaultLeveledLogger, - LogLevel: LogLevel, - Logger: Logger, + LeveledLogger: nil, // Set by GetBackendWithConfiguation when nil MaxNetworkRetries: 0, URL: "", // Set by GetBackendWithConfiguation when empty }, @@ -835,14 +819,7 @@ func GetBackendWithConfig(backendType SupportedBackend, config *BackendConfig) B } if config.LeveledLogger == nil { - if config.Logger == nil { - config.Logger = Logger - } - - config.LeveledLogger = &leveledLoggerPrintferShim{ - level: printferLevel(config.LogLevel), - logger: config.Logger, - } + config.LeveledLogger = DefaultLeveledLogger } switch backendType { diff --git a/stripe_test.go b/stripe_test.go index c252220c1c..7f5ce9147b 100644 --- a/stripe_test.go +++ b/stripe_test.go @@ -5,10 +5,8 @@ import ( "context" "encoding/json" "fmt" - "log" "net/http" "net/http/httptest" - "os" "regexp" "runtime" "sync" @@ -19,6 +17,15 @@ import ( assert "github.com/stretchr/testify/require" ) +// A shortcut for a leveled logger that spits out all debug information (useful in tests). +var debugLeveledLogger = &LeveledLogger{ + Level: LevelDebug, +} + +// +// --- +// + func TestBearerAuth(t *testing.T) { c := GetBackend(APIBackend).(*BackendImplementation) key := "apiKey" @@ -93,7 +100,7 @@ func TestDo_Retry(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - LogLevel: 3, + LeveledLogger: debugLeveledLogger, MaxNetworkRetries: 5, URL: testServer.URL, }, @@ -253,7 +260,7 @@ func TestDo_RetryOnTimeout(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - LogLevel: 3, + LeveledLogger: debugLeveledLogger, MaxNetworkRetries: 1, URL: testServer.URL, HTTPClient: &http.Client{Timeout: timeout}, @@ -306,7 +313,7 @@ func TestDo_LastResponsePopulated(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - LogLevel: 3, + LeveledLogger: debugLeveledLogger, MaxNetworkRetries: 0, URL: testServer.URL, }, @@ -365,7 +372,7 @@ func TestDo_TelemetryDisabled(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - LogLevel: 3, + LeveledLogger: debugLeveledLogger, MaxNetworkRetries: 0, URL: testServer.URL, }, @@ -454,7 +461,7 @@ func TestDo_TelemetryEnabled(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - LogLevel: 3, + LeveledLogger: debugLeveledLogger, MaxNetworkRetries: 0, URL: testServer.URL, EnableTelemetry: true, @@ -512,7 +519,7 @@ func TestDo_TelemetryEnabledNoDataRace(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - LogLevel: 3, + LeveledLogger: debugLeveledLogger, MaxNetworkRetries: 0, URL: testServer.URL, EnableTelemetry: true, @@ -561,32 +568,15 @@ func TestFormatURLPath(t *testing.T) { func TestGetBackendWithConfig_Loggers(t *testing.T) { leveledLogger := &LeveledLogger{} - logger := log.New(os.Stdout, "", 0) - - // Prefers a LeveledLogger - { - backend := GetBackendWithConfig( - APIBackend, - &BackendConfig{ - LeveledLogger: leveledLogger, - Logger: logger, - }, - ).(*BackendImplementation) - assert.Equal(t, leveledLogger, backend.LeveledLogger) - } - - // Falls back to Logger - { - backend := GetBackendWithConfig( - APIBackend, - &BackendConfig{ - Logger: logger, - }, - ).(*BackendImplementation) + backend := GetBackendWithConfig( + APIBackend, + &BackendConfig{ + LeveledLogger: leveledLogger, + }, + ).(*BackendImplementation) - assert.NotNil(t, backend.LeveledLogger) - } + assert.Equal(t, leveledLogger, backend.LeveledLogger) } func TestGetBackendWithConfig_TrimV1Suffix(t *testing.T) { diff --git a/testing/testing.go b/testing/testing.go index a911ce3d39..7522524137 100644 --- a/testing/testing.go +++ b/testing/testing.go @@ -90,9 +90,9 @@ func init() { stripeMockBackend := stripe.GetBackendWithConfig( stripe.APIBackend, &stripe.BackendConfig{ - URL: "https://localhost:" + port, - HTTPClient: httpClient, - Logger: stripe.Logger, + URL: "https://localhost:" + port, + HTTPClient: httpClient, + LeveledLogger: stripe.DefaultLeveledLogger, }, ) stripe.SetBackend(stripe.APIBackend, stripeMockBackend) From 74f3fd00fd426d15c47e02e9a0610184aab2497d Mon Sep 17 00:00:00 2001 From: Brandur Date: Fri, 17 Apr 2020 10:40:51 -0700 Subject: [PATCH 7/8] Default number of network retries to 2 (#1069) Currently, it's possible to have the library retry intermittently failed requests by configuring `MaxNetworkRetries` on a `BackendConfig`. Because this is a pretty useful feature that many users will never discover because it's off by default, we've been mulling around the idea internally to change that default on the next major so that more people get access to it. We're about to release V71, so now is an opportune moment. The slight complication is that `BackendConfig.MaxNetworkRetries` is currently a simple `int`, which means that it's hard for us to recognize an unset value versus an explicitly set 0 (the same problem we had with fields on parameter structs for years). So by example, this code is problematic: ``` go if conf.MaxNetworkRetries == 0 { backend.MaxNetworkRetries = 2 } ``` The most obvious solution is that change `MaxNetworkRetries` to a nilable pointer, and have it set using our `stripe.Int64` helper, exactly as we do for parameter structs. So compared to today, configuring it would change like this: ``` patch config := &stripe.BackendConfig{ - MaxNetworkRetries: 2, + MaxNetworkRetries: stripe.Int64(2), } ``` It's not too bad, and follows convention found elsewhere in the library, but will require a small code update for users. The slight follow on complication is that to make `BackendConfig` self-consistent, I also changed the other primitives on it to also be pointers, so `EnableTelemetry` changes from `bool` to `*bool` and `URL` changes from `string` to `*string`. I don't think this is a big deal because ~99% of users will probably just be using the defaults by having left them unset. --- README.md | 21 +++++++------- error_test.go | 2 +- oauth/client_test.go | 2 +- order/client_test.go | 2 +- stripe.go | 65 +++++++++++++++++++++++++++++--------------- stripe_test.go | 40 +++++++++++++-------------- testing/testing.go | 2 +- 7 files changed, 77 insertions(+), 57 deletions(-) diff --git a/README.md b/README.md index 01eb3584b7..64f9a65b3d 100644 --- a/README.md +++ b/README.md @@ -237,10 +237,15 @@ if err := i.Err(); err != nil { } ``` -### Configuring Automatic Retries +### Automatic Retries -You can enable automatic retries on requests that fail due to a transient -problem by configuring the maximum number of retries: +The library automatically retries requests on intermittent failures like on a +connection error, timeout, or on certain API responses like a status `409 +Conflict`. [Idempotency keys][idempotency-keys] are always added to requests to +make any such subsequent retries safe. + +By default, it will perform up to two retries. That number can be configured +with `MaxNetworkRetries`: ```go import ( @@ -249,7 +254,7 @@ import ( ) config := &stripe.BackendConfig{ - MaxNetworkRetries: 2, + MaxNetworkRetries: stripe.Int64(0), // Zero retries } sc := &client.API{} @@ -261,12 +266,6 @@ sc.Init("sk_key", &stripe.Backends{ coupon, err := sc.Coupons.New(...) ``` -Various errors can trigger a retry, like a connection error or a timeout, and -also certain API responses like HTTP status `409 Conflict`. - -[Idempotency keys][idempotency-keys] are added to requests to guarantee that -retries are safe. - ### Configuring Logging By default, the library logs error messages only (which are sent to `stderr`). @@ -331,7 +330,7 @@ You can disable this behavior if you prefer: ```go config := &stripe.BackendConfig{ - EnableTelemetry: false, + EnableTelemetry: stripe.Bool(false), } ``` diff --git a/error_test.go b/error_test.go index 06003035b7..010d02b5b1 100644 --- a/error_test.go +++ b/error_test.go @@ -23,7 +23,7 @@ func TestErrorResponse(t *testing.T) { defer ts.Close() backend := GetBackendWithConfig(APIBackend, &BackendConfig{ - URL: ts.URL, + URL: String(ts.URL), }) err := backend.Call(http.MethodGet, "/v1/account", "sk_test_badKey", nil, nil) diff --git a/oauth/client_test.go b/oauth/client_test.go index dd98735fd7..ad3c804e7f 100644 --- a/oauth/client_test.go +++ b/oauth/client_test.go @@ -121,7 +121,7 @@ func stubConnectBackend(httpClient *http.Client) { mockBackend := stripe.GetBackendWithConfig( stripe.ConnectBackend, &stripe.BackendConfig{ - URL: "https://localhost:12113", + URL: stripe.String("https://localhost:12113"), HTTPClient: httpClient, }, ) diff --git a/order/client_test.go b/order/client_test.go index a22921bc98..89023aa5a8 100644 --- a/order/client_test.go +++ b/order/client_test.go @@ -64,7 +64,7 @@ func TestOrderReturn_RequestParams(t *testing.T) { // Configure the stripe client to use the ephemeral backend. backend := stripe.GetBackendWithConfig(stripe.APIBackend, &stripe.BackendConfig{ - URL: ts.URL, + URL: stripe.String(ts.URL), }) orderClient := Client{B: backend, Key: stripe.Key} diff --git a/stripe.go b/stripe.go index 891a9f1810..39e831b0c5 100644 --- a/stripe.go +++ b/stripe.go @@ -43,6 +43,10 @@ const ( // OAuth. ConnectBackend SupportedBackend = "connect" + // DefaultMaxNetworkRetries is the default maximum number of retries made + // by a Stripe client. + DefaultMaxNetworkRetries int64 = 2 + // UnknownPlatform is the string returned as the system name if we couldn't get // one from `uname`. UnknownPlatform string = "unknown platform" @@ -152,7 +156,7 @@ type Backend interface { Call(method, path, key string, params ParamsContainer, v LastResponseSetter) error CallRaw(method, path, key string, body *form.Values, params *Params, v LastResponseSetter) error CallMultipart(method, path, key, boundary string, body *bytes.Buffer, params *Params, v LastResponseSetter) error - SetMaxNetworkRetries(maxNetworkRetries int) + SetMaxNetworkRetries(maxNetworkRetries int64) } // BackendConfig is used to configure a new Stripe backend. @@ -160,8 +164,11 @@ type BackendConfig struct { // EnableTelemetry allows request metrics (request id and duration) to be sent // to Stripe in subsequent requests via the `X-Stripe-Client-Telemetry` header. // + // This value is a pointer to allow us to differentiate an unset versus + // empty value. Use stripe.Bool for an easy way to set this value. + // // Defaults to false. - EnableTelemetry bool + EnableTelemetry *bool // HTTPClient is an HTTP client instance to use when making API requests. // @@ -188,13 +195,19 @@ type BackendConfig struct { // retry requests that appear to have failed due to an intermittent // problem. // - // Defaults to 0. - MaxNetworkRetries int + // This value is a pointer to allow us to differentiate an unset versus + // empty value. Use stripe.Int64 for an easy way to set this value. + // + // Defaults to DefaultMaxNetworkRetries (2). + MaxNetworkRetries *int64 // URL is the base URL to use for API paths. // + // This value is a pointer to allow us to differentiate an unset versus + // empty value. Use stripe.String for an easy way to set this value. + // // If left empty, it'll be set to the default for the SupportedBackend. - URL string + URL *string } // BackendImplementation is the internal implementation for making HTTP calls @@ -207,7 +220,7 @@ type BackendImplementation struct { URL string HTTPClient *http.Client LeveledLogger LeveledLoggerInterface - MaxNetworkRetries int + MaxNetworkRetries int64 enableTelemetry bool @@ -557,7 +570,7 @@ func (s *BackendImplementation) ResponseToError(res *http.Response, resBody []by // SetMaxNetworkRetries sets max number of retries on failed requests // // This function is deprecated. Please use GetBackendWithConfig instead. -func (s *BackendImplementation) SetMaxNetworkRetries(maxNetworkRetries int) { +func (s *BackendImplementation) SetMaxNetworkRetries(maxNetworkRetries int64) { s.MaxNetworkRetries = maxNetworkRetries } @@ -600,7 +613,7 @@ func (s *BackendImplementation) UnmarshalJSONVerbose(statusCode int, body []byte // socket errors that may represent an intermittent problem and some special // HTTP statuses. func (s *BackendImplementation) shouldRetry(err error, req *http.Request, resp *http.Response, numRetries int) bool { - if numRetries >= s.MaxNetworkRetries { + if numRetries >= int(s.MaxNetworkRetries) { return false } @@ -800,8 +813,8 @@ func GetBackend(backendType SupportedBackend) Backend { &BackendConfig{ HTTPClient: httpClient, LeveledLogger: nil, // Set by GetBackendWithConfiguation when nil - MaxNetworkRetries: 0, - URL: "", // Set by GetBackendWithConfiguation when empty + MaxNetworkRetries: nil, // Set by GetBackendWithConfiguation when nil + URL: nil, // Set by GetBackendWithConfiguation when nil }, ) @@ -822,31 +835,35 @@ func GetBackendWithConfig(backendType SupportedBackend, config *BackendConfig) B config.LeveledLogger = DefaultLeveledLogger } + if config.MaxNetworkRetries == nil { + config.MaxNetworkRetries = Int64(DefaultMaxNetworkRetries) + } + switch backendType { case APIBackend: - if config.URL == "" { - config.URL = apiURL + if config.URL == nil { + config.URL = String(apiURL) } - config.URL = normalizeURL(config.URL) + config.URL = String(normalizeURL(*config.URL)) return newBackendImplementation(backendType, config) case UploadsBackend: - if config.URL == "" { - config.URL = uploadsURL + if config.URL == nil { + config.URL = String(uploadsURL) } - config.URL = normalizeURL(config.URL) + config.URL = String(normalizeURL(*config.URL)) return newBackendImplementation(backendType, config) case ConnectBackend: - if config.URL == "" { - config.URL = ConnectURL + if config.URL == nil { + config.URL = String(ConnectURL) } - config.URL = normalizeURL(config.URL) + config.URL = String(normalizeURL(*config.URL)) return newBackendImplementation(backendType, config) } @@ -1139,8 +1156,12 @@ func isHTTPWriteMethod(method string) bool { // The vast majority of the time you should be calling GetBackendWithConfig // instead of this function. func newBackendImplementation(backendType SupportedBackend, config *BackendConfig) Backend { + enableTelemetry := EnableTelemetry + if config.EnableTelemetry != nil { + enableTelemetry = *config.EnableTelemetry + } + var requestMetricsBuffer chan requestMetrics - enableTelemetry := config.EnableTelemetry || EnableTelemetry // only allocate the requestMetrics buffer if client telemetry is enabled. if enableTelemetry { @@ -1150,9 +1171,9 @@ func newBackendImplementation(backendType SupportedBackend, config *BackendConfi return &BackendImplementation{ HTTPClient: config.HTTPClient, LeveledLogger: config.LeveledLogger, - MaxNetworkRetries: config.MaxNetworkRetries, + MaxNetworkRetries: *config.MaxNetworkRetries, Type: backendType, - URL: config.URL, + URL: *config.URL, enableTelemetry: enableTelemetry, networkRetriesSleep: true, requestMetricsBuffer: requestMetricsBuffer, diff --git a/stripe_test.go b/stripe_test.go index 7f5ce9147b..71377f647d 100644 --- a/stripe_test.go +++ b/stripe_test.go @@ -101,8 +101,8 @@ func TestDo_Retry(t *testing.T) { APIBackend, &BackendConfig{ LeveledLogger: debugLeveledLogger, - MaxNetworkRetries: 5, - URL: testServer.URL, + MaxNetworkRetries: Int64(5), + URL: String(testServer.URL), }, ).(*BackendImplementation) @@ -130,12 +130,12 @@ func TestDo_Retry(t *testing.T) { } func TestShouldRetry(t *testing.T) { - MaxNetworkRetries := 3 + MaxNetworkRetries := int64(3) c := GetBackendWithConfig( APIBackend, &BackendConfig{ - MaxNetworkRetries: MaxNetworkRetries, + MaxNetworkRetries: Int64(MaxNetworkRetries), }, ).(*BackendImplementation) @@ -144,7 +144,7 @@ func TestShouldRetry(t *testing.T) { nil, &http.Request{}, &http.Response{}, - MaxNetworkRetries, + int(MaxNetworkRetries), )) // Doesn't retry most Stripe errors (they must also match a status code @@ -261,8 +261,8 @@ func TestDo_RetryOnTimeout(t *testing.T) { APIBackend, &BackendConfig{ LeveledLogger: debugLeveledLogger, - MaxNetworkRetries: 1, - URL: testServer.URL, + MaxNetworkRetries: Int64(1), + URL: String(testServer.URL), HTTPClient: &http.Client{Timeout: timeout}, }, ).(*BackendImplementation) @@ -314,8 +314,8 @@ func TestDo_LastResponsePopulated(t *testing.T) { APIBackend, &BackendConfig{ LeveledLogger: debugLeveledLogger, - MaxNetworkRetries: 0, - URL: testServer.URL, + MaxNetworkRetries: Int64(0), + URL: String(testServer.URL), }, ).(*BackendImplementation) @@ -373,8 +373,8 @@ func TestDo_TelemetryDisabled(t *testing.T) { APIBackend, &BackendConfig{ LeveledLogger: debugLeveledLogger, - MaxNetworkRetries: 0, - URL: testServer.URL, + MaxNetworkRetries: Int64(0), + URL: String(testServer.URL), }, ).(*BackendImplementation) @@ -461,10 +461,10 @@ func TestDo_TelemetryEnabled(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ + EnableTelemetry: Bool(true), LeveledLogger: debugLeveledLogger, - MaxNetworkRetries: 0, - URL: testServer.URL, - EnableTelemetry: true, + MaxNetworkRetries: Int64(0), + URL: String(testServer.URL), }, ).(*BackendImplementation) @@ -519,10 +519,10 @@ func TestDo_TelemetryEnabledNoDataRace(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ + EnableTelemetry: Bool(true), LeveledLogger: debugLeveledLogger, - MaxNetworkRetries: 0, - URL: testServer.URL, - EnableTelemetry: true, + MaxNetworkRetries: Int64(0), + URL: String(testServer.URL), }, ).(*BackendImplementation) @@ -584,7 +584,7 @@ func TestGetBackendWithConfig_TrimV1Suffix(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - URL: "https://api.com/v1", + URL: String("https://api.com/v1"), }, ).(*BackendImplementation) @@ -598,7 +598,7 @@ func TestGetBackendWithConfig_TrimV1Suffix(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - URL: "https://api.com/v1/", + URL: String("https://api.com/v1/"), }, ).(*BackendImplementation) @@ -610,7 +610,7 @@ func TestGetBackendWithConfig_TrimV1Suffix(t *testing.T) { backend := GetBackendWithConfig( APIBackend, &BackendConfig{ - URL: "https://api.com", + URL: String("https://api.com"), }, ).(*BackendImplementation) diff --git a/testing/testing.go b/testing/testing.go index 7522524137..a428df08a4 100644 --- a/testing/testing.go +++ b/testing/testing.go @@ -90,7 +90,7 @@ func init() { stripeMockBackend := stripe.GetBackendWithConfig( stripe.APIBackend, &stripe.BackendConfig{ - URL: "https://localhost:" + port, + URL: stripe.String("https://localhost:" + port), HTTPClient: httpClient, LeveledLogger: stripe.DefaultLeveledLogger, }, From f7797f4e6fb16cc5b5d5d5b379dac54873e51604 Mon Sep 17 00:00:00 2001 From: Brandur Date: Fri, 17 Apr 2020 13:04:23 -0700 Subject: [PATCH 8/8] Add V71 migration guide (#1072) V71 has a few non-trivial breaking changes bundled in, so add a guide with more lengthy explanations on how to handle each one (as we've done previously on occasion like for the big V32 major). --- v71_migration_guide.md | 137 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 137 insertions(+) create mode 100644 v71_migration_guide.md diff --git a/v71_migration_guide.md b/v71_migration_guide.md new file mode 100644 index 0000000000..0257217167 --- /dev/null +++ b/v71_migration_guide.md @@ -0,0 +1,137 @@ +# V71 Migration Guide + +Version 71 of stripe-go contains a few major changes. Many of them are breaking, but only in minor ways. + +## Go Modules + +The library now fully supports [Go Modules](https://github.com/golang/go/wiki/Modules), Go's preferred packaging system which is built into the language. Requires that previously looked like: + +``` go +import ( + "github.com/stripe/stripe-go" + "github.com/stripe/stripe-go/customer" +) +``` + +Should now also include a major version: + +``` go +import ( + "github.com/stripe/stripe-go/v71" + "github.com/stripe/stripe-go/v71/customer" +) +``` + +This convention is recognized by the Go toolchain. After adding a major version to paths, just run `go build`, `go install`, `go test`, etc. and it will automatically fetch stripe-go and do the right thing. + +Go Modules are supported on every version of Go supported by Stripe and basic awareness for them has been backported as far as Go 1.9. + +Upgrading to stripe-go v71 will be difficult for projects using [Dep](https://github.com/golang/dep). There have been attempts to [contribute minimal Go Module awareness](https://github.com/golang/dep/pull/1963) to the project, but no support has been able to make it in. As Dep is now unmaintained for all intents and purposes, if you're still using it, we recommend moving your project to Go Modules instead. Because Go Modules are Dep-aware (even if the vice versa is not true), this is likely easier than you'd intuitively think because the tooling supports it automatically. See the official [post on migrating to Go Modules](https://blog.golang.org/migrating-to-go-modules) for more details. + +## API response information + +All API resource structs now have a `LastResponse` that allows access to useful information on the API request that generated them. For example: + +``` go +customer, err := customer.New(params) +fmt.Printf("request ID = %s\n", customer.LastResponse.RequestID) +``` + +Note that although `LastResponse` is available on any struct that might be returned from a API call, it will only be populated for the top-level API resource that was received. e.g. When fetching an invoice from `GET /invoices/:id`, the invoice's `LastResponse` is populated, but that of its invoice items is not. However, when fetching an invoice item from `GET /invoiceitems/:id`, `LastResponse` for that invoice item is populated. + +The full struct in `LastResponse` makes these properties available: + +``` go +// APIResponse encapsulates some common features of a response from the +// Stripe API. +type APIResponse struct { + // Header contain a map of all HTTP header keys to values. Its behavior and + // caveats are identical to that of http.Header. + Header http.Header + + // IdempotencyKey contains the idempotency key used with this request. + // Idempotency keys are a Stripe-specific concept that helps guarantee that + // requests that fail and need to be retried are not duplicated. + IdempotencyKey string + + // RawJSON contains the response body as raw bytes. + RawJSON []byte + + // RequestID contains a string that uniquely identifies the Stripe request. + // Used for debugging or support purposes. + RequestID string + + // Status is a status code and message. e.g. "200 OK" + Status string + + // StatusCode is a status code as integer. e.g. 200 + StatusCode int +} +``` + +## `BackendConfig` now takes pointers + +The types for primitives on `BackendConfig` now take pointers: + +* `EnableTelemetry` changes from `bool` to `*bool`. +* `MaxNetworkRetries` changes from `int` to `*int64`. +* `URL` changes from `string` to `*string`. + +We made the change so that we can distinguish between a value that was let unset by the user versus one which has defaulted to empty (i.e. `MaxNetworkRetries` as a vanilla `int` left unset is indistinguishable from one that's been set to `0` explicitly). + +Use the standard `stripe.*` class of parameter helpers to set these easily: + +``` go +config := &stripe.BackendConfig{ + MaxNetworkRetries: stripe.Int64(2), +} +``` + +## `MaxNetworkRetries` now defaults to 2 + +The library now retries intermittently failed requests by default (i.e. if the feature has not been explicitly configured by the user) up to **two times**. This can be changed back to the previous behavior of no retries using `MaxNetworkRetries` on `BackendConfig`: + +``` go +config := &stripe.BackendConfig{ + MaxNetworkRetries: stripe.Int64(0), // Zero retries +} +``` + +## `LeveledLogger` now default + +Deprecated logging infrastructure has been removed, notably the top-level variables `stripe.LogLevel` and `stripe.Logger`. Use `DefaultLeveledLogger` instead: + +``` go +stripe.DefaultLeveledLogger = &stripe.LeveledLogger{ + Level: stripe.LevelDebug, +} +``` + +Or set `LeveledLogger` explicitly on a `BackendConfig`: + +``` go +config := &stripe.BackendConfig{ + LeveledLogger: &stripe.LeveledLogger{ + Level: stripe.LevelDebug, + }, +} +``` + +## Only errors are logged by default + +If no logging has been configured, stripe-go will now show **only errors by default**. Previously, it logged both errors and informational messages. This behavior can be reverted by setting the default logger to informational: + +``` go +stripe.DefaultLeveledLogger = &stripe.LeveledLogger{ + Level: stripe.LevelInfo, +} +``` + +## Other API changes + +* [#1052](https://github.com/stripe/stripe-go/pull/1052) Beta features have been removed from Issuing APIs +* [#1068](https://github.com/stripe/stripe-go/pull/1068) Other breaking API changes + * `PaymentIntent` is now expandable on `Charge` + * `Percentage` was removed as a filter when listing `TaxRate` + * Removed `RenewalInterval` on `SubscriptionSchedule` + * Removed `Country` and `RoutingNumber` from `ChargePaymentMethodDetailsAcssDebit`