Skip to content
Draft
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
2 changes: 1 addition & 1 deletion cmd/payments/accounts/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *CreateController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("accounts creation are only supported in >= v1.0.0")
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/payments/bankaccounts/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c *CreateController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("bank accounts are only supported in >= v1.0.0")
}

Expand All @@ -73,7 +73,7 @@ func (c *CreateController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion >= versions.V3 {
if c.PaymentsVersion.Major >= versions.V3 {
request := shared.V3CreateBankAccountRequest{}
if err := json.Unmarshal([]byte(script), &request); err != nil {
return nil, err
Expand Down
6 changes: 3 additions & 3 deletions cmd/payments/bankaccounts/forward.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (c *ForwardController) Run(cmd *cobra.Command, args []string) (fctl.Rendera
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("bank accounts are only supported in >= v1.0.0")
}

Expand All @@ -83,7 +83,7 @@ func (c *ForwardController) Run(cmd *cobra.Command, args []string) (fctl.Rendera
return nil, errors.New("connector ID is required")
}

if c.PaymentsVersion < versions.V3 {
if c.PaymentsVersion.Major < versions.V3 {
//nolint:gosimple
response, err := store.Client().Payments.V1.ForwardBankAccount(cmd.Context(), operations.ForwardBankAccountRequest{
ForwardBankAccountRequest: shared.ForwardBankAccountRequest{
Expand Down Expand Up @@ -124,7 +124,7 @@ func (c *ForwardController) Run(cmd *cobra.Command, args []string) (fctl.Rendera
}

func (c *ForwardController) Render(cmd *cobra.Command, args []string) error {
if c.PaymentsVersion < versions.V3 {
if c.PaymentsVersion.Major < versions.V3 {
pterm.Success.WithWriter(cmd.OutOrStdout()).Printfln("Bank Account %s forwarded to connector %s", c.store.BankAccountID, c.store.ConnectorID)
return nil
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/payments/bankaccounts/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *ListController) Run(cmd *cobra.Command, args []string) (fctl.Renderable
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("bank accounts are only supported in >= v1.0.0")
}

Expand All @@ -73,7 +73,7 @@ func (c *ListController) Run(cmd *cobra.Command, args []string) (fctl.Renderable
pageSize = fctl.Ptr(int64(ps))
}

if c.PaymentsVersion >= versions.V3 {
if c.PaymentsVersion.Major >= versions.V3 {
return c.v3list(cmd, store, cursor, pageSize)
}

Expand Down
4 changes: 2 additions & 2 deletions cmd/payments/bankaccounts/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ func (c *ShowController) Run(cmd *cobra.Command, args []string) (fctl.Renderable
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("bank accounts are only supported in >= v1.0.0")
}

if c.PaymentsVersion >= versions.V3 {
if c.PaymentsVersion.Major >= versions.V3 {
response, err := store.Client().Payments.V3.GetBankAccount(cmd.Context(), operations.V3GetBankAccountRequest{
BankAccountID: args[0],
})
Expand Down
4 changes: 2 additions & 2 deletions cmd/payments/bankaccounts/update_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c *UpdateMetadataController) Run(cmd *cobra.Command, args []string) (fctl.
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("bank accounts are only supported in >= v1.0.0")
}

Expand All @@ -74,7 +74,7 @@ func (c *UpdateMetadataController) Run(cmd *cobra.Command, args []string) (fctl.
if !fctl.CheckStackApprobation(cmd, store.Stack(), "You are about to set a metadata on bank account '%s'", bankAccountID) {
return nil, fctl.ErrMissingApproval
}
if c.PaymentsVersion >= versions.V3 {
if c.PaymentsVersion.Major >= versions.V3 {
request := operations.V3UpdateBankAccountMetadataRequest{
V3UpdateBankAccountMetadataRequest: &shared.V3UpdateBankAccountMetadataRequest{
Metadata: metadata,
Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/adyen.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *UpdateAdyenConnectorConfigController) Run(cmd *cobra.Command, args []st
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/atlar.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *UpdateAtlarConnectorConfigController) Run(cmd *cobra.Command, args []st
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/bankingcircle.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *UpdateBankingCircleConnectorConfigController) Run(cmd *cobra.Command, a
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/currencycloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *UpdateCurrencyCloudConnectorConfigController) Run(cmd *cobra.Command, a
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/getconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func (c *PaymentsGetConfigController) Run(cmd *cobra.Command, args []string) (fc
provider := fctl.GetString(cmd, c.providerNameFlag)
connectorID := fctl.GetString(cmd, c.connectorIDFlag)

switch c.PaymentsVersion {
switch c.PaymentsVersion.Major {
case versions.V0:
if provider == "" {
return nil, fmt.Errorf("provider is required")
Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/mangopay.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *UpdateMangopayConnectorConfigController) Run(cmd *cobra.Command, args [
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/modulr.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *UpdateModulrConnectorConfigController) Run(cmd *cobra.Command, args []s
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/moneycorp.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *UpdateMoneycorpConnectorConfigController) Run(cmd *cobra.Command, args
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (c *UpdateStripeConnectorConfigController) Run(cmd *cobra.Command, args []s
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/configs/wise.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func (c *UpdateWiseConnectorConfigController) Run(cmd *cobra.Command, args []str
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("update configs are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/install/column.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (c *PaymentsConnectorsColumnController) Run(cmd *cobra.Command, args []stri
if err := versions.GetPaymentsVersion(cmd, args, c); err != nil {
return nil, err
}
if c.PaymentsVersion < versions.V3 {
if c.PaymentsVersion.Major < versions.V3 {
return nil, fmt.Errorf("column connector is only supported in version >= v3.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/connectors/install/qonto.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *PaymentsConnectorsQontoController) Run(cmd *cobra.Command, args []strin
if err := versions.GetPaymentsVersion(cmd, args, c); err != nil {
return nil, err
}
if c.PaymentsVersion < versions.V3 {
if c.PaymentsVersion.Major < versions.V3 {
return nil, fmt.Errorf("qonto connector is only supported in version >= v3.0.0")
}

Expand Down
6 changes: 3 additions & 3 deletions cmd/payments/connectors/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ func (c *PaymentsConnectorsListController) Run(cmd *cobra.Command, args []string

pageSizeAsInt := int64(fctl.GetInt(cmd, c.pageSizeFlag))

switch c.PaymentsVersion {
switch c.PaymentsVersion.Major {
case versions.V3:
response, err := store.Client().Payments.V3.ListConnectors(cmd.Context(), operations.V3ListConnectorsRequest{
PageSize: &pageSizeAsInt,
Expand Down Expand Up @@ -120,7 +120,7 @@ func (c *PaymentsConnectorsListController) Run(cmd *cobra.Command, args []string

func (c *PaymentsConnectorsListController) Render(cmd *cobra.Command, args []string) error {
tableData := fctl.Map(c.store.Connectors, func(connector ConnectorData) []string {
if c.PaymentsVersion >= versions.V1 {
if c.PaymentsVersion.Major >= versions.V1 {
return []string{
connector.Provider,
connector.Name,
Expand All @@ -134,7 +134,7 @@ func (c *PaymentsConnectorsListController) Render(cmd *cobra.Command, args []str
}

})
if c.PaymentsVersion >= versions.V1 {
if c.PaymentsVersion.Major >= versions.V1 {
tableData = fctl.Prepend(tableData, []string{"Provider", "Name", "ConnectorID"})
} else {
tableData = fctl.Prepend(tableData, []string{"Provider"})
Expand Down
4 changes: 2 additions & 2 deletions cmd/payments/connectors/uninstall.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ func (c *PaymentsConnectorsUninstallController) Run(cmd *cobra.Command, args []s

provider := fctl.GetString(cmd, c.providerFlag)
connectorID := fctl.GetString(cmd, c.connectorIDFlag)
switch c.PaymentsVersion {
switch c.PaymentsVersion.Major {
case versions.V3:
if connectorID == "" {
return nil, fmt.Errorf("missing connector ID")
Expand Down Expand Up @@ -162,7 +162,7 @@ func (c *PaymentsConnectorsUninstallController) Run(cmd *cobra.Command, args []s

// TODO: This need to use the ui.NewListModel
func (c *PaymentsConnectorsUninstallController) Render(cmd *cobra.Command, args []string) error {
if c.PaymentsVersion < versions.V3 {
if c.PaymentsVersion.Major < versions.V3 {
pterm.Success.WithWriter(cmd.OutOrStdout()).Printfln("Connector '%s' uninstalled!", c.store.Connector)
return nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/payments/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *CreateController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("payment creation are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/pools/add_accounts.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *AddAccountController) Run(cmd *cobra.Command, args []string) (fctl.Rend
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("pools are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/pools/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *CreateController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("pools are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/pools/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (c *DeleteController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("pools are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/pools/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *ListController) Run(cmd *cobra.Command, args []string) (fctl.Renderable
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("pools are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/pools/remove_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (c *RemoveAccountController) Run(cmd *cobra.Command, args []string) (fctl.R
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("pools are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/pools/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (c *ShowController) Run(cmd *cobra.Command, args []string) (fctl.Renderable
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("pools are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/tasks/show.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c *ShowController) Run(cmd *cobra.Command, args []string) (fctl.Renderable
return nil, err
}

if c.PaymentsVersion < versions.V3 {
if c.PaymentsVersion.Major < versions.V3 {
return nil, fmt.Errorf("tasks are only supported in >= v3.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/transferinitiation/approve.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (c *ApproveController) Run(cmd *cobra.Command, args []string) (fctl.Rendera
return nil, err
}

if c.PaymentsVersion < versions.V3 {
if c.PaymentsVersion.Major < versions.V3 {
return nil, fmt.Errorf("transfer initiation approval is only supported in >= v3.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/transferinitiation/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ func (c *CreateController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("transfer initiation are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/transferinitiation/delete.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c *DeleteController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be unreachable now since you cannot get a versions.V0 from version controller

return nil, fmt.Errorf("transfer initiation are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/transferinitiation/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ func (c *ListController) Run(cmd *cobra.Command, args []string) (fctl.Renderable
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("transfer initiation are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/transferinitiation/reject.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (c *RejectController) Run(cmd *cobra.Command, args []string) (fctl.Renderab
return nil, err
}

if c.PaymentsVersion < versions.V3 {
if c.PaymentsVersion.Major < versions.V3 {
return nil, fmt.Errorf("transfer initiation rejection is only supported in >= v3.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/transferinitiation/retry.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (c *RetryController) Run(cmd *cobra.Command, args []string) (fctl.Renderabl
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("transfer initiation are only supported in >= v1.0.0")
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/payments/transferinitiation/reverse.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (c *ReverseController) Run(cmd *cobra.Command, args []string) (fctl.Rendera
return nil, err
}

if c.PaymentsVersion < versions.V1 {
if c.PaymentsVersion.Major < versions.V1 {
return nil, fmt.Errorf("transfer initiation are only supported in >= v1.0.0")
}

Expand Down
Loading
Loading