mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
* feat(*): add tink bank bridge * add tests * fix tink calls * fixes after review * fixes after review again * add const for actor id * fix missing psuID * fix tests * cancel payments instead
501 lines
17 KiB
Go
501 lines
17 KiB
Go
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
|
|
package components
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"fmt"
|
|
"github.com/formancehq/payments/pkg/client/internal/utils"
|
|
)
|
|
|
|
type V3InstallConnectorRequestType string
|
|
|
|
const (
|
|
V3InstallConnectorRequestTypeAdyen V3InstallConnectorRequestType = "Adyen"
|
|
V3InstallConnectorRequestTypeAtlar V3InstallConnectorRequestType = "Atlar"
|
|
V3InstallConnectorRequestTypeBankingcircle V3InstallConnectorRequestType = "Bankingcircle"
|
|
V3InstallConnectorRequestTypeColumn V3InstallConnectorRequestType = "Column"
|
|
V3InstallConnectorRequestTypeCurrencycloud V3InstallConnectorRequestType = "Currencycloud"
|
|
V3InstallConnectorRequestTypeDummypay V3InstallConnectorRequestType = "Dummypay"
|
|
V3InstallConnectorRequestTypeGeneric V3InstallConnectorRequestType = "Generic"
|
|
V3InstallConnectorRequestTypeIncrease V3InstallConnectorRequestType = "Increase"
|
|
V3InstallConnectorRequestTypeMangopay V3InstallConnectorRequestType = "Mangopay"
|
|
V3InstallConnectorRequestTypeModulr V3InstallConnectorRequestType = "Modulr"
|
|
V3InstallConnectorRequestTypeMoneycorp V3InstallConnectorRequestType = "Moneycorp"
|
|
V3InstallConnectorRequestTypePlaid V3InstallConnectorRequestType = "Plaid"
|
|
V3InstallConnectorRequestTypePowens V3InstallConnectorRequestType = "Powens"
|
|
V3InstallConnectorRequestTypeQonto V3InstallConnectorRequestType = "Qonto"
|
|
V3InstallConnectorRequestTypeStripe V3InstallConnectorRequestType = "Stripe"
|
|
V3InstallConnectorRequestTypeTink V3InstallConnectorRequestType = "Tink"
|
|
V3InstallConnectorRequestTypeWise V3InstallConnectorRequestType = "Wise"
|
|
)
|
|
|
|
type V3InstallConnectorRequest struct {
|
|
V3AdyenConfig *V3AdyenConfig `queryParam:"inline"`
|
|
V3AtlarConfig *V3AtlarConfig `queryParam:"inline"`
|
|
V3BankingcircleConfig *V3BankingcircleConfig `queryParam:"inline"`
|
|
V3ColumnConfig *V3ColumnConfig `queryParam:"inline"`
|
|
V3CurrencycloudConfig *V3CurrencycloudConfig `queryParam:"inline"`
|
|
V3DummypayConfig *V3DummypayConfig `queryParam:"inline"`
|
|
V3GenericConfig *V3GenericConfig `queryParam:"inline"`
|
|
V3IncreaseConfig *V3IncreaseConfig `queryParam:"inline"`
|
|
V3MangopayConfig *V3MangopayConfig `queryParam:"inline"`
|
|
V3ModulrConfig *V3ModulrConfig `queryParam:"inline"`
|
|
V3MoneycorpConfig *V3MoneycorpConfig `queryParam:"inline"`
|
|
V3PlaidConfig *V3PlaidConfig `queryParam:"inline"`
|
|
V3PowensConfig *V3PowensConfig `queryParam:"inline"`
|
|
V3QontoConfig *V3QontoConfig `queryParam:"inline"`
|
|
V3StripeConfig *V3StripeConfig `queryParam:"inline"`
|
|
V3TinkConfig *V3TinkConfig `queryParam:"inline"`
|
|
V3WiseConfig *V3WiseConfig `queryParam:"inline"`
|
|
|
|
Type V3InstallConnectorRequestType
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestAdyen(adyen V3AdyenConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeAdyen
|
|
|
|
typStr := string(typ)
|
|
adyen.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3AdyenConfig: &adyen,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestAtlar(atlar V3AtlarConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeAtlar
|
|
|
|
typStr := string(typ)
|
|
atlar.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3AtlarConfig: &atlar,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestBankingcircle(bankingcircle V3BankingcircleConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeBankingcircle
|
|
|
|
typStr := string(typ)
|
|
bankingcircle.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3BankingcircleConfig: &bankingcircle,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestColumn(column V3ColumnConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeColumn
|
|
|
|
typStr := string(typ)
|
|
column.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3ColumnConfig: &column,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestCurrencycloud(currencycloud V3CurrencycloudConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeCurrencycloud
|
|
|
|
typStr := string(typ)
|
|
currencycloud.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3CurrencycloudConfig: ¤cycloud,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestDummypay(dummypay V3DummypayConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeDummypay
|
|
|
|
typStr := string(typ)
|
|
dummypay.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3DummypayConfig: &dummypay,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestGeneric(generic V3GenericConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeGeneric
|
|
|
|
typStr := string(typ)
|
|
generic.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3GenericConfig: &generic,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestIncrease(increase V3IncreaseConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeIncrease
|
|
|
|
typStr := string(typ)
|
|
increase.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3IncreaseConfig: &increase,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestMangopay(mangopay V3MangopayConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeMangopay
|
|
|
|
typStr := string(typ)
|
|
mangopay.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3MangopayConfig: &mangopay,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestModulr(modulr V3ModulrConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeModulr
|
|
|
|
typStr := string(typ)
|
|
modulr.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3ModulrConfig: &modulr,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestMoneycorp(moneycorp V3MoneycorpConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeMoneycorp
|
|
|
|
typStr := string(typ)
|
|
moneycorp.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3MoneycorpConfig: &moneycorp,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestPlaid(plaid V3PlaidConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypePlaid
|
|
|
|
typStr := string(typ)
|
|
plaid.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3PlaidConfig: &plaid,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestPowens(powens V3PowensConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypePowens
|
|
|
|
typStr := string(typ)
|
|
powens.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3PowensConfig: &powens,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestQonto(qonto V3QontoConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeQonto
|
|
|
|
typStr := string(typ)
|
|
qonto.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3QontoConfig: &qonto,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestStripe(stripe V3StripeConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeStripe
|
|
|
|
typStr := string(typ)
|
|
stripe.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3StripeConfig: &stripe,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestTink(tink V3TinkConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeTink
|
|
|
|
typStr := string(typ)
|
|
tink.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3TinkConfig: &tink,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateV3InstallConnectorRequestWise(wise V3WiseConfig) V3InstallConnectorRequest {
|
|
typ := V3InstallConnectorRequestTypeWise
|
|
|
|
typStr := string(typ)
|
|
wise.Provider = &typStr
|
|
|
|
return V3InstallConnectorRequest{
|
|
V3WiseConfig: &wise,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func (u *V3InstallConnectorRequest) UnmarshalJSON(data []byte) error {
|
|
|
|
type discriminator struct {
|
|
Provider string `json:"provider"`
|
|
}
|
|
|
|
dis := new(discriminator)
|
|
if err := json.Unmarshal(data, &dis); err != nil {
|
|
return fmt.Errorf("could not unmarshal discriminator: %w", err)
|
|
}
|
|
|
|
switch dis.Provider {
|
|
case "Adyen":
|
|
v3AdyenConfig := new(V3AdyenConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3AdyenConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Adyen) type V3AdyenConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3AdyenConfig = v3AdyenConfig
|
|
u.Type = V3InstallConnectorRequestTypeAdyen
|
|
return nil
|
|
case "Atlar":
|
|
v3AtlarConfig := new(V3AtlarConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3AtlarConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Atlar) type V3AtlarConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3AtlarConfig = v3AtlarConfig
|
|
u.Type = V3InstallConnectorRequestTypeAtlar
|
|
return nil
|
|
case "Bankingcircle":
|
|
v3BankingcircleConfig := new(V3BankingcircleConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3BankingcircleConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Bankingcircle) type V3BankingcircleConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3BankingcircleConfig = v3BankingcircleConfig
|
|
u.Type = V3InstallConnectorRequestTypeBankingcircle
|
|
return nil
|
|
case "Column":
|
|
v3ColumnConfig := new(V3ColumnConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3ColumnConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Column) type V3ColumnConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3ColumnConfig = v3ColumnConfig
|
|
u.Type = V3InstallConnectorRequestTypeColumn
|
|
return nil
|
|
case "Currencycloud":
|
|
v3CurrencycloudConfig := new(V3CurrencycloudConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3CurrencycloudConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Currencycloud) type V3CurrencycloudConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3CurrencycloudConfig = v3CurrencycloudConfig
|
|
u.Type = V3InstallConnectorRequestTypeCurrencycloud
|
|
return nil
|
|
case "Dummypay":
|
|
v3DummypayConfig := new(V3DummypayConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3DummypayConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Dummypay) type V3DummypayConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3DummypayConfig = v3DummypayConfig
|
|
u.Type = V3InstallConnectorRequestTypeDummypay
|
|
return nil
|
|
case "Generic":
|
|
v3GenericConfig := new(V3GenericConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3GenericConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Generic) type V3GenericConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3GenericConfig = v3GenericConfig
|
|
u.Type = V3InstallConnectorRequestTypeGeneric
|
|
return nil
|
|
case "Increase":
|
|
v3IncreaseConfig := new(V3IncreaseConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3IncreaseConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Increase) type V3IncreaseConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3IncreaseConfig = v3IncreaseConfig
|
|
u.Type = V3InstallConnectorRequestTypeIncrease
|
|
return nil
|
|
case "Mangopay":
|
|
v3MangopayConfig := new(V3MangopayConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3MangopayConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Mangopay) type V3MangopayConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3MangopayConfig = v3MangopayConfig
|
|
u.Type = V3InstallConnectorRequestTypeMangopay
|
|
return nil
|
|
case "Modulr":
|
|
v3ModulrConfig := new(V3ModulrConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3ModulrConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Modulr) type V3ModulrConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3ModulrConfig = v3ModulrConfig
|
|
u.Type = V3InstallConnectorRequestTypeModulr
|
|
return nil
|
|
case "Moneycorp":
|
|
v3MoneycorpConfig := new(V3MoneycorpConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3MoneycorpConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Moneycorp) type V3MoneycorpConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3MoneycorpConfig = v3MoneycorpConfig
|
|
u.Type = V3InstallConnectorRequestTypeMoneycorp
|
|
return nil
|
|
case "Plaid":
|
|
v3PlaidConfig := new(V3PlaidConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3PlaidConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Plaid) type V3PlaidConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3PlaidConfig = v3PlaidConfig
|
|
u.Type = V3InstallConnectorRequestTypePlaid
|
|
return nil
|
|
case "Powens":
|
|
v3PowensConfig := new(V3PowensConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3PowensConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Powens) type V3PowensConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3PowensConfig = v3PowensConfig
|
|
u.Type = V3InstallConnectorRequestTypePowens
|
|
return nil
|
|
case "Qonto":
|
|
v3QontoConfig := new(V3QontoConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3QontoConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Qonto) type V3QontoConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3QontoConfig = v3QontoConfig
|
|
u.Type = V3InstallConnectorRequestTypeQonto
|
|
return nil
|
|
case "Stripe":
|
|
v3StripeConfig := new(V3StripeConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3StripeConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Stripe) type V3StripeConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3StripeConfig = v3StripeConfig
|
|
u.Type = V3InstallConnectorRequestTypeStripe
|
|
return nil
|
|
case "Tink":
|
|
v3TinkConfig := new(V3TinkConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3TinkConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Tink) type V3TinkConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3TinkConfig = v3TinkConfig
|
|
u.Type = V3InstallConnectorRequestTypeTink
|
|
return nil
|
|
case "Wise":
|
|
v3WiseConfig := new(V3WiseConfig)
|
|
if err := utils.UnmarshalJSON(data, &v3WiseConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Wise) type V3WiseConfig within V3InstallConnectorRequest: %w", string(data), err)
|
|
}
|
|
|
|
u.V3WiseConfig = v3WiseConfig
|
|
u.Type = V3InstallConnectorRequestTypeWise
|
|
return nil
|
|
}
|
|
|
|
return fmt.Errorf("could not unmarshal `%s` into any supported union types for V3InstallConnectorRequest", string(data))
|
|
}
|
|
|
|
func (u V3InstallConnectorRequest) MarshalJSON() ([]byte, error) {
|
|
if u.V3AdyenConfig != nil {
|
|
return utils.MarshalJSON(u.V3AdyenConfig, "", true)
|
|
}
|
|
|
|
if u.V3AtlarConfig != nil {
|
|
return utils.MarshalJSON(u.V3AtlarConfig, "", true)
|
|
}
|
|
|
|
if u.V3BankingcircleConfig != nil {
|
|
return utils.MarshalJSON(u.V3BankingcircleConfig, "", true)
|
|
}
|
|
|
|
if u.V3ColumnConfig != nil {
|
|
return utils.MarshalJSON(u.V3ColumnConfig, "", true)
|
|
}
|
|
|
|
if u.V3CurrencycloudConfig != nil {
|
|
return utils.MarshalJSON(u.V3CurrencycloudConfig, "", true)
|
|
}
|
|
|
|
if u.V3DummypayConfig != nil {
|
|
return utils.MarshalJSON(u.V3DummypayConfig, "", true)
|
|
}
|
|
|
|
if u.V3GenericConfig != nil {
|
|
return utils.MarshalJSON(u.V3GenericConfig, "", true)
|
|
}
|
|
|
|
if u.V3IncreaseConfig != nil {
|
|
return utils.MarshalJSON(u.V3IncreaseConfig, "", true)
|
|
}
|
|
|
|
if u.V3MangopayConfig != nil {
|
|
return utils.MarshalJSON(u.V3MangopayConfig, "", true)
|
|
}
|
|
|
|
if u.V3ModulrConfig != nil {
|
|
return utils.MarshalJSON(u.V3ModulrConfig, "", true)
|
|
}
|
|
|
|
if u.V3MoneycorpConfig != nil {
|
|
return utils.MarshalJSON(u.V3MoneycorpConfig, "", true)
|
|
}
|
|
|
|
if u.V3PlaidConfig != nil {
|
|
return utils.MarshalJSON(u.V3PlaidConfig, "", true)
|
|
}
|
|
|
|
if u.V3PowensConfig != nil {
|
|
return utils.MarshalJSON(u.V3PowensConfig, "", true)
|
|
}
|
|
|
|
if u.V3QontoConfig != nil {
|
|
return utils.MarshalJSON(u.V3QontoConfig, "", true)
|
|
}
|
|
|
|
if u.V3StripeConfig != nil {
|
|
return utils.MarshalJSON(u.V3StripeConfig, "", true)
|
|
}
|
|
|
|
if u.V3TinkConfig != nil {
|
|
return utils.MarshalJSON(u.V3TinkConfig, "", true)
|
|
}
|
|
|
|
if u.V3WiseConfig != nil {
|
|
return utils.MarshalJSON(u.V3WiseConfig, "", true)
|
|
}
|
|
|
|
return nil, errors.New("could not marshal union type V3InstallConnectorRequest: all fields are null")
|
|
}
|