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

Merged
merged 4 commits into from
May 5, 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
26 changes: 26 additions & 0 deletions checkout_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,17 @@ const (
CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethodMicrodeposits CheckoutSessionPaymentMethodOptionsACSSDebitVerificationMethod = "microdeposits"
)

// The list of permissions to request. The `payment_method` permission must be included.
type CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission string

// List of values that CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission can take
const (
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionBalances CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "balances"
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionOwnership CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "ownership"
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionPaymentMethod CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "payment_method"
CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermissionTransactions CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission = "transactions"
)

// Bank account verification method.
type CheckoutSessionPaymentMethodOptionsUSBankAccountVerificationMethod string

Expand Down Expand Up @@ -467,8 +478,16 @@ type CheckoutSessionPaymentMethodOptionsOXXOParams struct {
ExpiresAfterDays *int64 `form:"expires_after_days"`
}

// Additional fields for Financial Connections Session creation
type CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsParams struct {
// The list of permissions to request. If this parameter is passed, the `payment_method` permission must be included. Valid permissions include: `balances`, `payment_method`, and `transactions`.
Permissions []*string `form:"permissions"`
}

// contains details about the Us Bank Account payment method options.
type CheckoutSessionPaymentMethodOptionsUSBankAccountParams struct {
// Additional fields for Financial Connections Session creation
FinancialConnections *CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsParams `form:"financial_connections"`
// Verification method for the intent
VerificationMethod *string `form:"verification_method"`
}
Expand Down Expand Up @@ -849,7 +868,14 @@ type CheckoutSessionPaymentMethodOptionsOXXO struct {
// The number of calendar days before an OXXO invoice expires. For example, if you create an OXXO invoice on Monday and you set expires_after_days to 2, the OXXO invoice will expire on Wednesday at 23:59 America/Mexico_City time.
ExpiresAfterDays int64 `json:"expires_after_days"`
}
type CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnections struct {
// The list of permissions to request. The `payment_method` permission must be included.
Permissions []CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnectionsPermission `json:"permissions"`
// For webview integrations only. Upon completing OAuth login in the native browser, the user will be redirected to this URL to return to your app.
ReturnURL string `json:"return_url"`
}
type CheckoutSessionPaymentMethodOptionsUSBankAccount struct {
FinancialConnections *CheckoutSessionPaymentMethodOptionsUSBankAccountFinancialConnections `json:"financial_connections"`
// Bank account verification method.
VerificationMethod CheckoutSessionPaymentMethodOptionsUSBankAccountVerificationMethod `json:"verification_method"`
}
Expand Down
8 changes: 8 additions & 0 deletions client/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import (
"github.com/stripe/stripe-go/v72/feerefund"
"github.com/stripe/stripe-go/v72/file"
"github.com/stripe/stripe-go/v72/filelink"
financialconnectionsaccount "github.com/stripe/stripe-go/v72/financialconnections/account"
financialconnectionssession "github.com/stripe/stripe-go/v72/financialconnections/session"
identityverificationreport "github.com/stripe/stripe-go/v72/identity/verificationreport"
identityverificationsession "github.com/stripe/stripe-go/v72/identity/verificationsession"
"github.com/stripe/stripe-go/v72/invoice"
Expand Down Expand Up @@ -150,6 +152,10 @@ type API struct {
FileLinks *filelink.Client
// Files is the client used to invoke /files APIs.
Files *file.Client
// FinancialConnectionsAccounts is the client used to invoke /financial_connections/accounts APIs.
FinancialConnectionsAccounts *financialconnectionsaccount.Client
// FinancialConnectionsSessions is the client used to invoke /financial_connections/sessions APIs.
FinancialConnectionsSessions *financialconnectionssession.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 @@ -306,6 +312,8 @@ func (a *API) Init(key string, backends *stripe.Backends) {
a.Fees = &fee.Client{B: backends.API, Key: key}
a.FileLinks = &filelink.Client{B: backends.API, Key: key}
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.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
69 changes: 69 additions & 0 deletions financialconnections/account/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
//
//
// File generated from our OpenAPI spec
//
//

// Package account provides the /financial_connections/accounts APIs
package account

import (
"net/http"

stripe "github.com/stripe/stripe-go/v72"
)

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

// GetByID returns the details of a financial connections account.
func GetByID(id string, params *stripe.FinancialConnectionsAccountParams) (*stripe.FinancialConnectionsAccount, error) {
return getC().GetByID(id, params)
}

// GetByID returns the details of a financial connections account.
func (c Client) GetByID(id string, params *stripe.FinancialConnectionsAccountParams) (*stripe.FinancialConnectionsAccount, error) {
path := stripe.FormatURLPath("/v1/financial_connections/accounts/%s", id)
account := &stripe.FinancialConnectionsAccount{}
err := c.B.Call(http.MethodGet, path, c.Key, params, account)
return account, err
}

// Disconnect is the method for the `POST /v1/financial_connections/accounts/{account}/disconnect` API.
func Disconnect(id string, params *stripe.FinancialConnectionsAccountDisconnectParams) (*stripe.FinancialConnectionsAccount, error) {
return getC().Disconnect(id, params)
}

// Disconnect is the method for the `POST /v1/financial_connections/accounts/{account}/disconnect` API.
func (c Client) Disconnect(id string, params *stripe.FinancialConnectionsAccountDisconnectParams) (*stripe.FinancialConnectionsAccount, error) {
path := stripe.FormatURLPath(
"/v1/financial_connections/accounts/%s/disconnect",
id,
)
account := &stripe.FinancialConnectionsAccount{}
err := c.B.Call(http.MethodPost, path, c.Key, params, account)
return account, err
}

// Refresh is the method for the `POST /v1/financial_connections/accounts/{account}/refresh` API.
func Refresh(id string, params *stripe.FinancialConnectionsAccountRefreshParams) (*stripe.FinancialConnectionsAccount, error) {
return getC().Refresh(id, params)
}

// Refresh is the method for the `POST /v1/financial_connections/accounts/{account}/refresh` API.
func (c Client) Refresh(id string, params *stripe.FinancialConnectionsAccountRefreshParams) (*stripe.FinancialConnectionsAccount, error) {
path := stripe.FormatURLPath(
"/v1/financial_connections/accounts/%s/refresh",
id,
)
account := &stripe.FinancialConnectionsAccount{}
err := c.B.Call(http.MethodPost, path, c.Key, params, account)
return account, err
}

func getC() Client {
return Client{stripe.GetBackend(stripe.APIBackend), stripe.Key}
}
55 changes: 55 additions & 0 deletions financialconnections/session/client.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
//
//
// File generated from our OpenAPI spec
//
//

// Package session provides the /financial_connections/sessions APIs
package session

import (
"net/http"

stripe "github.com/stripe/stripe-go/v72"
)

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

// New creates a new financial connections session.
func New(params *stripe.FinancialConnectionsSessionParams) (*stripe.FinancialConnectionsSession, error) {
return getC().New(params)
}

// New creates a new financial connections session.
func (c Client) New(params *stripe.FinancialConnectionsSessionParams) (*stripe.FinancialConnectionsSession, error) {
session := &stripe.FinancialConnectionsSession{}
err := c.B.Call(
http.MethodPost,
"/v1/financial_connections/sessions",
c.Key,
params,
session,
)
return session, err
}

// Get returns the details of a financial connections session.
func Get(id string, params *stripe.FinancialConnectionsSessionParams) (*stripe.FinancialConnectionsSession, error) {
return getC().Get(id, params)
}

// Get returns the details of a financial connections session.
func (c Client) Get(id string, params *stripe.FinancialConnectionsSessionParams) (*stripe.FinancialConnectionsSession, error) {
path := stripe.FormatURLPath("/v1/financial_connections/sessions/%s", id)
session := &stripe.FinancialConnectionsSession{}
err := c.B.Call(http.MethodGet, path, c.Key, params, session)
return session, err
}

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