Skip to content

Commit

Permalink
Merge pull request #1714 from stripe/merge-master
Browse files Browse the repository at this point in the history
Merge master
  • Loading branch information
pakrym-stripe authored Aug 17, 2023
2 parents f181827 + 4a61309 commit 13c7cd8
Show file tree
Hide file tree
Showing 362 changed files with 4,633 additions and 1,015 deletions.
94 changes: 94 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,103 @@
# Changelog

## 75.0.0 - 2023-08-16
* This release changes the pinned API version to `2023-08-16`. Please read the [API Upgrade Guide](https://stripe.com/docs/upgrades#2023-08-16) and carefully review the API changes before upgrading `stripe-go`.
* More information is available in the [stripe-go v75 migration guide](https://github.com/stripe/stripe-go/wiki/Migration-guide-for-v75)
* [#1705](https://github.com/stripe/stripe-go/pull/1705) Update generated code
* ⚠️Add support for new values `verification_directors_mismatch`, `verification_document_directors_mismatch`, `verification_extraneous_directors`, and `verification_missing_directors` on enums `AccountFutureRequirementsErrorsCode`, `AccountRequirementsErrorsCode`, `BankAccountFutureRequirementsErrorsCode`, and `BankAccountRequirementsErrorsCode`
* Remove support for `AvailableOn` on `BalanceTransactionListParams`
* Use of this parameter is discouraged. You may use [`.AddExtra`](https://github.com/stripe/stripe-go#parameters) if sending the parameter is still required.
* ⚠️Remove support for `Destination` on `Charge`
* Please use `TransferData` or `OnBehalfOf` instead.
* ⚠️Remove support for `AlternateStatementDescriptors` and `Dispute` on `Charge`
* Use of these parameters is discouraged.
* ⚠️Remove support for `ShippingRates` on `CheckoutSessionParams`
* Please use `ShippingParams` instead.
* ⚠️Remove support for `Coupon` and `TrialFromPlan` on `CheckoutSessionSubscriptionDataParams`
* Please [migrate to the Prices API](https://stripe.com/docs/billing/migration/migrating-prices), or use [`.AddExtra`](https://github.com/stripe/stripe-go#parameters) if sending the parameter is still required.
* ⚠️Remove support for value `charge_refunded` from enum `DisputeStatus`
* ⚠️Remove support for `BLIK` on `MandatePaymentMethodDetails`, `PaymentMethodParams`, `SetupAttemptPaymentMethodDetails`, `SetupIntentConfirmPaymentMethodOptionsParams`, `SetupIntentPaymentMethodOptionsParams`, and `SetupIntentPaymentMethodOptions`
* These fields were mistakenly released.
* ⚠️Remove support for `ACSSDebit`, `AUBECSDebit`, `Affirm`, `BACSDebit`, `CashApp`, `SEPADebit`, and `Zip` on `PaymentMethodParams`
* These fields were empty hashes.
* ⚠️Remove support for `Country` on `PaymentMethodLink`
* This field was not fully operational.
* ⚠️Remove support for `Recurring` on `PriceParams`
* This property should be set on create only.
* ⚠️Remove support for `Attributes`, `Caption`, and `DeactivateOn` on `ProductParams` and `Product`
* These fields are not fully operational.
* [#1699](https://github.com/stripe/stripe-go/pull/1699)
* Add `Metadata` and `Expand` to individual `Params` classes.
* `Expand`, `AddExpand`, `Metadata` and `AddMetadata` on embedded `Params` struct were deprecated.
Before:

```go
params := &stripe.AccountParams{
Params: stripe.Params{
Expand: []*string{stripe.String("business_profile")},
Metadata: map[string]string{
"order_id": "6735",
},
},
}
```

After:
```go
params := &stripe.AccountParams{
Expand: []*string{stripe.String("business_profile")},
Metadata: map[string]string{
"order_id": "6735",
},
}
```
You don't have to change your calls to `AddMetadata` and `AddExpand`
Before/After:
```go
params.AddMetadata("order_id", "6735")
params.AddExpand("business_profile")
```
- ⚠️ Removed deprecated `excluded_territory`, `jurisdiction_unsupported`, `vat_exempt` taxability reasons:
- `CheckoutSessionShippingCostTaxTaxabilityReasonExcludedTerritory`
- `CheckoutSessionShippingCostTaxTaxabilityReasonJurisdictionUnsupported`
- `CheckoutSessionShippingCostTaxTaxabilityReasonVATExempt`
- `CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonExcludedTerritory`
- `CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonJurisdictionUnsupported`
- `CheckoutSessionTotalDetailsBreakdownTaxTaxabilityReasonVATExempt`
- `CreditNoteShippingCostTaxTaxabilityReasonExcludedTerritory`
- `CreditNoteShippingCostTaxTaxabilityReasonJurisdictionUnsupported`
- `CreditNoteShippingCostTaxTaxabilityReasonVATExempt`
- `InvoiceShippingCostTaxTaxabilityReasonExcludedTerritory`
- `InvoiceShippingCostTaxTaxabilityReasonJurisdictionUnsupported`
- `InvoiceShippingCostTaxTaxabilityReasonVATExempt`
- `LineItemTaxTaxabilityReasonExcludedTerritory`
- `LineItemTaxTaxabilityReasonJurisdictionUnsupported`
- `LineItemTaxTaxabilityReasonVATExempt`
- `QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonExcludedTerritory`
- `QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonJurisdictionUnsupported`
- `QuoteComputedRecurringTotalDetailsBreakdownTaxTaxabilityReasonVATExempt`
- `QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonExcludedTerritory`
- `QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonJurisdictionUnsupported`
- `QuoteComputedUpfrontTotalDetailsBreakdownTaxTaxabilityReasonVATExempt`
- `QuoteTotalDetailsBreakdownTaxTaxabilityReasonExcludedTerritory`
- `QuoteTotalDetailsBreakdownTaxTaxabilityReasonJurisdictionUnsupported`
- `QuoteTotalDetailsBreakdownTaxTaxabilityReasonVATExempt`
- ⚠️ Removed deprecated error code constant `ErrorCodeCardDeclinedRateLimitExceeded`, prefer `ErrorCodeCardDeclineRateLimitExceeded`.
- ⚠️ Removed deprecated error code constant `ErrorCodeInvalidSwipeData`.
- ⚠️ Removed deprecated error code constant `ErrorCodeInvoicePamentIntentRequiresAction` prefer `ErrorCodeInvoicePaymentIntentRequiresAction`.
- ⚠️ Removed deprecated error code constant `ErrorCodeSepaUnsupportedAccount`, prefer `ErrorCodeSEPAUnsupportedAccount`.
- ⚠️ Removed deprecated error code constant `ErrorCodeSkuInactive`, prefer `ErrorCodeSKUInactive`.
- ⚠️ Removed deprecated error code constant `ErrorCodeinstantPayoutsLimitExceeded`, prefer `ErrorCodeInstantPayoutsLimitExceeded`.
## 74.31.0-beta.1 - 2023-08-10
* [#1701](https://github.com/stripe/stripe-go/pull/1701) Update generated code for beta
* Add support for `Paypal` on `PaymentMethodConfigurationParams` and `PaymentMethodConfiguration`
## 74.30.0 - 2023-08-10
* [#1702](https://github.com/stripe/stripe-go/pull/1702) Update generated code
* Add support for new values `incorporated_partnership` and `unincorporated_partnership` on enum `AccountCompanyStructure`
* Add support for new value `payment_reversal` on enum `BalanceTransactionType`
## 74.30.0-beta.1 - 2023-08-03
* [#1697](https://github.com/stripe/stripe-go/pull/1697) Update generated code for beta
* Add support for `SubmitCard` test helper method on resource `Issuing.Card`
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v458
v458
40 changes: 20 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Go Stripe
[![Go Reference](https://pkg.go.dev/badge/github.com/stripe/stripe-go)](https://pkg.go.dev/github.com/stripe/stripe-go/v74)
[![Go Reference](https://pkg.go.dev/badge/github.com/stripe/stripe-go)](https://pkg.go.dev/github.com/stripe/stripe-go/v75)
[![Build Status](https://github.com/stripe/stripe-go/actions/workflows/ci.yml/badge.svg?branch=master)](https://github.com/stripe/stripe-go/actions/workflows/ci.yml?query=branch%3Amaster)
[![Coverage Status](https://coveralls.io/repos/github/stripe/stripe-go/badge.svg?branch=master)](https://coveralls.io/github/stripe/stripe-go?branch=master)

Expand All @@ -22,8 +22,8 @@ Then, reference stripe-go in a Go program with `import`:

``` go
import (
"github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/customer"
"github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/customer"
)
```

Expand All @@ -33,7 +33,7 @@ toolchain will resolve and fetch the stripe-go module automatically.
Alternatively, you can also explicitly `go get` the package into a project:

```bash
go get -u github.com/stripe/stripe-go/v74
go get -u github.com/stripe/stripe-go/v75
```

## Documentation
Expand Down Expand Up @@ -122,8 +122,8 @@ To use a key, pass it to `API`'s `Init` function:
```go

import (
"github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/client"
"github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/client"
)

stripe := &client.API{}
Expand All @@ -144,8 +144,8 @@ import (
"google.golang.org/appengine"
"google.golang.org/appengine/urlfetch"

"github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/client"
"github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/client"
)

func handler(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -179,8 +179,8 @@ client.

```go
import (
"github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/$resource$"
"github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/$resource$"
)

// Setup
Expand Down Expand Up @@ -220,8 +220,8 @@ individual key.

```go
import (
"github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/client"
"github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/client"
)

// Setup
Expand Down Expand Up @@ -292,8 +292,8 @@ with `MaxNetworkRetries`:

```go
import (
"github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/client"
"github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/client"
)

config := &stripe.BackendConfig{
Expand Down Expand Up @@ -477,7 +477,7 @@ To mock a Stripe client for a unit tests using [GoMock](https://github.com/golan

1. Generate a `Backend` type mock.
```
mockgen -destination=mocks/backend.go -package=mocks github.com/stripe/stripe-go/v74 Backend
mockgen -destination=mocks/backend.go -package=mocks github.com/stripe/stripe-go/v75 Backend
```
2. Use the `Backend` mock to initialize and call methods on the client.
```go
Expand All @@ -488,8 +488,8 @@ import (

"github.com/golang/mock/gomock"
"github.com/stretchr/testify/assert"
"github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/account"
"github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/account"
)

func UseMockedStripeClient(t *testing.T) {
Expand Down Expand Up @@ -526,7 +526,7 @@ We would love for you to try these and share feedback with us before these featu
To install a beta version of stripe-go use the commit notation of the `go get` command to point to a beta tag:

```
go get -u github.com/stripe/stripe-go/v74@v74.3.0-beta.1
go get -u github.com/stripe/stripe-go/v75@v73.3.0-beta.1
```

> **Note**
Expand All @@ -548,8 +548,8 @@ If you would like to send a request to an undocumented API (for example you are

```go
import (
"github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/form"
"github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/form"
)

// Form-encode request params
Expand Down
38 changes: 35 additions & 3 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ package stripe

import (
"encoding/json"
"github.com/stripe/stripe-go/v74/form"
"github.com/stripe/stripe-go/v75/form"
)

// The business type.
Expand Down Expand Up @@ -177,12 +177,16 @@ type AccountParams struct {
Documents *AccountDocumentsParams `form:"documents"`
// The email address of the account holder. This is only to make the account easier to identify to you. Stripe only emails Custom accounts with your consent.
Email *string `form:"email"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
// A card or bank account to attach to the account for receiving [payouts](https://stripe.com/docs/connect/bank-debit-card-payouts) (you won't be able to use it for top-ups). You can provide either a token, like the ones returned by [Stripe.js](https://stripe.com/docs/js), or a dictionary, as documented in the `external_account` parameter for [bank account](https://stripe.com/docs/api#account_create_bank_account) creation.
//
// By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. To add additional external accounts without replacing the existing default for the currency, use the [bank account](https://stripe.com/docs/api#account_create_bank_account) or [card creation](https://stripe.com/docs/api#account_create_card) APIs.
ExternalAccount *AccountExternalAccountParams `form:"external_account"`
// Information about the person represented by the account. This field is null unless `business_type` is set to `individual`.
Individual *PersonParams `form:"individual"`
// Set of [key-value pairs](https://stripe.com/docs/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to `metadata`.
Metadata map[string]string `form:"metadata"`
// Options for customizing how the account functions within Stripe.
Settings *AccountSettingsParams `form:"settings"`
// Details on the account's acceptance of the [Stripe Services Agreement](https://stripe.com/docs/connect/updating-accounts#tos-acceptance).
Expand All @@ -191,6 +195,20 @@ type AccountParams struct {
Type *string `form:"type"`
}

// AddExpand appends a new field to expand.
func (p *AccountParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

// AddMetadata adds a new key-value pair to the Metadata.
func (p *AccountParams) AddMetadata(key string, value string) {
if p.Metadata == nil {
p.Metadata = make(map[string]string)
}

p.Metadata[key] = value
}

// An estimate of the monthly revenue of the business. Only accepted for accounts in Brazil and India.
type AccountBusinessProfileMonthlyEstimatedRevenueParams struct {
// A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
Expand Down Expand Up @@ -757,8 +775,8 @@ type AccountSettingsPayoutsScheduleParams struct {
}

// AppendTo implements custom encoding logic for AccountSettingsPayoutsScheduleParams.
func (a *AccountSettingsPayoutsScheduleParams) AppendTo(body *form.Values, keyParts []string) {
if BoolValue(a.DelayDaysMinimum) {
func (p *AccountSettingsPayoutsScheduleParams) AppendTo(body *form.Values, keyParts []string) {
if BoolValue(p.DelayDaysMinimum) {
body.Add(form.FormatKey(append(keyParts, "delay_days")), "minimum")
}
}
Expand Down Expand Up @@ -826,6 +844,13 @@ type AccountListParams struct {
ListParams `form:"*"`
Created *int64 `form:"created"`
CreatedRange *RangeQueryParams `form:"created"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
}

// AddExpand appends a new field to expand.
func (p *AccountListParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

// The documentation for the application hash.
Expand Down Expand Up @@ -857,6 +882,8 @@ type AccountControllerParams struct {
// Test-mode Custom and Express accounts can be rejected at any time. Accounts created using live-mode keys may only be rejected once all balances are zero.
type AccountRejectParams struct {
Params `form:"*"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
// The reason for rejecting the account. Can be `fraud`, `terms_of_service`, or `other`.
Reason *string `form:"reason"`
}
Expand Down Expand Up @@ -886,6 +913,11 @@ func (p *AccountExternalAccountParams) AppendTo(body *form.Values, keyParts []st
}
}

// AddExpand appends a new field to expand.
func (p *AccountRejectParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

type AccountBusinessProfileMonthlyEstimatedRevenue struct {
// A non-negative integer representing how much to charge in the [smallest currency unit](https://stripe.com/docs/currencies#zero-decimal).
Amount int64 `json:"amount"`
Expand Down
4 changes: 2 additions & 2 deletions account/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ package account
import (
"net/http"

stripe "github.com/stripe/stripe-go/v74"
"github.com/stripe/stripe-go/v74/form"
stripe "github.com/stripe/stripe-go/v75"
"github.com/stripe/stripe-go/v75/form"
)

// Client is used to invoke /accounts APIs.
Expand Down
4 changes: 2 additions & 2 deletions account/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go/v74"
_ "github.com/stripe/stripe-go/v74/testing"
stripe "github.com/stripe/stripe-go/v75"
_ "github.com/stripe/stripe-go/v75/testing"
)

func TestAccountDel(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
"github.com/stripe/stripe-go/v74/form"
"github.com/stripe/stripe-go/v75/form"
)

func TestAccountExternalAccountParams_AppendTo(t *testing.T) {
Expand Down
7 changes: 7 additions & 0 deletions accountlink.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ type AccountLinkParams struct {
Account *string `form:"account"`
// Which information the platform needs to collect from the user. One of `currently_due` or `eventually_due`. Default is `currently_due`.
Collect *string `form:"collect"`
// Specifies which fields in the response should be expanded.
Expand []*string `form:"expand"`
// The URL the user will be redirected to if the account link is expired, has been previously-visited, or is otherwise invalid. The URL you specify should attempt to generate a new account link with the same parameters used to create the original account link, then redirect the user to the new account link's URL so they can continue with Connect Onboarding. If a new account link cannot be generated or the redirect fails you should display a useful error to the user.
RefreshURL *string `form:"refresh_url"`
// The URL that the user will be redirected to upon leaving or completing the linked flow.
Expand All @@ -39,6 +41,11 @@ type AccountLinkParams struct {
Type *string `form:"type"`
}

// AddExpand appends a new field to expand.
func (p *AccountLinkParams) AddExpand(f string) {
p.Expand = append(p.Expand, &f)
}

// Account Links are the means by which a Connect platform grants a connected account permission to access
// Stripe-hosted applications, such as Connect Onboarding.
//
Expand Down
2 changes: 1 addition & 1 deletion accountlink/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ package accountlink
import (
"net/http"

stripe "github.com/stripe/stripe-go/v74"
stripe "github.com/stripe/stripe-go/v75"
)

// Client is used to invoke /account_links APIs.
Expand Down
4 changes: 2 additions & 2 deletions accountlink/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"testing"

assert "github.com/stretchr/testify/require"
stripe "github.com/stripe/stripe-go/v74"
_ "github.com/stripe/stripe-go/v74/testing"
stripe "github.com/stripe/stripe-go/v75"
_ "github.com/stripe/stripe-go/v75/testing"
)

func TestAccountLinkNew(t *testing.T) {
Expand Down
Loading

0 comments on commit 13c7cd8

Please sign in to comment.