diff --git a/apps/simplex-store-service/README.md b/apps/simplex-store-service/README.md index 44a4fba7c4..de93001d1e 100644 --- a/apps/simplex-store-service/README.md +++ b/apps/simplex-store-service/README.md @@ -25,8 +25,8 @@ At this stage the service: - listens for service requests (`CEvtServiceRequest`) on that address, rejects a request whose `purchaseKey` is not the key the agent verified the signature against, and answers `redeemBadgeCode`, - issues redemption codes, storing only their `SHA-256` in its code table, - does not accept contact requests: the address is for RPC only, -- in service mode with `[group]` in the ini, manages one SimpleX group and serves `/issue`, `/bulk` - and `/revoke` in it (see [Issuing codes](#issuing-codes)), +- in service mode with `[group]` in the ini, manages one SimpleX group and serves `/issue`, `/bulk`, + `/revoke`, `/balance`, `/record_refund` and `/close` in it (see [Issuing codes](#issuing-codes)), - in service mode with `--service-config`, also serves the built web app (`npm run build` in `web/`) on `badges_port` and, with `[names]`, the names site on `names_port` (see [Two sites](#two-sites)), `POST /api/invoice` and `GET /api/invoice/:id`, the BTCPay and Stripe webhook routes, and a payment poller, seeding its price/offer catalog on every start, - owns the `sx_badge_service_`-prefixed tables and its own migrations table (`sx_badge_service_migrations`). @@ -1350,14 +1350,16 @@ were already given out, and the command answers with an error. A multi-use code be revoked, which stops the uses that remain. Core parses `//...` into `CustomChatCommand` and leaves it to the service's `preCmdHook`, which is -why issuing codes lives in the service rather than in core. `//refund` and `//close`, the other -commands of this console, are in [Refunding a name balance](#refunding-a-name-balance) and +why issuing codes lives in the service rather than in core. `//balance`, `//record_refund` and +`//close`, the other commands of this console, are in [Refunding a name balance](#refunding-a-name-balance) and [Closing a failed order](#closing-a-failed-order). ### From the group -With `[group]` in `store_service.ini`, the service manages one group and serves three commands in -it: `/issue` and `/bulk` for moderators and above, `/revoke ` for admins and owners. Each name code +With `[group]` in `store_service.ini`, the service manages one group and serves six commands in +it: `/issue` and `/bulk` for moderators and above, `/revoke ` for admins and owners, and +`/balance`, `/record_refund` and `/close` for owners (see [Balances and failed orders in the +group](#balances-and-failed-orders-in-the-group)). Each name code registers at the sponsor allowance's and the gas key's cost, so the group issues at most 10 of them in 24 hours (`//issue name` in `--run-cli` has no limit, and its codes are not counted). The code commands take these forms: @@ -1376,7 +1378,7 @@ bounds, a length for a badge, `months` or `uses` for a name, or `name` in `/bulk lists the form, each kind's bounds and an example of each. The group's command menu shows the kinds of each command in its hint and fills the hint into the message box. Without `[names]`, `/issue name` gets a reply that names are not enabled, and issues nothing. `/revoke` takes badge and name codes, so -a name code issued before names were turned off can still be withdrawn. The group has no `/refund`. A member's role +a name code issued before names were turned off can still be withdrawn. A member's role is checked as the service last saw it, so a command sent by a moderator just demoted or removed can still run if it reaches the service first; revoke any code the service posts for them after the change. `uses` above 1 makes a multi-use code, tracked by a group message showing its remaining uses and the time @@ -1466,18 +1468,19 @@ from `/api/invoice/:id`, or from `/api/registration/:id` for a registration id. safe on the reference alone, as Stripe returns it to the card that paid; a crypto refund goes to an address the buyer gives, which nothing here ties to the order. Support records each refund in `--run-cli` mode with the service stopped, like the other -`//` commands: +`//` commands, or in the group while the service runs (see [Balances and failed orders in the +group](#balances-and-failed-orders-in-the-group)): ``` -//refund -//refund +//balance +//record_refund ``` -1. Run `//refund ` with the reference the buyer sent. It records nothing and answers the - balance, what paid for it and the command that refunds it: +1. Run `//balance ` with the reference the buyer sent. It records nothing and answers the + balance, what paid for it and the command that records its refund: ``` - Order : balance $100.00 (credited $100.00, refunded $0.00). Paid by: order : $100.00 by btc on invoice . To record its refund: //refund 10000 + Order : balance $100.00 (credited $100.00, refunded $0.00). Paid by: order : $100.00 by btc on invoice . To record its refund: //record_refund 10000 ``` `Paid by` starts at this order and follows every balance the money came through back to the @@ -1504,12 +1507,14 @@ expiry unless money reached the invoice: - `its invoice expired at