Skip to content

Commit

Permalink
chore(api): small updates to verification addresses and Statement and…
Browse files Browse the repository at this point in the history
… LoanTape fields (#385)

- mark `verification_address` as deprecated when updating an Account
- add `statement_type` to Statements
- add `ending_balance` and `available_credit` to LoanTapes
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Oct 3, 2024
1 parent 7c52080 commit bd05727
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
16 changes: 9 additions & 7 deletions account.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,9 @@ func (r *AccountService) Get(ctx context.Context, accountToken string, opts ...o
return
}

// Update account configuration such as spend limits and verification address. Can
// only be run on accounts that are part of the program managed by this API key.
//
// Accounts that are in the `PAUSED` state will not be able to transact or create
// new cards.
// Update account configuration such as state or spend limits. Can only be run on
// accounts that are part of the program managed by this API key. Accounts that are
// in the `PAUSED` state will not be able to transact or create new cards.
func (r *AccountService) Update(ctx context.Context, accountToken string, body AccountUpdateParams, opts ...option.RequestOption) (res *Account, err error) {
opts = append(r.Options[:], opts...)
if accountToken == "" {
Expand Down Expand Up @@ -430,7 +428,9 @@ type AccountUpdateParams struct {
// Account states.
State param.Field[AccountUpdateParamsState] `json:"state"`
// Address used during Address Verification Service (AVS) checks during
// transactions if enabled via Auth Rules.
// transactions if enabled via Auth Rules. This field is deprecated as AVS checks
// are no longer supported by Authorization Rules. The field will be removed from
// the schema in a future release.
VerificationAddress param.Field[AccountUpdateParamsVerificationAddress] `json:"verification_address"`
}

Expand All @@ -455,7 +455,9 @@ func (r AccountUpdateParamsState) IsKnown() bool {
}

// Address used during Address Verification Service (AVS) checks during
// transactions if enabled via Auth Rules.
// transactions if enabled via Auth Rules. This field is deprecated as AVS checks
// are no longer supported by Authorization Rules. The field will be removed from
// the schema in a future release.
type AccountUpdateParamsVerificationAddress struct {
Address1 param.Field[string] `json:"address1"`
Address2 param.Field[string] `json:"address2"`
Expand Down
6 changes: 6 additions & 0 deletions financialaccountloantape.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ type LoanTape struct {
// Globally unique identifier for a loan tape
Token string `json:"token,required"`
AccountStanding LoanTapeAccountStanding `json:"account_standing,required"`
// Amount of credit available to spend in cents
AvailableCredit int64 `json:"available_credit,required"`
// Amount due for the prior billing cycle. Any amounts not fully paid off on this
// due date will be considered past due the next day
BalanceDue LoanTapeBalanceDue `json:"balance_due,required"`
Expand All @@ -104,6 +106,8 @@ type LoanTape struct {
// Date of transactions that this loan tape covers
Date time.Time `json:"date,required" format:"date"`
DayTotals LoanTapeDayTotals `json:"day_totals,required"`
// Balance at the end of the day
EndingBalance int64 `json:"ending_balance,required"`
// Excess credits in the form of provisional credits, payments, or purchase
// refunds. If positive, the account is in net credit state with no outstanding
// balances. An overpayment could land an account in this state
Expand All @@ -128,6 +132,7 @@ type LoanTape struct {
type loanTapeJSON struct {
Token apijson.Field
AccountStanding apijson.Field
AvailableCredit apijson.Field
BalanceDue apijson.Field
BalanceNextDue apijson.Field
BalancePastDue apijson.Field
Expand All @@ -136,6 +141,7 @@ type loanTapeJSON struct {
CreditProductToken apijson.Field
Date apijson.Field
DayTotals apijson.Field
EndingBalance apijson.Field
ExcessCredits apijson.Field
FinancialAccountToken apijson.Field
MinimumPaymentBalance apijson.Field
Expand Down
19 changes: 18 additions & 1 deletion financialaccountstatement.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@ type Statement struct {
// Date when the billing period ended
StatementEndDate time.Time `json:"statement_end_date,required" format:"date"`
// Date when the billing period began
StatementStartDate time.Time `json:"statement_start_date,required" format:"date"`
StatementStartDate time.Time `json:"statement_start_date,required" format:"date"`
StatementType StatementStatementType `json:"statement_type,required"`
// Timestamp of when the statement was updated
Updated time.Time `json:"updated,required" format:"date-time"`
YtdTotals StatementYtdTotals `json:"ytd_totals,required"`
Expand Down Expand Up @@ -142,6 +143,7 @@ type statementJSON struct {
StartingBalance apijson.Field
StatementEndDate apijson.Field
StatementStartDate apijson.Field
StatementType apijson.Field
Updated apijson.Field
YtdTotals apijson.Field
InterestDetails apijson.Field
Expand Down Expand Up @@ -283,6 +285,21 @@ func (r statementPeriodTotalsJSON) RawJSON() string {
return r.raw
}

type StatementStatementType string

const (
StatementStatementTypeInitial StatementStatementType = "INITIAL"
StatementStatementTypePeriodEnd StatementStatementType = "PERIOD_END"
)

func (r StatementStatementType) IsKnown() bool {
switch r {
case StatementStatementTypeInitial, StatementStatementTypePeriodEnd:
return true
}
return false
}

type StatementYtdTotals struct {
// Opening balance transferred from previous account in cents
BalanceTransfers int64 `json:"balance_transfers,required"`
Expand Down

0 comments on commit bd05727

Please sign in to comment.