feat(payments): send no fiscal receipt; keep the code switchable
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m28s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m45s
CI / changes (pull_request) Successful in 2s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Successful in 21s
CI / ui (pull_request) Successful in 1m28s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Successful in 0s
CI / deploy (pull_request) Successful in 1m45s
The merchant accepts payments as a sole proprietor on НПД, which is outside 54-ФЗ: there is no online cash register, YooKassa does not serve receipts for that regime at all (checked with their support), and each operation is reported by the merchant to «Мой налог», which issues the чек. So no `receipt` is sent with a payment or a refund. This also removes a failure class rather than just code: a malformed receipt was an API error at payment creation, which broke the purchase outright. The fiscal code is kept dormant rather than deleted. All of it now sits behind one switch, `BACKEND_YOOKASSA_VAT_CODE`: unset — the default — builds and sends nothing; a 54-ФЗ rate code turns «Чеки от ЮKassa» back on unchanged. The return is foreseeable, which is why the switch exists: НПД carries an annual income ceiling, and losing the regime puts 54-ФЗ back in force, at which point this is a deploy-variable edit instead of writing the integration again. The D36 email anchor still gates a direct purchase. It had two justifications — a recovery anchor and the receipt address — and only the second is gone; without an email a paying customer who loses the account loses the chips with it. What was missing is that the rule was enforced but never communicated: the wallet showed the packs to a player signed in through VK or Telegram in a browser, and tapping Buy produced a bare "something went wrong". It now says "add an email in your profile" in the buy tab instead, linking to the profile; spending already-earned chips is untouched. The predicate is a pure function so it is covered by the node-env unit tests rather than needing a browser. Tests: the receipt-off default is pinned by an integration test asserting a purchase carries no receipt, and the dormant path by one that switches a VAT code on and checks the receipt reappears with the right fiscal attributes; plus unit coverage for the enable predicate and the wallet's email rule. A note for whoever runs the numbers next: the shared (svelte + i18n) chunk is now 40 bytes under its 31 KB gzip budget. Decision D51 revised.
This commit is contained in:
+19
-9
@@ -411,15 +411,25 @@ spends, grants, refunds, full history — as an extension of the existing user c
|
||||
|
||||
Receipts are automatic **through the provider**, and differ by rail:
|
||||
|
||||
- **YooKassa** (direct) — a 54-ФЗ fiscal receipt through **«Чеки от ЮKassa»**: YooKassa owns the
|
||||
cash register, the fiscal drive and the OFD contract, and files with the tax authority. Unlike the
|
||||
retired rail's cabinet-side receipts, it registers one **only if the request carries it** (D51), so
|
||||
every payment and every refund sends a `receipt`: one line (the pack title, quantity 1, the amount)
|
||||
with the VAT rate code (54-ФЗ tag 1199, a deploy variable — `1` = «Без НДС» for УСН/ПСН), the
|
||||
settlement subject `service` (tag 1212) and the settlement method `full_payment` (tag 1214).
|
||||
Delivery is by email only, to the D36 confirmed anchor. `tax_system_code` is not sent — YooKassa
|
||||
ignores it for this solution. A malformed receipt is an API error at payment creation, so it blocks
|
||||
the purchase loudly rather than silently skipping the fiscal document.
|
||||
- **YooKassa** (direct) — **no receipt is sent, by design (D51 rev)**. The merchant operates on
|
||||
**НПД**, which is outside 54-ФЗ: there is no online cash register and the provider registers
|
||||
nothing. Each operation is reported by the merchant to **«Мой налог»**, which issues the чек.
|
||||
YooKassa does not serve receipts for this regime at all.
|
||||
|
||||
The fiscal code is **kept dormant**, not deleted: «Чеки от ЮKassa» (YooKassa owning the cash
|
||||
register, the fiscal drive and the OFD contract) registers a receipt **only if the request carries
|
||||
it**, and that request-building lives behind one switch — `BACKEND_YOOKASSA_VAT_CODE`. Unset, no
|
||||
`receipt` is built or sent; set to a 54-ФЗ rate code (tag 1199) it goes back to sending one line
|
||||
(pack title, quantity 1, amount) with the settlement subject `service` (tag 1212) and method
|
||||
`full_payment` (tag 1214), delivered by email to the D36 anchor. That switch exists because the
|
||||
return is foreseeable: НПД carries an annual income ceiling, and losing the regime puts 54-ФЗ back
|
||||
in force.
|
||||
|
||||
Everything an automated «Мой налог» submission needs is already recorded — the order id, the
|
||||
provider payment id, the amount and currency, the credit time, the sold-pack snapshot, and refunds
|
||||
as their own ledger rows, all exportable as CSV. The one thing it will additionally need is a
|
||||
per-operation "already reported" marker for its own idempotency; that belongs to the submission
|
||||
work, not here.
|
||||
- **VK** — VK processes Votes through the tax authority itself; nothing to do.
|
||||
- **TG Stars** — no tax side (for a RU self-employed, Stars are not legally withdrawable = not
|
||||
НПД income; accepted, no receipt issued).
|
||||
|
||||
Reference in New Issue
Block a user