diff --git a/docs/command-surface.md b/docs/command-surface.md index 348069db..c71653f8 100644 --- a/docs/command-surface.md +++ b/docs/command-surface.md @@ -44,7 +44,7 @@ the code when adding/renaming a command. ## The 16 documented resources (sidebar order) App · Audit Log · Charts & Metrics · Collaborator · Customer · Entitlement · -Offering · Package · Product · Virtual Currency · Purchase · Subscription · +Offering · Package · Product · Virtual Currency (product name: In-App Currency) · Purchase · Subscription · Invoice · Paywall · Integration · Project ## Charts: fixed 22-name enum @@ -123,7 +123,7 @@ rc customers override-offering --offering rc customers clear-override rc customers restore-google --token rc customers simulate-purchase # Test Store only; --app-id/--product/--app-user-id + confirmation/--yes -rc customers wallet # virtual_currencies per-customer +rc customers balances # per-customer In-App Currency balances (virtual_currencies endpoint); wallet is kept as an alias # Entitlements (project catalog) rc entitlements list @@ -252,9 +252,9 @@ rc audit # /audit_logs with --li ## Build order 1. **`projects`** (list, show, use, create) — create is required for zero-to-project setup. -2. **`customers`** ✅ — list, composite show, grant, revoke, aliases, attributes (+ set-attribute), transfer, override-offering, clear-override, restore-google, wallet. +2. **`customers`** ✅ — list, composite show, grant, revoke, aliases, attributes (+ set-attribute), transfer, override-offering, clear-override, restore-google, balances. 3. **Catalog CRUD** ✅ — entitlements (+ archive/restore/products/attach/detach), offerings (+ archive/restore), products (+ update/archive/restore/push), packages (show/create/update/delete/products/attach/detach). No `crud` helper extracted — readable enough inline. -4. **Support toolkit**: `subscriptions` ✅ (show/transactions/entitlements/management-url/cancel/extend/refund), `purchases` ✅, `invoices` ✅, `customer wallet` ✅. +4. **Support toolkit**: `subscriptions` ✅ (show/transactions/entitlements/management-url/cancel/extend/refund), `purchases` ✅, `invoices` ✅, `customers balances` ✅. 5. **Long tail**: `webhooks` ✅ (under `/integrations/webhooks`), `paywalls` ✅. 6. **Cross-resource utilities**: `metrics` ✅, `charts list/show/options` ✅ (with client-side enum validation + shell completion), `audit` ✅. 7. **Apps** ✅ — list/show/create/update/delete/keys/storekit-config. diff --git a/internal/api/customer_subscription_paths_test.go b/internal/api/customer_subscription_paths_test.go index 6cbda313..9064a0c1 100644 --- a/internal/api/customer_subscription_paths_test.go +++ b/internal/api/customer_subscription_paths_test.go @@ -48,12 +48,12 @@ func TestCustomerAndSubscriptionLivePaths(t *testing.T) { }, }, { - name: "customer wallet update balance", + name: "customer virtual currencies update balance", method: http.MethodPost, path: "/projects/proj/customers/cust/virtual_currencies/update_balance", response: `{}`, call: func(c *api.Client) error { - return c.Customers.WalletAdjustBalance(context.Background(), "proj", "cust", "GLD", 10) + return c.Customers.VirtualCurrenciesUpdateBalance(context.Background(), "proj", "cust", "GLD", 10) }, }, { diff --git a/internal/api/customers.go b/internal/api/customers.go index 90c7d7fc..57735189 100644 --- a/internal/api/customers.go +++ b/internal/api/customers.go @@ -163,20 +163,20 @@ func (s *CustomersService) RestoreGooglePlay(ctx context.Context, projectID, cus } // GET /projects/{project_id}/customers/{customer_id}/virtual_currencies -func (s *CustomersService) Wallet(ctx context.Context, projectID, customerID string) (*Page[map[string]any], error) { +func (s *CustomersService) VirtualCurrencies(ctx context.Context, projectID, customerID string) (*Page[map[string]any], error) { var out Page[map[string]any] err := s.c.do(ctx, http.MethodGet, pathCustomerVirtualCurrencies(projectID, customerID), nil, &out) return &out, err } // POST /projects/{project_id}/customers/{customer_id}/virtual_currencies/update_balance -func (s *CustomersService) WalletAdjustBalance(ctx context.Context, projectID, customerID, currencyCode string, amount int64) error { +func (s *CustomersService) VirtualCurrenciesUpdateBalance(ctx context.Context, projectID, customerID, currencyCode string, amount int64) error { body := map[string]any{"currency_code": currencyCode, "amount": amount} return s.c.do(ctx, http.MethodPost, pathCustomerVirtualCurrenciesUpdateBalance(projectID, customerID), body, nil) } // POST /projects/{project_id}/customers/{customer_id}/virtual_currencies/transactions -func (s *CustomersService) WalletTransaction(ctx context.Context, projectID, customerID, currencyCode string, amount int64) error { +func (s *CustomersService) VirtualCurrenciesTransaction(ctx context.Context, projectID, customerID, currencyCode string, amount int64) error { body := map[string]any{"currency_code": currencyCode, "amount": amount} return s.c.do(ctx, http.MethodPost, pathCustomerVirtualCurrenciesTransactions(projectID, customerID), body, nil) } diff --git a/internal/cli/customers.go b/internal/cli/customers.go index fed66fe0..7eff55d2 100644 --- a/internal/cli/customers.go +++ b/internal/cli/customers.go @@ -83,7 +83,7 @@ one Customer are aliases.`, newCustomerClearOverrideCmd(), newCustomerRestoreGoogleCmd(), newCustomerSimulatePurchaseCmd(), - newCustomerWalletCmd(), + newCustomerBalancesCmd(), ) return cmd } @@ -517,14 +517,17 @@ Confirmation: no prompt — idempotent (re-running with the same token is safe). return cmd } -func newCustomerWalletCmd() *cobra.Command { +func newCustomerBalancesCmd() *cobra.Command { return &cobra.Command{ - Use: "wallet ", - Short: "Show a Customer's Virtual Currency balances", - Long: `Shows the Customer's wallet: per-currency virtual currency balances for -the project.`, - Example: ` rc customers wallet cus_abc - rc customers wallet cus_abc --json | jq '.data.items[]'`, + Use: "balances ", + // "wallet" was the original name; kept for muscle memory and old scripts. + Aliases: []string{"wallet"}, + Short: "Show a Customer's In-App Currency balances", + Long: `Shows the Customer's per-currency In-App Currency balances for the project. +In-App Currency was formerly called Virtual Currency; the v2 API endpoint and +payload still say virtual_currencies.`, + Example: ` rc customers balances cus_abc + rc customers balances cus_abc --json | jq '.data.items[]'`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) error { rt := RuntimeFrom(cmd.Context()) @@ -536,7 +539,7 @@ the project.`, if err != nil { return err } - page, err := client.Customers.Wallet(cmd.Context(), projectID, args[0]) + page, err := client.Customers.VirtualCurrencies(cmd.Context(), projectID, args[0]) if err != nil { return err }