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 #1318

Merged
merged 1 commit into from
Jul 21, 2021
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
32 changes: 18 additions & 14 deletions charge/client.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Package charge provides API functions related to charges.
//
// For more details, see: https://stripe.com/docs/api/go#charges.
//
// File generated from our OpenAPI spec
//
//

// Package charge provides the /charges APIs
package charge

import (
Expand All @@ -10,7 +14,7 @@ import (
"github.com/stripe/stripe-go/v72/form"
)

// Client is used to invoke APIs related to charges.
// Client is used to invoke /charges APIs.
type Client struct {
B stripe.Backend
Key string
Expand All @@ -28,51 +32,51 @@ func (c Client) New(params *stripe.ChargeParams) (*stripe.Charge, error) {
return charge, err
}

// Get retrieves a charge.
// Get returns the details of a charge.
func Get(id string, params *stripe.ChargeParams) (*stripe.Charge, error) {
return getC().Get(id, params)
}

// Get retrieves a charge.
// Get returns the details of a charge.
func (c Client) Get(id string, params *stripe.ChargeParams) (*stripe.Charge, error) {
path := stripe.FormatURLPath("/v1/charges/%s", id)
charge := &stripe.Charge{}
err := c.B.Call(http.MethodGet, path, c.Key, params, charge)
return charge, err
}

// Update updates a charge.
// Update updates a charge's properties.
func Update(id string, params *stripe.ChargeParams) (*stripe.Charge, error) {
return getC().Update(id, params)
}

// Update updates a charge.
// Update updates a charge's properties.
func (c Client) Update(id string, params *stripe.ChargeParams) (*stripe.Charge, error) {
path := stripe.FormatURLPath("/v1/charges/%s", id)
charge := &stripe.Charge{}
err := c.B.Call(http.MethodPost, path, c.Key, params, charge)
return charge, err
}

// Capture captures a charge that's not yet captured.
// Capture is the method for the `POST /v1/charges/{charge}/capture` API.
func Capture(id string, params *stripe.CaptureParams) (*stripe.Charge, error) {
return getC().Capture(id, params)
}

// Capture captures a charge that's not yet captured.
// Capture is the method for the `POST /v1/charges/{charge}/capture` API.
func (c Client) Capture(id string, params *stripe.CaptureParams) (*stripe.Charge, error) {
path := stripe.FormatURLPath("/v1/charges/%s/capture", id)
charge := &stripe.Charge{}
err := c.B.Call(http.MethodPost, path, c.Key, params, charge)
return charge, err
}

// List returns an iterator that iterates all charges.
// List returns a list of charges.
func List(params *stripe.ChargeListParams) *Iter {
return getC().List(params)
}

// List returns an iterator that iterates all charges.
// List returns a list of charges.
func (c Client) List(listParams *stripe.ChargeListParams) *Iter {
return &Iter{
Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) {
Expand All @@ -99,9 +103,9 @@ func (i *Iter) Charge() *stripe.Charge {
return i.Current().(*stripe.Charge)
}

// ChargeList returns the current list object which the iterator is currently
// using. List objects will change as new API calls are made to continue
// pagination.
// ChargeList 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) ChargeList() *stripe.ChargeList {
return i.List().(*stripe.ChargeList)
}
Expand Down
11 changes: 11 additions & 0 deletions issuing_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,16 @@ const (
IssuingTransactionTypeRefund IssuingTransactionType = "refund"
)

// The digital wallet used for this transaction. One of `apple_pay`, `google_pay`, or `samsung_pay`.
type IssuingTransactionWallet string

// List of values that IssuingTransactionWallet can take
const (
IssuingTransactionWalletApplePay IssuingTransactionWallet = "apple_pay"
IssuingTransactionWalletGooglePay IssuingTransactionWallet = "google_pay"
IssuingTransactionWalletSamsungPay IssuingTransactionWallet = "samsung_pay"
)

// IssuingTransactionParams is the set of parameters that can be used when creating or updating an issuing transaction.
type IssuingTransactionParams struct {
Params `form:"*"`
Expand Down Expand Up @@ -129,6 +139,7 @@ type IssuingTransaction struct {
Object string `json:"object"`
PurchaseDetails *IssuingTransactionPurchaseDetails `json:"purchase_details"`
Type IssuingTransactionType `json:"type"`
Wallet IssuingTransactionWallet `json:"wallet"`
}

// IssuingTransactionList is a list of issuing transactions as retrieved from a list endpoint.
Expand Down
7 changes: 2 additions & 5 deletions quote.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@

package stripe

import (
"encoding/json"

"github.com/stripe/stripe-go/v72/form"
)
import "encoding/json"
import "github.com/stripe/stripe-go/v72/form"

// The status of the most recent automated tax calculation for this quote.
type QuoteAutomaticTaxStatus string
Expand Down
4 changes: 2 additions & 2 deletions quote/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
//
//

// Package quote provides the /quotes/{quote}/computed_upfront_line_items APIs
// Package quote provides the /quotes APIs
package quote

import (
Expand All @@ -14,7 +14,7 @@ import (
"github.com/stripe/stripe-go/v72/form"
)

// Client is used to invoke /quotes/{quote}/computed_upfront_line_items APIs.
// Client is used to invoke /quotes APIs.
type Client struct {
B stripe.Backend
PDFBackend stripe.Backend
Expand Down
72 changes: 40 additions & 32 deletions taxrate/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
//
//
// File generated from our OpenAPI spec
//
//

// Package taxrate provides the /tax_rates APIs
package taxrate

Expand All @@ -14,16 +20,16 @@ type Client struct {
Key string
}

// New creates a new tr.
// New creates a new tax rate.
func New(params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
return getC().New(params)
}

// New creates a new tr.
// New creates a new tax rate.
func (c Client) New(params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
tr := &stripe.TaxRate{}
err := c.B.Call(http.MethodPost, "/v1/tax_rates", c.Key, params, tr)
return tr, err
taxrate := &stripe.TaxRate{}
err := c.B.Call(http.MethodPost, "/v1/tax_rates", c.Key, params, taxrate)
return taxrate, err
}

// Get returns the details of a tax rate.
Expand All @@ -34,9 +40,9 @@ func Get(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
// Get returns the details of a tax rate.
func (c Client) Get(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
path := stripe.FormatURLPath("/v1/tax_rates/%s", id)
tr := &stripe.TaxRate{}
err := c.B.Call(http.MethodGet, path, c.Key, params, tr)
return tr, err
taxrate := &stripe.TaxRate{}
err := c.B.Call(http.MethodGet, path, c.Key, params, taxrate)
return taxrate, err
}

// Update updates a tax rate's properties.
Expand All @@ -47,9 +53,9 @@ func Update(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
// Update updates a tax rate's properties.
func (c Client) Update(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
path := stripe.FormatURLPath("/v1/tax_rates/%s", id)
tr := &stripe.TaxRate{}
err := c.B.Call(http.MethodPost, path, c.Key, params, tr)
return tr, err
taxrate := &stripe.TaxRate{}
err := c.B.Call(http.MethodPost, path, c.Key, params, taxrate)
return taxrate, err
}

// Del removes a tax rate.
Expand All @@ -60,44 +66,46 @@ func Del(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
// Del removes a tax rate.
func (c Client) Del(id string, params *stripe.TaxRateParams) (*stripe.TaxRate, error) {
path := stripe.FormatURLPath("/v1/tax_rates/%s", id)
tr := &stripe.TaxRate{}
err := c.B.Call(http.MethodDelete, path, c.Key, params, tr)
return tr, err
taxrate := &stripe.TaxRate{}
err := c.B.Call(http.MethodDelete, path, c.Key, params, taxrate)
return taxrate, err
}

// List returns a list of trs.
// List returns a list of tax rates.
func List(params *stripe.TaxRateListParams) *Iter {
return getC().List(params)
}

// List returns a list of trs.
// List returns a list of tax rates.
func (c Client) List(listParams *stripe.TaxRateListParams) *Iter {
return &Iter{stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) {
list := &stripe.TaxRateList{}
err := c.B.CallRaw(http.MethodGet, "/v1/tax_rates", c.Key, b, p, list)

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

return ret, list, err
})}
return &Iter{
Iter: stripe.GetIter(listParams, func(p *stripe.Params, b *form.Values) ([]interface{}, stripe.ListContainer, error) {
list := &stripe.TaxRateList{}
err := c.B.CallRaw(http.MethodGet, "/v1/tax_rates", 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 trs.
// Iter is an iterator for tax rates.
type Iter struct {
*stripe.Iter
}

// TaxRate returns the tr which the iterator is currently pointing to.
// TaxRate returns the tax rate which the iterator is currently pointing to.
func (i *Iter) TaxRate() *stripe.TaxRate {
return i.Current().(*stripe.TaxRate)
}

// TaxRateList returns the current list object which the iterator is currently
// using. List objects will change as new API calls are made to continue
// pagination.
// TaxRateList 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) TaxRateList() *stripe.TaxRateList {
return i.List().(*stripe.TaxRateList)
}
Expand Down