Skip to content

feat(payments): EN-123 connector schedules CLI#162

Open
thierrycoopman wants to merge 1 commit into
mainfrom
feat/en-123-connector-schedules
Open

feat(payments): EN-123 connector schedules CLI#162
thierrycoopman wants to merge 1 commit into
mainfrom
feat/en-123-connector-schedules

Conversation

@thierrycoopman
Copy link
Copy Markdown
Contributor

@thierrycoopman thierrycoopman commented May 28, 2026

Summary

  • Add fctl payments connectors schedules {list,get} wired to Payments v3 schedule endpoints
  • Add fctl payments connectors schedules instances list for schedule instance pagination
  • V3-only; uses existing formance-sdk-go/v3 v3.8.1 SDK methods (no SDK bump)

Test plan

  • go build ./... and go vet ./... pass
  • gofmt -l . clean
  • Help screens list new commands under fctl payments connectors
  • List/get/instances work against a v3 stack with --output json
  • Pre-v3 stack returns clear version-gate error

Expose GET /v3/connectors/{connectorID}/schedules,
GET /v3/connectors/{connectorID}/schedules/{scheduleID}, and
GET /v3/connectors/{connectorID}/schedules/{scheduleID}/instances
under fctl payments connectors schedules. V3-only; wired directly to
existing formance-sdk-go/v3 v3.8.1 (no SDK bump).
@thierrycoopman thierrycoopman requested a review from a team as a code owner May 28, 2026 09:41
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 28, 2026

Review Change Stack

Walkthrough

This PR adds CLI commands for listing, showing, and managing connector schedules and schedule instances under the payments connectors module. It establishes the command hierarchy, implements list and show operations with API v3 enforcement, includes cursor-based pagination support, and renders schedule and instance data in table format.

Changes

Connector schedules and instances CLI commands

Layer / File(s) Summary
Command hierarchy and root wiring
cmd/payments/connectors/root.go, cmd/payments/connectors/schedules/root.go, cmd/payments/connectors/schedules/instances/root.go
Schedules subcommand is registered under connectors root, schedules root defines list/show/instances subcommands, and instances root is wired with list as a child command.
List schedules command and flow
cmd/payments/connectors/schedules/list.go
List command for schedules accepts a connectorID argument with cursor/page-size flags, enforces Payments API v3 minimum, calls the listing endpoint, validates response, stores cursor in pagination store, and renders schedule ID/ConnectorID/CreatedAt in table format with cursor metadata.
Show schedule command and flow
cmd/payments/connectors/schedules/show.go
Show command for a specific schedule accepts connectorID and scheduleID arguments, enforces Payments API v3 minimum, calls the get endpoint, validates response presence, stores schedule in store, and renders schedule details in table format with RFC3339 timestamp.
List schedule instances command and flow
cmd/payments/connectors/schedules/instances/list.go
List command for schedule instances accepts connectorID and scheduleID arguments with cursor/page-size flags, enforces Payments API v3 minimum, calls the instances listing endpoint, validates response, stores cursor in pagination store, and renders instances with created/updated/terminated timestamps and per-row error fields.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A schedules command sprouts beneath the connectors' tree,
With show and list subcommands dancing in harmony,
Instances follow, paginated with cursor grace,
V3 enforcement keeps things in their place,
Tables of schedules now render with flair! 🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 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 (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main addition: connector schedules CLI commands. It matches the primary change of adding list/get/instances subcommands to the payments connectors CLI.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description check ✅ Passed The pull request description accurately describes the changeset, including the new CLI commands for connector schedules and instances, version requirements, and testing approach.

✏️ 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 feat/en-123-connector-schedules

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.

@thierrycoopman thierrycoopman requested a review from gfyrag May 28, 2026 10:18
tableData := fctl.Map(c.store.Cursor.Data, func(s shared.V3Schedule) []string {
return []string{
s.ID,
s.ConnectorID,
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.

The output is incredibly wide making this command not super useful. Since connectorID is already a required param in this command, let's not even include ConnectorID as a column to make the whole thing more legible.

Comment on lines +131 to +132
i.ScheduleID,
i.ConnectorID,
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.

Same deal here with the output being too wide for it to be practical. Let's remove both scheduleID and connector ID columns because they are already specified as command line arguments

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