Skip to content

Add scheduled payout creation to admin payouts CLI#113

Merged
gianfrancopiana merged 2 commits into
mainfrom
gianfranco/admin-scheduled-payout-create-cli
May 25, 2026
Merged

Add scheduled payout creation to admin payouts CLI#113
gianfrancopiana merged 2 commits into
mainfrom
gianfranco/admin-scheduled-payout-create-cli

Conversation

@gianfrancopiana
Copy link
Copy Markdown
Member

@gianfrancopiana gianfrancopiana commented May 25, 2026

Ref antiwork/gumroad/issues/5153

What

  • Adds gumroad admin payouts scheduled create for the new internal scheduled payout endpoint.
  • Supports --user-id, required --processor, optional --expected-email, --payout-date, and --note, with confirmation and dry-run support.
  • Mirrors the API response in plain and JSON output, and surfaces the scheduled payout details clearly.
  • Updates the embedded skill and CLI examples so the new command is documented alongside the existing payout actions.

Why

  • This closes the gap between the admin API and the CLI for delayed payouts after suspension.
  • The command follows the same safety pattern as the other admin mutations so agents and humans can preview and confirm the request before money movement is scheduled.

This PR was implemented with AI assistance using gpt-5.5 xhigh.


Note

High Risk
Schedules real money movement via a new admin mutation; mistakes or misuse could queue incorrect payouts, though mitigated by confirmation, dry-run, and API-side checks.

Overview
Adds gumroad admin payouts scheduled create, wiring the admin CLI to the internal POST /scheduled_payouts endpoint for delayed payouts (e.g. after suspension).

The command accepts --user-id, required --processor (stripe/paypal), and optional --expected-email, --payout-date (YYYY-MM-DD), and --note. It follows the same safety model as other admin payout mutations: validation, --yes confirmation, --dry-run, and human-readable, plain, or JSON output including .scheduled_payout (list decoding now includes processor).

README, cobra examples, the embedded gumroad skill, and broad tests cover the new subcommand.

Reviewed by Cursor Bugbot for commit 6d55234. Bugbot is set up for automated code reviews on this repo. Configure here.

@gianfrancopiana gianfrancopiana self-assigned this May 25, 2026
@gianfrancopiana gianfrancopiana marked this pull request as ready for review May 25, 2026 17:35
@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 25, 2026

Greptile Summary

Adds gumroad admin payouts scheduled create, wiring the CLI to POST /internal/admin/scheduled_payouts so admins can schedule delayed payouts for suspended users with unpaid balance. The command follows the existing safety model (confirmation, dry-run, JSON/plain/human output) and is accompanied by comprehensive tests and skill/README documentation updates.

  • New scheduled_create.go: validates --processor (stripe/paypal, case-insensitive), optionally validates --payout-date (YYYY-MM-DD only when set), requires confirmation before issuing the mutation, and short-circuits cleanly in dry-run mode via ConfirmAction's built-in DryRun guard.
  • scheduledPayout struct gains a Processor field so both the create response and the existing list response decode it correctly.
  • Tests cover all validation paths, request shape, dry-run isolation, JSON pass-through, plain-output column correctness (including the success boolean), and server-error surfacing.

Confidence Score: 5/5

The change is self-contained: new command, additive struct field, no mutations to existing command logic. The confirmation/dry-run safety guards are correctly wired and tested.

All validation, confirmation, dry-run short-circuit, and output-rendering paths are covered by dedicated tests. The implementation is consistent with existing admin mutation commands and introduces no regressions to shared types.

No files require special attention.

Important Files Changed

Filename Overview
internal/cmd/admin/payouts/scheduled_create.go New command implementation for creating scheduled payouts; correctly validates processor/date, normalizes input, confirms before mutation, short-circuits on dry-run, and renders all output modes.
internal/cmd/admin/payouts/scheduled_test.go Adds 9 new tests covering validation, request shape, dry-run isolation, JSON pass-through, plain output (including success field correctness), and server error surfacing; also updates the wiring test.
internal/cmd/admin/payouts/scheduled_list.go Adds Processor field to scheduledPayout struct so create-response and list-response both decode it; no behavior change to list rendering.
internal/cmd/admin/payouts/scheduled.go Registers newScheduledCreateCmd as a subcommand and adds it to the usage example.
skills/gumroad/SKILL.md Documents the new admin payouts scheduled create command and its response shape in the embedded skill reference.
skills/embed_test.go Extends the skill-doc coverage test to assert the new command example and response-field documentation are present in SKILL.md.
README.md Adds two example CLI invocations for the new scheduled create and scheduled list subcommands.

Sequence Diagram

sequenceDiagram
    participant Admin
    participant CLI as gumroad CLI
    participant Confirm as ConfirmAction
    participant API as POST /internal/admin/scheduled_payouts

    Admin->>CLI: scheduled create --user-id X --processor stripe

    CLI->>CLI: resolveMutationTarget
    CLI->>CLI: validate --processor
    CLI->>CLI: RequireDateFlag

    alt dry-run
        CLI-->>Admin: PrintDryRunRequest
    else confirmed
        CLI->>API: POST JSON
        API-->>CLI: scheduled_payout response
        CLI-->>Admin: output
    end
Loading

Reviews (2): Last reviewed commit: "Use response success in plain output" | Re-trigger Greptile

Comment thread internal/cmd/admin/payouts/scheduled_create.go Outdated
@gianfrancopiana gianfrancopiana merged commit f240ace into main May 25, 2026
6 checks passed
@gianfrancopiana gianfrancopiana deleted the gianfranco/admin-scheduled-payout-create-cli branch May 25, 2026 17:59
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.

1 participant