feat(payments): live payment-availability kill switch + per-account override
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m15s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 2m0s
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m15s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 2m0s
Let an operator disable purchases live from the admin — a whole rail/channel or one account — and show the user a localized reason on their next attempt, so a provider outage or a misconfig is explained instead of a silent dead button. - rail kill switch (payments.rail_status, per rail direct:web / direct:android / vk / telegram): enabled + a per-language message, edited on the catalog page. Fail-open — a rail with no row stays enabled, so payments are never accidentally killed. The intake gate (CanPurchase in handleWalletOrder, before the order) returns payment_unavailable + the localized message, orthogonal to the security gates. - per-account override (payments.account_payment_override, a row only for non-default): allow / deny / default, edited on the user card. "allow" bypasses ONLY the ops rail switch, never the security gates (trusted platform, the email anchor, the VK-iOS freeze, the min client version). - wire: an additive ExecuteResponse.message envelope field (frozen-contract-safe); the gateway forwards a backend domain-error message; the client shows it on a payment_unavailable buy attempt. - admin: rail toggles on the catalog page, the override control on the user card. - tests: the pure gate (unit, TDD), the store + gate + override end-to-end (integration, migration 00016), the client (svelte-check / vitest). - docs: PAYMENTS (+ru), the decisions log (D45/D46). Fiscalization stays cabinet-side (owner decision) — no itemized-receipt code. Contour-safe: additive migration (two new tables, no wipe), the wire add is additive, and fail-open so nothing is disabled until an operator acts.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
-- Payment availability controls (D45/D46): a per-rail operational kill switch with a localized message,
|
||||
-- and a per-account purchase override. Both let an operator disable payments live from the admin —
|
||||
-- a whole rail/channel, or one account — and explain why to the user on a purchase attempt. Additive
|
||||
-- (new tables) — applies forward via goose with no data rewrite (no contour wipe); an image rollback
|
||||
-- ignores both tables. Fail-open by design: a rail with no row is enabled; an account with no row
|
||||
-- follows the rail switch.
|
||||
-- +goose Up
|
||||
|
||||
CREATE TABLE payments.rail_status (
|
||||
rail text PRIMARY KEY,
|
||||
enabled boolean NOT NULL DEFAULT true,
|
||||
message_ru text NOT NULL DEFAULT '',
|
||||
message_en text NOT NULL DEFAULT '',
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
CREATE TABLE payments.account_payment_override (
|
||||
account_id uuid PRIMARY KEY,
|
||||
allow boolean NOT NULL,
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
|
||||
-- +goose Down
|
||||
|
||||
DROP TABLE payments.account_payment_override;
|
||||
DROP TABLE payments.rail_status;
|
||||
Reference in New Issue
Block a user