Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

API Updates for beta branch #1535

Merged
merged 8 commits into from
Aug 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## 73.4.0 - 2022-08-23
* [#1532](https://github.com/stripe/stripe-go/pull/1532) API Updates
* Change type of `TreasuryOutboundTransferDestinationPaymentMethod` from `string` to `nullable(string)`
* Change return type of `FundCashBalance` method on `Customer` from `Customer` to `CustomerCashBalanceTransaction`
* This is technically a breaking change, but this return type was actually incorrect and so the result of this method did not deserialize correctly.
* Change return type of `RetrieveFeatures` and `UpdateFeatures` methods on `TreasuryFinancialAccount` from `TreasuryFinancialAccount` to `TreasuryFinancialAccountFeatures`
* This is technically a breaking change, but this return type was actually incorrect and so the result of this method did not deserialize correctly.
* [#1530](https://github.com/stripe/stripe-go/pull/1530) Add beta readme.md section

## 73.4.0-beta.1 - 2022-08-23
* [#1531](https://github.com/stripe/stripe-go/pull/1531) API Updates for beta branch
- Updated stable APIs to the latest version
Expand Down
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v184
v185
32 changes: 28 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@

The official [Stripe][stripe] Go client library.

## Support

New features and bug fixes are released on the latest major version of the Stripe Go client library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.

## Installation

Make sure your project is using Go Modules (it will have a `go.mod` file in its
Expand Down Expand Up @@ -470,6 +466,34 @@ config := &stripe.BackendConfig{
}
```

### Beta SDKs

Stripe has features in the beta phase that can be accessed via the beta version of this package.
We would love for you to try these and share feedback with us before these features reach the stable phase.
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/[email protected]
```

> **Note**
> There can be breaking changes between beta versions.

We highly recommend keeping an eye on when the beta feature you are interested in goes from beta to stable so that you can move from using a beta version of the SDK to the stable version.

If your beta feature requires a `Stripe-Version` header to be sent, use the `stripe.APIVersion` field to set it:

> **Note**
> The `APIVersion` can only be set in beta versions of the library.

```go
stripe.APIVersion += "; feature_beta=v3"
```

## Support

New features and bug fixes are released on the latest major version of the Stripe Go client library. If you are on an older major version, we recommend that you upgrade to the latest in order to use the new features and bug fixes including those for security vulnerabilities. Older major versions of the package will continue to be available for use, but will not be receiving any updates.

## Development

Pull requests from the community are welcome. If you submit one, please keep
Expand Down
8 changes: 8 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ import (
"github.com/stripe/stripe-go/v73/filelink"
financialconnectionsaccount "github.com/stripe/stripe-go/v73/financialconnections/account"
financialconnectionssession "github.com/stripe/stripe-go/v73/financialconnections/session"
giftcardscard "github.com/stripe/stripe-go/v73/giftcards/card"
giftcardstransaction "github.com/stripe/stripe-go/v73/giftcards/transaction"
identityverificationreport "github.com/stripe/stripe-go/v73/identity/verificationreport"
identityverificationsession "github.com/stripe/stripe-go/v73/identity/verificationsession"
"github.com/stripe/stripe-go/v73/invoice"
Expand Down Expand Up @@ -179,6 +181,10 @@ type API struct {
FinancialConnectionsAccounts *financialconnectionsaccount.Client
// FinancialConnectionsSessions is the client used to invoke /financial_connections/sessions APIs.
FinancialConnectionsSessions *financialconnectionssession.Client
// GiftCardsCards is the client used to invoke /gift_cards/cards APIs.
GiftCardsCards *giftcardscard.Client
// GiftCardsTransactions is the client used to invoke /gift_cards/transactions APIs.
GiftCardsTransactions *giftcardstransaction.Client
// IdentityVerificationReports is the client used to invoke /identity/verification_reports APIs.
IdentityVerificationReports *identityverificationreport.Client
// IdentityVerificationSessions is the client used to invoke /identity/verification_sessions APIs.
Expand Down Expand Up @@ -373,6 +379,8 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.Files = &file.Client{B: backends.Uploads, Key: key}
a.FinancialConnectionsAccounts = &financialconnectionsaccount.Client{B: backends.API, Key: key}
a.FinancialConnectionsSessions = &financialconnectionssession.Client{B: backends.API, Key: key}
a.GiftCardsCards = &giftcardscard.Client{B: backends.API, Key: key}
a.GiftCardsTransactions = &giftcardstransaction.Client{B: backends.API, Key: key}
a.IdentityVerificationReports = &identityverificationreport.Client{B: backends.API, Key: key}
a.IdentityVerificationSessions = &identityverificationsession.Client{B: backends.API, Key: key}
a.InvoiceItems = &invoiceitem.Client{B: backends.API, Key: key}
Expand Down
20 changes: 10 additions & 10 deletions customer/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,16 @@ func (c Client) Del(id string, params *stripe.CustomerParams) (*stripe.Customer,
}

// CreateFundingInstructions is the method for the `POST /v1/customers/{customer}/funding_instructions` API.
func CreateFundingInstructions(id string, params *stripe.CustomerCreateFundingInstructionsParams) (*stripe.Customer, error) {
func CreateFundingInstructions(id string, params *stripe.CustomerCreateFundingInstructionsParams) (*stripe.FundingInstructions, error) {
return getC().CreateFundingInstructions(id, params)
}

// CreateFundingInstructions is the method for the `POST /v1/customers/{customer}/funding_instructions` API.
func (c Client) CreateFundingInstructions(id string, params *stripe.CustomerCreateFundingInstructionsParams) (*stripe.Customer, error) {
func (c Client) CreateFundingInstructions(id string, params *stripe.CustomerCreateFundingInstructionsParams) (*stripe.FundingInstructions, error) {
path := stripe.FormatURLPath("/v1/customers/%s/funding_instructions", id)
customer := &stripe.Customer{}
err := c.B.Call(http.MethodPost, path, c.Key, params, customer)
return customer, err
fundinginstructions := &stripe.FundingInstructions{}
err := c.B.Call(http.MethodPost, path, c.Key, params, fundinginstructions)
return fundinginstructions, err
}

// DeleteDiscount is the method for the `DELETE /v1/customers/{customer}/discount` API.
Expand All @@ -98,20 +98,20 @@ func (c Client) DeleteDiscount(id string, params *stripe.CustomerDeleteDiscountP
}

// RetrievePaymentMethod is the method for the `GET /v1/customers/{customer}/payment_methods/{payment_method}` API.
func RetrievePaymentMethod(id string, params *stripe.CustomerRetrievePaymentMethodParams) (*stripe.Customer, error) {
func RetrievePaymentMethod(id string, params *stripe.CustomerRetrievePaymentMethodParams) (*stripe.PaymentMethod, error) {
return getC().RetrievePaymentMethod(id, params)
}

// RetrievePaymentMethod is the method for the `GET /v1/customers/{customer}/payment_methods/{payment_method}` API.
func (c Client) RetrievePaymentMethod(id string, params *stripe.CustomerRetrievePaymentMethodParams) (*stripe.Customer, error) {
func (c Client) RetrievePaymentMethod(id string, params *stripe.CustomerRetrievePaymentMethodParams) (*stripe.PaymentMethod, error) {
path := stripe.FormatURLPath(
"/v1/customers/%s/payment_methods/%s",
stripe.StringValue(params.Customer),
id,
)
customer := &stripe.Customer{}
err := c.B.Call(http.MethodGet, path, c.Key, params, customer)
return customer, err
paymentmethod := &stripe.PaymentMethod{}
err := c.B.Call(http.MethodGet, path, c.Key, params, paymentmethod)
return paymentmethod, err
}

// List returns a list of customers.
Expand Down
1 change: 1 addition & 0 deletions fundinginstructions.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ type FundingInstructionsBankTransfer struct {
// `financial_addresses` field.
// Related guide: [Customer Balance - Funding Instructions](https://stripe.com/docs/payments/customer-balance/funding-instructions) to learn more
type FundingInstructions struct {
APIResource
BankTransfer *FundingInstructionsBankTransfer `json:"bank_transfer"`
// Three-letter [ISO currency code](https://www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](https://stripe.com/docs/currencies).
Currency Currency `json:"currency"`
Expand Down
120 changes: 120 additions & 0 deletions giftcards/card/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
//
//
// File generated from our OpenAPI spec
//
//

// Package card provides the /gift_cards/cards APIs
package card

import (
"net/http"

stripe "github.com/stripe/stripe-go/v73"
"github.com/stripe/stripe-go/v73/form"
)

// Client is used to invoke /gift_cards/cards APIs.
type Client struct {
B stripe.Backend
Key string
}

// New creates a new gift cards card.
func New(params *stripe.GiftCardsCardParams) (*stripe.GiftCardsCard, error) {
return getC().New(params)
}

// New creates a new gift cards card.
func (c Client) New(params *stripe.GiftCardsCardParams) (*stripe.GiftCardsCard, error) {
card := &stripe.GiftCardsCard{}
err := c.B.Call(http.MethodPost, "/v1/gift_cards/cards", c.Key, params, card)
return card, err
}

// Get returns the details of a gift cards card.
func Get(id string, params *stripe.GiftCardsCardParams) (*stripe.GiftCardsCard, error) {
return getC().Get(id, params)
}

// Get returns the details of a gift cards card.
func (c Client) Get(id string, params *stripe.GiftCardsCardParams) (*stripe.GiftCardsCard, error) {
path := stripe.FormatURLPath("/v1/gift_cards/cards/%s", id)
card := &stripe.GiftCardsCard{}
err := c.B.Call(http.MethodGet, path, c.Key, params, card)
return card, err
}

// Update updates a gift cards card's properties.
func Update(id string, params *stripe.GiftCardsCardParams) (*stripe.GiftCardsCard, error) {
return getC().Update(id, params)
}

// Update updates a gift cards card's properties.
func (c Client) Update(id string, params *stripe.GiftCardsCardParams) (*stripe.GiftCardsCard, error) {
path := stripe.FormatURLPath("/v1/gift_cards/cards/%s", id)
card := &stripe.GiftCardsCard{}
err := c.B.Call(http.MethodPost, path, c.Key, params, card)
return card, err
}

// Validate is the method for the `POST /v1/gift_cards/cards/validate` API.
func Validate(params *stripe.GiftCardsCardValidateParams) (*stripe.GiftCardsCard, error) {
return getC().Validate(params)
}

// Validate is the method for the `POST /v1/gift_cards/cards/validate` API.
func (c Client) Validate(params *stripe.GiftCardsCardValidateParams) (*stripe.GiftCardsCard, error) {
card := &stripe.GiftCardsCard{}
err := c.B.Call(
http.MethodPost,
"/v1/gift_cards/cards/validate",
c.Key,
params,
card,
)
return card, err
}

// List returns a list of gift cards cards.
func List(params *stripe.GiftCardsCardListParams) *Iter {
return getC().List(params)
}

// List returns a list of gift cards cards.
func (c Client) List(listParams *stripe.GiftCardsCardListParams) *Iter {
return &Iter{
Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) {
list := &stripe.GiftCardsCardList{}
err := c.B.CallRaw(http.MethodGet, "/v1/gift_cards/cards", c.Key, b, p, list)

ret := make([]interface{}, len(list.Data))
for i, v := range list.Data {
ret[i] = v
}

return ret, list, err
}),
}
}

// Iter is an iterator for gift cards cards.
type Iter struct {
*stripe.Iter
}

// GiftCardsCard returns the gift cards card which the iterator is currently pointing to.
func (i *Iter) GiftCardsCard() *stripe.GiftCardsCard {
return i.Current().(*stripe.GiftCardsCard)
}

// GiftCardsCardList returns the current list object which the iterator is
// currently using. List objects will change as new API calls are made to
// continue pagination.
func (i *Iter) GiftCardsCardList() *stripe.GiftCardsCardList {
return i.List().(*stripe.GiftCardsCardList)
}

func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}
Loading