feat(cli): AnythinkPay management — offers, plans, subscriptions, Apple IAP, trial, history, admin recovery, offer-delete#21
Draft
chrisaddams wants to merge 3 commits into
Draft
Conversation
…story, admin recovery) CLI (`anythink pay …`): - trial status|enable|disable — app engagement trial toggle - apple credentials set|show|notification-url — Apple IAP config (.p8 read from file, stored encrypted, never logged; identifiers masked on show) - apple verify — receipt verification for testing - subscriptions events|delete|force-expire|relink|resync — history + admin recovery - payment-options, entitlement, setup (guided Stripe Connect → Apple → first plan) - plans gain --apple-product-id / --apple-subscription-group-id MCP: new PayTools.cs with anythinkpay_* tools (active-profile based, no orgId arg). Fixes: - plan models sent template_name but the server field is plan_name; renamed across models and the create/update flag (--plan-name) - CliTool workflow create used the old 6-arg CreateWorkflowRequest; updated to the triggers-based shape so the MCP project builds Docs: README pay section with required-permissions table + Homebrew install/update instructions; docs command reference extended. Verified: dotnet build (0 errors); CLI tests 370/0, MCP tests 39/0.
CLI (`anythink pay offers …`, admin/tenant-scoped): - list / get / create / update offers (kind: discount | trial_extension | referral) - pause / activate (status patch — no dedicated route server-side) - codes / add-code — manage an offer's promo/referral codes (shared or per-user) - redemptions — per-offer redemption history - user-code — look up a user's personal referral code Rewards and eligibility are opaque JSON strings forwarded to AnythinkPay, so the reward vocabulary can evolve without a CLI release. create/update take raw JSON (--redeemer-reward / --referrer-reward / --eligibility) plus convenience flags (--redeemer-trial-days, --discount-percent[/--discount-duration], --referrer-trial-days, --referrer-subscription-days). central_tenant_id is set server-side and never sent by the CLI. End-user code redemption is intentionally NOT exposed — that happens in the app; the CLI is admin configuration only. MCP: anythinkpay_* tools mirroring the offer surface (list/get/create/update, set-status, list/create codes, redemptions, user-code), active-profile based. Docs: README + docs command reference updated with the offers commands and the offer permission rows (anythink_subscription_plans:read/create/update). Verified: dotnet build (0 errors); CLI tests 395/0, MCP tests 39/0.
Prompts for confirmation by default, showing the offer name and the destructive nature of the operation: codes, redemptions, and history are removed, but trial days already granted to users stay. --yes / --force skips the prompt. On success, prints the server-reported counts: codes deleted, redemptions deleted, trial bonuses preserved.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Status
Draft — opening for review and ongoing iteration, not yet ready to merge.
Summary
Brings the AnythinkPay administration surface into the CLI (and MCP). Most of what's here corresponds to capabilities already shipping in the admin UI; the CLI now lets you script the same operations or work them into CI flows.
What lands
Tests added under `tests/OffersClientTests.cs` cover the client-level shape of the offers commands.
Notes for reviewers