mirror of
https://github.com/hanzo-fi/payments.git
synced 2026-10-30 20:31:20 +00:00
- go.mod module path + all self-imports: github.com/formancehq/payments -> github.com/hanzo-fi/payments (1590 .go files / 3152 refs; 20 modules: root, pkg/client, pkg/domain, 18 ce/plugins). External dep kept: formancehq/go-libs. - plugins: each ce/plugins/* consumed a *published* pkg/domain; added local 'replace .../pkg/domain => ../../../pkg/domain' (consistent with root) so every standalone plugin module builds in-monorepo. compile-plugin.sh MOD var rebranded too. - branding: README, LICENSE (dual MIT+EE; upstream copyright retained + Hanzo added), goreleaser (release images -> registry.hanzo.ai/hanzo-fi, OCI labels, homepage), proto go_package, renovate, speakeasy gen.yaml, connector-template *.gotpl. - CI: removed Numary/Formance workflows + composite action; added canonical hanzo.yml + cicd.yml (hanzoai/ci, gated HANZO_CI_ENABLED) + secretless ci.yml (go build/vet). - kept as data/compat keys: wire capability enums ALLOW_FORMANCE_*, generated SDK type client.Formance, domain field FormanceRedirectURL, OTEL_SERVICE_NAME, upstream base image. - verified: go build ./... (default + -tags ee) + all 20 nested modules green.
339 lines
10 KiB
Go
339 lines
10 KiB
Go
// Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
|
|
package components
|
|
|
|
import (
|
|
"encoding/json"
|
|
"errors"
|
|
"fmt"
|
|
"github.com/hanzo-fi/payments/pkg/client/internal/utils"
|
|
)
|
|
|
|
type ConnectorConfigType string
|
|
|
|
const (
|
|
ConnectorConfigTypeStripe ConnectorConfigType = "Stripe"
|
|
ConnectorConfigTypeDummypay ConnectorConfigType = "Dummypay"
|
|
ConnectorConfigTypeWise ConnectorConfigType = "Wise"
|
|
ConnectorConfigTypeModulr ConnectorConfigType = "Modulr"
|
|
ConnectorConfigTypeCurrencycloud ConnectorConfigType = "Currencycloud"
|
|
ConnectorConfigTypeBankingcircle ConnectorConfigType = "Bankingcircle"
|
|
ConnectorConfigTypeMangopay ConnectorConfigType = "Mangopay"
|
|
ConnectorConfigTypeMoneycorp ConnectorConfigType = "Moneycorp"
|
|
ConnectorConfigTypeAtlar ConnectorConfigType = "Atlar"
|
|
ConnectorConfigTypeAdyen ConnectorConfigType = "Adyen"
|
|
ConnectorConfigTypeGeneric ConnectorConfigType = "Generic"
|
|
)
|
|
|
|
type ConnectorConfig struct {
|
|
StripeConfig *StripeConfig `queryParam:"inline"`
|
|
DummyPayConfig *DummyPayConfig `queryParam:"inline"`
|
|
WiseConfig *WiseConfig `queryParam:"inline"`
|
|
ModulrConfig *ModulrConfig `queryParam:"inline"`
|
|
CurrencyCloudConfig *CurrencyCloudConfig `queryParam:"inline"`
|
|
BankingCircleConfig *BankingCircleConfig `queryParam:"inline"`
|
|
MangoPayConfig *MangoPayConfig `queryParam:"inline"`
|
|
MoneycorpConfig *MoneycorpConfig `queryParam:"inline"`
|
|
AtlarConfig *AtlarConfig `queryParam:"inline"`
|
|
AdyenConfig *AdyenConfig `queryParam:"inline"`
|
|
GenericConfig *GenericConfig `queryParam:"inline"`
|
|
|
|
Type ConnectorConfigType
|
|
}
|
|
|
|
func CreateConnectorConfigStripe(stripe StripeConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeStripe
|
|
|
|
typStr := string(typ)
|
|
stripe.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
StripeConfig: &stripe,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigDummypay(dummypay DummyPayConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeDummypay
|
|
|
|
typStr := string(typ)
|
|
dummypay.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
DummyPayConfig: &dummypay,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigWise(wise WiseConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeWise
|
|
|
|
typStr := string(typ)
|
|
wise.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
WiseConfig: &wise,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigModulr(modulr ModulrConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeModulr
|
|
|
|
typStr := string(typ)
|
|
modulr.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
ModulrConfig: &modulr,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigCurrencycloud(currencycloud CurrencyCloudConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeCurrencycloud
|
|
|
|
typStr := string(typ)
|
|
currencycloud.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
CurrencyCloudConfig: ¤cycloud,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigBankingcircle(bankingcircle BankingCircleConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeBankingcircle
|
|
|
|
typStr := string(typ)
|
|
bankingcircle.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
BankingCircleConfig: &bankingcircle,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigMangopay(mangopay MangoPayConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeMangopay
|
|
|
|
typStr := string(typ)
|
|
mangopay.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
MangoPayConfig: &mangopay,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigMoneycorp(moneycorp MoneycorpConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeMoneycorp
|
|
|
|
typStr := string(typ)
|
|
moneycorp.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
MoneycorpConfig: &moneycorp,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigAtlar(atlar AtlarConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeAtlar
|
|
|
|
typStr := string(typ)
|
|
atlar.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
AtlarConfig: &atlar,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigAdyen(adyen AdyenConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeAdyen
|
|
|
|
typStr := string(typ)
|
|
adyen.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
AdyenConfig: &adyen,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func CreateConnectorConfigGeneric(generic GenericConfig) ConnectorConfig {
|
|
typ := ConnectorConfigTypeGeneric
|
|
|
|
typStr := string(typ)
|
|
generic.Provider = &typStr
|
|
|
|
return ConnectorConfig{
|
|
GenericConfig: &generic,
|
|
Type: typ,
|
|
}
|
|
}
|
|
|
|
func (u *ConnectorConfig) 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 "Stripe":
|
|
stripeConfig := new(StripeConfig)
|
|
if err := utils.UnmarshalJSON(data, &stripeConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Stripe) type StripeConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.StripeConfig = stripeConfig
|
|
u.Type = ConnectorConfigTypeStripe
|
|
return nil
|
|
case "Dummypay":
|
|
dummyPayConfig := new(DummyPayConfig)
|
|
if err := utils.UnmarshalJSON(data, &dummyPayConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Dummypay) type DummyPayConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.DummyPayConfig = dummyPayConfig
|
|
u.Type = ConnectorConfigTypeDummypay
|
|
return nil
|
|
case "Wise":
|
|
wiseConfig := new(WiseConfig)
|
|
if err := utils.UnmarshalJSON(data, &wiseConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Wise) type WiseConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.WiseConfig = wiseConfig
|
|
u.Type = ConnectorConfigTypeWise
|
|
return nil
|
|
case "Modulr":
|
|
modulrConfig := new(ModulrConfig)
|
|
if err := utils.UnmarshalJSON(data, &modulrConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Modulr) type ModulrConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.ModulrConfig = modulrConfig
|
|
u.Type = ConnectorConfigTypeModulr
|
|
return nil
|
|
case "Currencycloud":
|
|
currencyCloudConfig := new(CurrencyCloudConfig)
|
|
if err := utils.UnmarshalJSON(data, ¤cyCloudConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Currencycloud) type CurrencyCloudConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.CurrencyCloudConfig = currencyCloudConfig
|
|
u.Type = ConnectorConfigTypeCurrencycloud
|
|
return nil
|
|
case "Bankingcircle":
|
|
bankingCircleConfig := new(BankingCircleConfig)
|
|
if err := utils.UnmarshalJSON(data, &bankingCircleConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Bankingcircle) type BankingCircleConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.BankingCircleConfig = bankingCircleConfig
|
|
u.Type = ConnectorConfigTypeBankingcircle
|
|
return nil
|
|
case "Mangopay":
|
|
mangoPayConfig := new(MangoPayConfig)
|
|
if err := utils.UnmarshalJSON(data, &mangoPayConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Mangopay) type MangoPayConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.MangoPayConfig = mangoPayConfig
|
|
u.Type = ConnectorConfigTypeMangopay
|
|
return nil
|
|
case "Moneycorp":
|
|
moneycorpConfig := new(MoneycorpConfig)
|
|
if err := utils.UnmarshalJSON(data, &moneycorpConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Moneycorp) type MoneycorpConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.MoneycorpConfig = moneycorpConfig
|
|
u.Type = ConnectorConfigTypeMoneycorp
|
|
return nil
|
|
case "Atlar":
|
|
atlarConfig := new(AtlarConfig)
|
|
if err := utils.UnmarshalJSON(data, &atlarConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Atlar) type AtlarConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.AtlarConfig = atlarConfig
|
|
u.Type = ConnectorConfigTypeAtlar
|
|
return nil
|
|
case "Adyen":
|
|
adyenConfig := new(AdyenConfig)
|
|
if err := utils.UnmarshalJSON(data, &adyenConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Adyen) type AdyenConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.AdyenConfig = adyenConfig
|
|
u.Type = ConnectorConfigTypeAdyen
|
|
return nil
|
|
case "Generic":
|
|
genericConfig := new(GenericConfig)
|
|
if err := utils.UnmarshalJSON(data, &genericConfig, "", true, false); err != nil {
|
|
return fmt.Errorf("could not unmarshal `%s` into expected (Provider == Generic) type GenericConfig within ConnectorConfig: %w", string(data), err)
|
|
}
|
|
|
|
u.GenericConfig = genericConfig
|
|
u.Type = ConnectorConfigTypeGeneric
|
|
return nil
|
|
}
|
|
|
|
return fmt.Errorf("could not unmarshal `%s` into any supported union types for ConnectorConfig", string(data))
|
|
}
|
|
|
|
func (u ConnectorConfig) MarshalJSON() ([]byte, error) {
|
|
if u.StripeConfig != nil {
|
|
return utils.MarshalJSON(u.StripeConfig, "", true)
|
|
}
|
|
|
|
if u.DummyPayConfig != nil {
|
|
return utils.MarshalJSON(u.DummyPayConfig, "", true)
|
|
}
|
|
|
|
if u.WiseConfig != nil {
|
|
return utils.MarshalJSON(u.WiseConfig, "", true)
|
|
}
|
|
|
|
if u.ModulrConfig != nil {
|
|
return utils.MarshalJSON(u.ModulrConfig, "", true)
|
|
}
|
|
|
|
if u.CurrencyCloudConfig != nil {
|
|
return utils.MarshalJSON(u.CurrencyCloudConfig, "", true)
|
|
}
|
|
|
|
if u.BankingCircleConfig != nil {
|
|
return utils.MarshalJSON(u.BankingCircleConfig, "", true)
|
|
}
|
|
|
|
if u.MangoPayConfig != nil {
|
|
return utils.MarshalJSON(u.MangoPayConfig, "", true)
|
|
}
|
|
|
|
if u.MoneycorpConfig != nil {
|
|
return utils.MarshalJSON(u.MoneycorpConfig, "", true)
|
|
}
|
|
|
|
if u.AtlarConfig != nil {
|
|
return utils.MarshalJSON(u.AtlarConfig, "", true)
|
|
}
|
|
|
|
if u.AdyenConfig != nil {
|
|
return utils.MarshalJSON(u.AdyenConfig, "", true)
|
|
}
|
|
|
|
if u.GenericConfig != nil {
|
|
return utils.MarshalJSON(u.GenericConfig, "", true)
|
|
}
|
|
|
|
return nil, errors.New("could not marshal union type ConnectorConfig: all fields are null")
|
|
}
|