Skip to content

chore(payments): Add the new released connectors#129

Open
Quentin-David-24 wants to merge 2 commits intomainfrom
chore/add-new-payments-connectors
Open

chore(payments): Add the new released connectors#129
Quentin-David-24 wants to merge 2 commits intomainfrom
chore/add-new-payments-connectors

Conversation

@Quentin-David-24
Copy link
Copy Markdown
Contributor

@Quentin-David-24 Quentin-David-24 commented Mar 18, 2026

Resolves EN-147

@Quentin-David-24 Quentin-David-24 requested a review from a team as a code owner March 18, 2026 18:55
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Mar 18, 2026

Walkthrough

Adds CLI commands and controllers to install and update configurations for six payment connectors (Fireblocks, Coinbase Prime, Increase, Powens, Tink, Plaid). Implements stores, controllers, command wiring, config file parsing, API calls (V3InstallConnector / V3UpdateConnectorConfig), rendering helpers, and registry entries.

Changes

Cohort / File(s) Summary
Config Update Commands
cmd/payments/connectors/configs/coinbaseprime.go, cmd/payments/connectors/configs/fireblocks.go, cmd/payments/connectors/configs/increase.go, cmd/payments/connectors/configs/plaid.go, cmd/payments/connectors/configs/powens.go, cmd/payments/connectors/configs/tink.go
Added store and controller types plus Cobra command creators for updating connector configs. Flow: validate connector-id → request approval → read/unmarshal JSON config → call V3UpdateConnectorConfig → handle non-2xx and errors → persist success and render message.
Config Update Root
cmd/payments/connectors/configs/root.go
Wires new update-config subcommands by appending newUpdateFireblocksCommand(), newUpdateCoinbaseprimeCommand(), newUpdateIncreaseCommand(), newUpdatePowensCommand(), newUpdateTinkCommand(), newUpdatePlaidCommand().
Install Commands
cmd/payments/connectors/install/coinbaseprime.go, cmd/payments/connectors/install/fireblocks.go, cmd/payments/connectors/install/increase.go, cmd/payments/connectors/install/plaid.go, cmd/payments/connectors/install/powens.go, cmd/payments/connectors/install/tink.go
Added stores, controllers, and Cobra commands to install connectors. Flow: load profile/authenticate → enforce PaymentsVersion constraints → read/unmarshal JSON config → request approval → call Payments.V3.InstallConnector → handle non-2xx and errors → update store and render success with connector details.
Install Root
cmd/payments/connectors/install/root.go
Appends NewFireblocksCommand(), NewCoinbaseprimeCommand(), NewIncreaseCommand(), NewPowensCommand(), NewTinkCommand(), NewPlaidCommand() to install command children.
Connector Registry
cmd/payments/connectors/internal/connectors.go
Adds constants for fireblocks, coinbaseprime, increase, powens, tink, plaid and includes them in AllConnectors.
Get Config Rendering
cmd/payments/connectors/configs/getconfig.go
Extended V3 config rendering switch to dispatch newly added connectors to their Display...ConfigV3 functions.
Views / Renderers
cmd/payments/connectors/views/fireblocks.go, .../coinbaseprime.go, .../increase.go, .../plaid.go, .../powens.go, .../tink.go, (and removal in .../atlar.go)
Added display helpers for each new connector (Build and render pterm tables). Removed fmt import and PageSize row from Atlar view.

Sequence Diagram

sequenceDiagram
    actor User
    participant CLI
    participant Controller
    participant Auth
    participant StackClient
    participant PaymentsAPI
    participant Store
    participant Renderer

    User->>CLI: run install/update command with file + flags
    CLI->>Controller: Run(args, flags)
    Controller->>Auth: Load profile & authenticate
    Auth-->>Controller: profile
    Controller->>StackClient: Init client with profile
    StackClient-->>Controller: client ready
    Controller->>Controller: validate connector-id / version / args
    Controller->>User: request approval
    User->>Controller: approve / deny
    alt approved
        Controller->>Controller: read & parse JSON config file
        Controller->>PaymentsAPI: InstallConnector / UpdateConnectorConfig (config)
        PaymentsAPI-->>Controller: response (200-299 / error)
        alt success
            Controller->>Store: set Success=true, record ConnectorID/name
            Store-->>Controller: persisted
            Controller->>Renderer: Render success message
            Renderer-->>User: display confirmation
        else failure
            Controller-->>User: return API error
        end
    else denied
        Controller-->>User: return ErrMissingApproval
    end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰
Six connectors scamper into view,
JSON in paws, their configs new,
Install or update—CLI delight,
Approvals asked before taking flight,
I hop and cheer: the commands work right!

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: adding new released payment connectors to the codebase, which aligns with the changeset.
Description check ✅ Passed The description references issue EN-147 which is related to adding new payment connectors, matching the changeset content.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-new-payments-connectors
📝 Coding Plan
  • Generate coding plan for human review comments

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/payments/connectors/install/coinbaseprime.go`:
- Around line 75-77: The version check in coinbaseprime.go uses
c.PaymentsVersion < versions.V3 but the error text says ">= v3.2.0", causing a
mismatch; update the check or the message to be consistent: either change the
error string in the conditional that references c.PaymentsVersion and
versions.V3 to state ">= v3.0.0" to match versions.V3, or if the connector truly
requires v3.2.0 introduce/use a new finer-grained version constant (e.g.,
versions.V3_2 or similar) and replace versions.V3 with that constant in the same
conditional so the runtime check matches the "v3.2.0" message. Ensure you modify
the conditional and its fmt.Errorf text consistently.

In `@cmd/payments/connectors/install/tink.go`:
- Around line 75-77: The version check uses c.PaymentsVersion < versions.V3 but
the error text says ">= v3.1.0", causing a mismatch; update the check or message
to be consistent: either change the error string in the tink connector (and
similarly in plaid, powens, increase) to reflect the actual minimum
(v3.0.0-rc.1) referenced by versions.V3, or add and use a new constant (e.g.,
versions.V3_1) and compare c.PaymentsVersion < versions.V3_1 to enforce v3.1.0;
adjust the fmt.Errorf text to match whichever minimum you enforce.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c6d0125d-aa0c-4d00-9f53-a8eef1aeeba1

📥 Commits

Reviewing files that changed from the base of the PR and between 1957265 and 804bcf0.

⛔ Files ignored due to path filters (2)
  • go.mod is excluded by !**/*.mod
  • go.sum is excluded by !**/*.sum, !**/*.sum
📒 Files selected for processing (15)
  • cmd/payments/connectors/configs/coinbaseprime.go
  • cmd/payments/connectors/configs/fireblocks.go
  • cmd/payments/connectors/configs/increase.go
  • cmd/payments/connectors/configs/plaid.go
  • cmd/payments/connectors/configs/powens.go
  • cmd/payments/connectors/configs/root.go
  • cmd/payments/connectors/configs/tink.go
  • cmd/payments/connectors/install/coinbaseprime.go
  • cmd/payments/connectors/install/fireblocks.go
  • cmd/payments/connectors/install/increase.go
  • cmd/payments/connectors/install/plaid.go
  • cmd/payments/connectors/install/powens.go
  • cmd/payments/connectors/install/root.go
  • cmd/payments/connectors/install/tink.go
  • cmd/payments/connectors/internal/connectors.go

Comment on lines +75 to +77
if c.PaymentsVersion < versions.V3 {
return nil, fmt.Errorf("coinbaseprime connector is only supported in version >= v3.2.0")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Version check/error message mismatch.

The check uses versions.V3 which enforces >= v3.0.0-rc.1 (per versions.go), but the error message claims >= v3.2.0. The existing qonto.go connector correctly states v3.0.0 for the same check. Either update the message to match the actual check, or introduce a finer-grained version constant if v3.2.0 is truly the minimum.

Proposed fix (if v3.0.0+ is the correct minimum)
 if c.PaymentsVersion < versions.V3 {
-    return nil, fmt.Errorf("coinbaseprime connector is only supported in version >= v3.2.0")
+    return nil, fmt.Errorf("coinbaseprime connector is only supported in version >= v3.0.0")
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
if c.PaymentsVersion < versions.V3 {
return nil, fmt.Errorf("coinbaseprime connector is only supported in version >= v3.2.0")
}
if c.PaymentsVersion < versions.V3 {
return nil, fmt.Errorf("coinbaseprime connector is only supported in version >= v3.0.0")
}
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/payments/connectors/install/coinbaseprime.go` around lines 75 - 77, The
version check in coinbaseprime.go uses c.PaymentsVersion < versions.V3 but the
error text says ">= v3.2.0", causing a mismatch; update the check or the message
to be consistent: either change the error string in the conditional that
references c.PaymentsVersion and versions.V3 to state ">= v3.0.0" to match
versions.V3, or if the connector truly requires v3.2.0 introduce/use a new
finer-grained version constant (e.g., versions.V3_2 or similar) and replace
versions.V3 with that constant in the same conditional so the runtime check
matches the "v3.2.0" message. Ensure you modify the conditional and its
fmt.Errorf text consistently.

Comment on lines +75 to +77
if c.PaymentsVersion < versions.V3 {
return nil, fmt.Errorf("tink connector is only supported in version >= v3.1.0")
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check what the versions constants represent
rg -n "V3\s*=" cmd/payments/versions/ -A2

Repository: formancehq/fctl

Length of output: 41


🏁 Script executed:

# First, find the tink.go file and check the import statement
head -20 cmd/payments/connectors/install/tink.go

Repository: formancehq/fctl

Length of output: 583


🏁 Script executed:

# Search for versions package definition across the codebase
find . -name "*.go" -type f | xargs grep -l "versions\.V3\|package versions" | head -20

Repository: formancehq/fctl

Length of output: 873


🏁 Script executed:

# Search for V3 constant definition
rg "const.*V3\s*=" --type go -B2 -A2

Repository: formancehq/fctl

Length of output: 41


🏁 Script executed:

# List files in the versions directory
ls -la cmd/payments/versions/

Repository: formancehq/fctl

Length of output: 233


🏁 Script executed:

# Check the contents of the versions file
cat cmd/payments/versions/*.go

Repository: formancehq/fctl

Length of output: 1219


🏁 Script executed:

# Search for V3 definition in the payments versions package specifically
rg "V3" cmd/payments/versions/ -A3 -B1

Repository: formancehq/fctl

Length of output: 776


🏁 Script executed:

# Search for any reference to v3.1.0 or version constants that might match it
rg "3\.1\.0|V3_1" --type go

Repository: formancehq/fctl

Length of output: 560


🏁 Script executed:

# Check the tink.go file around the error to see full context
sed -n '70,85p' cmd/payments/connectors/install/tink.go

Repository: formancehq/fctl

Length of output: 454


Version check does not match error message.

The code rejects versions below versions.V3 (which represents v3.0.0-rc.1 or higher based on the version detection logic), but the error message claims the connector requires >= v3.1.0. This discrepancy is misleading—either update the error message to reflect the actual minimum version (v3.0.0-rc.1), or if v3.1.0 is truly required, add a V3_1 constant and use that for the check instead.

Note: This same inconsistency exists in the plaid, powens, and increase connectors as well.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/payments/connectors/install/tink.go` around lines 75 - 77, The version
check uses c.PaymentsVersion < versions.V3 but the error text says ">= v3.1.0",
causing a mismatch; update the check or message to be consistent: either change
the error string in the tink connector (and similarly in plaid, powens,
increase) to reflect the actual minimum (v3.0.0-rc.1) referenced by versions.V3,
or add and use a new constant (e.g., versions.V3_1) and compare
c.PaymentsVersion < versions.V3_1 to enforce v3.1.0; adjust the fmt.Errorf text
to match whichever minimum you enforce.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
cmd/payments/connectors/configs/getconfig.go (1)

228-239: Consider a renderer registry before this switch grows again.

These six cases keep renderV3 in lockstep with every provider-specific helper. A map[string]func(*cobra.Command, *shared.V3GetConnectorConfigResponse) error would make future connector additions declarative and reduce missed wiring.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/payments/connectors/configs/getconfig.go` around lines 228 - 239, Replace
the growing switch in getconfig.go that calls provider-specific helpers (e.g.,
views.DisplayFireblocksConfigV3, views.DisplayCoinbaseprimeConfigV3,
views.DisplayIncreaseConfigV3, views.DisplayPowensConfigV3,
views.DisplayTinkConfigV3, views.DisplayPlaidConfigV3) with a registry
map[string]func(*cobra.Command, *shared.V3GetConnectorConfigResponse) error
keyed by the connector constants (internal.FireblocksConnector,
internal.CoinbaseprimeConnector, etc.); look up the handler from the map using
the connector key and call it with (cmd, c.store.V3ConnectorConfig), falling
back to the existing default path if the key is missing—this makes renderV3
wiring declarative and avoids adding switch cases for each new connector.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@cmd/payments/connectors/views/fireblocks.go`:
- Around line 20-23: The output currently prints secrets verbatim (see tableData
appends for APIKey and PrivateKey in the Fireblocks config renderer); change the
renderer to omit or redact secret values before adding them to tableData (e.g.,
replace config.APIKey and config.PrivateKey with a redacted placeholder or
masked string) and keep non-secret fields (Endpoint, PollingPeriod via
fctl.StringPointerToString) unchanged so logs no longer leak live credentials.

---

Nitpick comments:
In `@cmd/payments/connectors/configs/getconfig.go`:
- Around line 228-239: Replace the growing switch in getconfig.go that calls
provider-specific helpers (e.g., views.DisplayFireblocksConfigV3,
views.DisplayCoinbaseprimeConfigV3, views.DisplayIncreaseConfigV3,
views.DisplayPowensConfigV3, views.DisplayTinkConfigV3,
views.DisplayPlaidConfigV3) with a registry map[string]func(*cobra.Command,
*shared.V3GetConnectorConfigResponse) error keyed by the connector constants
(internal.FireblocksConnector, internal.CoinbaseprimeConnector, etc.); look up
the handler from the map using the connector key and call it with (cmd,
c.store.V3ConnectorConfig), falling back to the existing default path if the key
is missing—this makes renderV3 wiring declarative and avoids adding switch cases
for each new connector.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 40f47622-3e89-440a-a922-7052cb3ea236

📥 Commits

Reviewing files that changed from the base of the PR and between 804bcf0 and 1616a1c.

📒 Files selected for processing (8)
  • cmd/payments/connectors/configs/getconfig.go
  • cmd/payments/connectors/views/atlar.go
  • cmd/payments/connectors/views/coinbaseprime.go
  • cmd/payments/connectors/views/fireblocks.go
  • cmd/payments/connectors/views/increase.go
  • cmd/payments/connectors/views/plaid.go
  • cmd/payments/connectors/views/powens.go
  • cmd/payments/connectors/views/tink.go
💤 Files with no reviewable changes (1)
  • cmd/payments/connectors/views/atlar.go

Comment on lines +20 to +23
tableData = append(tableData, []string{pterm.LightCyan("APIKey:"), config.APIKey})
tableData = append(tableData, []string{pterm.LightCyan("Endpoint:"), fctl.StringPointerToString(config.Endpoint)})
tableData = append(tableData, []string{pterm.LightCyan("Polling Period:"), fctl.StringPointerToString(config.PollingPeriod)})
tableData = append(tableData, []string{pterm.LightCyan("PrivateKey:"), config.PrivateKey})
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Stop echoing raw connector secrets in get-config output.

APIKey and especially PrivateKey are printed verbatim here. The same pattern appears in the new Coinbase Prime, Increase, Powens, Tink, and Plaid renderers, so this PR makes get-config leak live credentials to stdout, shells, and CI logs. Omit these fields or redact them before rendering.

🔐 Minimal fix for this renderer
-	tableData = append(tableData, []string{pterm.LightCyan("APIKey:"), config.APIKey})
+	tableData = append(tableData, []string{pterm.LightCyan("APIKey:"), "[redacted]"})
 	tableData = append(tableData, []string{pterm.LightCyan("Endpoint:"), fctl.StringPointerToString(config.Endpoint)})
 	tableData = append(tableData, []string{pterm.LightCyan("Polling Period:"), fctl.StringPointerToString(config.PollingPeriod)})
-	tableData = append(tableData, []string{pterm.LightCyan("PrivateKey:"), config.PrivateKey})
+	tableData = append(tableData, []string{pterm.LightCyan("PrivateKey:"), "[redacted]"})
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
tableData = append(tableData, []string{pterm.LightCyan("APIKey:"), config.APIKey})
tableData = append(tableData, []string{pterm.LightCyan("Endpoint:"), fctl.StringPointerToString(config.Endpoint)})
tableData = append(tableData, []string{pterm.LightCyan("Polling Period:"), fctl.StringPointerToString(config.PollingPeriod)})
tableData = append(tableData, []string{pterm.LightCyan("PrivateKey:"), config.PrivateKey})
tableData = append(tableData, []string{pterm.LightCyan("APIKey:"), "[redacted]"})
tableData = append(tableData, []string{pterm.LightCyan("Endpoint:"), fctl.StringPointerToString(config.Endpoint)})
tableData = append(tableData, []string{pterm.LightCyan("Polling Period:"), fctl.StringPointerToString(config.PollingPeriod)})
tableData = append(tableData, []string{pterm.LightCyan("PrivateKey:"), "[redacted]"})
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@cmd/payments/connectors/views/fireblocks.go` around lines 20 - 23, The output
currently prints secrets verbatim (see tableData appends for APIKey and
PrivateKey in the Fireblocks config renderer); change the renderer to omit or
redact secret values before adding them to tableData (e.g., replace
config.APIKey and config.PrivateKey with a redacted placeholder or masked
string) and keep non-secret fields (Endpoint, PollingPeriod via
fctl.StringPointerToString) unchanged so logs no longer leak live credentials.

Copy link
Copy Markdown
Contributor

@laouji laouji left a comment

Choose a reason for hiding this comment

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

The dirty check is failing but otherwise looks good.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants