Skip to content

Commit

Permalink
Update generated code for v454
Browse files Browse the repository at this point in the history
  • Loading branch information
stripe-openapi[bot] committed Aug 9, 2023
1 parent 73b52a6 commit a815611
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
2 changes: 1 addition & 1 deletion OPENAPI_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v452
v454
29 changes: 28 additions & 1 deletion customercashbalancetransaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

package stripe

import "encoding/json"

// The funding method type used to fund the customer balance. Permitted values include: `eu_bank_transfer`, `gb_bank_transfer`, `jp_bank_transfer`, `mx_bank_transfer`, or `us_bank_transfer`.
type CustomerCashBalanceTransactionFundedBankTransferType string

Expand Down Expand Up @@ -33,6 +35,7 @@ type CustomerCashBalanceTransactionType string

// List of values that CustomerCashBalanceTransactionType can take
const (
CustomerCashBalanceTransactionTypeAdjustedForOverdraft CustomerCashBalanceTransactionType = "adjusted_for_overdraft"
CustomerCashBalanceTransactionTypeAppliedToPayment CustomerCashBalanceTransactionType = "applied_to_payment"
CustomerCashBalanceTransactionTypeFunded CustomerCashBalanceTransactionType = "funded"
CustomerCashBalanceTransactionTypeFundingReversed CustomerCashBalanceTransactionType = "funding_reversed"
Expand All @@ -53,6 +56,10 @@ type CustomerCashBalanceTransactionListParams struct {
ListParams `form:"*"`
Customer *string `form:"-"` // Included in URL
}
type CustomerCashBalanceTransactionAdjustedForOverdraft struct {
// The [Cash Balance Transaction](https://stripe.com/docs/api/cash_balance_transactions/object) that brought the customer balance negative, triggering the clawback of funds.
LinkedTransaction *CustomerCashBalanceTransaction `json:"linked_transaction"`
}
type CustomerCashBalanceTransactionAppliedToPayment struct {
// The [Payment Intent](https://stripe.com/docs/api/payment_intents/object) that funds were applied to.
PaymentIntent *PaymentIntent `json:"payment_intent"`
Expand Down Expand Up @@ -115,7 +122,8 @@ type CustomerCashBalanceTransactionUnappliedFromPayment struct {
// to payments, and refunds to the customer.
type CustomerCashBalanceTransaction struct {
APIResource
AppliedToPayment *CustomerCashBalanceTransactionAppliedToPayment `json:"applied_to_payment"`
AdjustedForOverdraft *CustomerCashBalanceTransactionAdjustedForOverdraft `json:"adjusted_for_overdraft"`
AppliedToPayment *CustomerCashBalanceTransactionAppliedToPayment `json:"applied_to_payment"`
// Time at which the object was created. Measured in seconds since the Unix epoch.
Created int64 `json:"created"`
// 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).
Expand Down Expand Up @@ -145,3 +153,22 @@ type CustomerCashBalanceTransactionList struct {
ListMeta
Data []*CustomerCashBalanceTransaction `json:"data"`
}

// UnmarshalJSON handles deserialization of a CustomerCashBalanceTransaction.
// This custom unmarshaling is needed because the resulting
// property may be an id or the full struct if it was expanded.
func (c *CustomerCashBalanceTransaction) UnmarshalJSON(data []byte) error {
if id, ok := ParseID(data); ok {
c.ID = id
return nil
}

type customerCashBalanceTransaction CustomerCashBalanceTransaction
var v customerCashBalanceTransaction
if err := json.Unmarshal(data, &v); err != nil {
return err
}

*c = CustomerCashBalanceTransaction(v)
return nil
}

0 comments on commit a815611

Please sign in to comment.