Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions docs/command-surface.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -123,7 +123,7 @@ rc customers override-offering <id> --offering <id>
rc customers clear-override <id>
rc customers restore-google <id> --token <t>
rc customers simulate-purchase # Test Store only; --app-id/--product/--app-user-id + confirmation/--yes
rc customers wallet <id> # virtual_currencies per-customer
rc customers balances <id> # per-customer In-App Currency balances (virtual_currencies endpoint); wallet is kept as an alias

# Entitlements (project catalog)
rc entitlements list
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions internal/api/customer_subscription_paths_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
},
},
{
Expand Down
6 changes: 3 additions & 3 deletions internal/api/customers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
21 changes: 12 additions & 9 deletions internal/cli/customers.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ one Customer are aliases.`,
newCustomerClearOverrideCmd(),
newCustomerRestoreGoogleCmd(),
newCustomerSimulatePurchaseCmd(),
newCustomerWalletCmd(),
newCustomerBalancesCmd(),
)
return cmd
}
Expand Down Expand Up @@ -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 <customer-id>",
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 <customer-id>",
// "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())
Expand All @@ -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
}
Expand Down
Loading