chore(openspec): archive add-customer-accounts
Sync the customer-accounts capability and the frontend-mall stats requirement into the main specs, and write the capability Purpose the archive leaves as a placeholder so strict validation stays green.
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
# customer-accounts Specification
|
||||
|
||||
## Purpose
|
||||
Hold each customer's monetary and loyalty-points balances with an auditable history. Accounts are keyed by kind and currency, every balance change is a guarded transactional update paired with an immutable entry, and the customer's own summary is the only public surface. Later flows (points redemption, withdrawals, refunds) spend and grant value through this module's internal primitives instead of writing balances directly.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Customer account summary
|
||||
Each customer SHALL have available monetary balance, frozen monetary balance, and loyalty-points accounts. An authenticated customer SHALL retrieve a summary containing balance minor, frozen balance minor, their monetary currency, and integer points. Public APIs SHALL NOT list or mutate account entries.
|
||||
|
||||
#### Scenario: new customer summary
|
||||
- **WHEN** a newly registered customer requests account stats
|
||||
- **THEN** the API returns zero balances and zero points without relying on browser fixtures
|
||||
|
||||
#### Scenario: frozen kind exists without a freeze flow
|
||||
- **WHEN** a customer with no freeze events requests account stats
|
||||
- **THEN** `frozen_minor` is zero and available balance is unchanged
|
||||
|
||||
### Requirement: Append-only account entries
|
||||
Every account balance change SHALL create an immutable entry with signed delta, resulting balance, reason, optional business reference, and timestamp in the same transaction. Account entries SHALL NOT be edited or deleted through public APIs.
|
||||
|
||||
#### Scenario: debit records result
|
||||
- **WHEN** an internal business flow debits points successfully
|
||||
- **THEN** the points balance and one entry with the resulting balance commit together
|
||||
|
||||
### Requirement: Guarded account mutation
|
||||
A debit or freeze SHALL succeed only when the affected account has sufficient available balance. Concurrent changes SHALL use conditional atomic updates and return 409 rather than create a negative balance.
|
||||
|
||||
#### Scenario: competing debits
|
||||
- **WHEN** two debits together exceed a points balance
|
||||
- **THEN** at most one debit succeeds and the final stored balance is non-negative
|
||||
@@ -2,7 +2,9 @@
|
||||
|
||||
## Purpose
|
||||
The buyer-facing storefront: shell, home page, discovery, shopping and transaction flows, and the buyer center.
|
||||
|
||||
## Requirements
|
||||
|
||||
### Requirement: Localized storefront
|
||||
The mall SHALL render every UI string and all catalog/store/marketing mock content in en or zh from one switcher, defaulting to en. Switching locale SHALL update the desktop shell and current page without a full reload.
|
||||
|
||||
@@ -151,3 +153,9 @@ Checkout SHALL offer the customer's saved addresses for selection, defaulting to
|
||||
- **WHEN** a signed-in shopper with saved addresses checks out
|
||||
- **THEN** the default address is preselected and the created order carries the chosen address
|
||||
|
||||
### Requirement: Live customer account statistics
|
||||
The buyer-center dashboard and points surfaces SHALL load the signed-in customer's balance, frozen balance, currency, and points from the shared account API rather than `USER_STATS`.
|
||||
|
||||
#### Scenario: account summary reload
|
||||
- **WHEN** a signed-in shopper reloads the buyer center
|
||||
- **THEN** displayed account statistics come from the selected API adapter and survive browser state loss
|
||||
|
||||
Reference in New Issue
Block a user