feat(payments): report income to «Мой налог»
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Failing after 24s
CI / ui (pull_request) Successful in 1m17s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Failing after 0s
CI / deploy (pull_request) Has been skipped
CI / changes (pull_request) Successful in 3s
CI / unit (pull_request) Successful in 11s
CI / integration (pull_request) Failing after 24s
CI / ui (pull_request) Successful in 1m17s
CI / conformance (pull_request) Successful in 10s
CI / gate (pull_request) Failing after 0s
CI / deploy (pull_request) Has been skipped
The direct rail runs on НПД, where the provider neither files with the tax service nor issues a receipt — so nobody was doing it. This registers each rouble purchase, annuls its receipt on a refund, and hands the buyer the receipt by email. Two properties of the (unofficial) lknpd API shape the design. Registering an income takes no idempotency key, so an error does not mean nothing happened: the service name is frozen before the call and carries a marker from the tail of the order id, and after a failure the taxpayer's income list is searched for that exact name. Found means filed; not found halts the queue for a human, because declaring an income twice is as wrong as not declaring it. And faults are classified rather than logged: a token is renewed silently, a throttle backs off, an outage retries, but three unfixable rejections take the rail out of service — a changed format must not become thousands of requests overnight. The console button and the worker share one RunBatch. Automatic mode is armed from the console, not from configuration, so the operator can watch a run go through by hand first. A daily watchdog runs whether or not it is armed, since the case it exists for is the export being off. An idle queue issues no call at all — not even an authentication. No payment path changed: the purchase letter rides the existing payment-event outbox on its own cursor, the receipt and annulment letters ride the export row. Decisions D53-D60.
This commit is contained in:
@@ -808,3 +808,56 @@ type LedgerTotalsRow struct {
|
||||
ChipsIn int
|
||||
ChipsOut int
|
||||
}
|
||||
|
||||
// MyNalogView is the professional-income tax export section: the state of the tax-cabinet session,
|
||||
// what is still owed to the tax register, and the manual fallback for when its API is unavailable.
|
||||
type MyNalogView struct {
|
||||
SignedIn bool
|
||||
INN string
|
||||
AutoEnabled bool
|
||||
Paused bool
|
||||
PauseReason string
|
||||
LastOK string
|
||||
TimeZone string
|
||||
// Backlog is what a closed month still owes, and is empty when nothing does.
|
||||
Backlog MyNalogBacklogRow
|
||||
// Owed, Cancels and Attention are the three working lists: income to file, receipts to annul,
|
||||
// and rows whose outcome nobody could establish.
|
||||
Owed []MyNalogRow
|
||||
Cancels []MyNalogCancelRow
|
||||
Attention []MyNalogRow
|
||||
}
|
||||
|
||||
// MyNalogBacklogRow summarises unfiled income from a closed month.
|
||||
type MyNalogBacklogRow struct {
|
||||
Count int
|
||||
Amount string
|
||||
Oldest string
|
||||
// Overdue reports that the statutory filing date for that month has passed.
|
||||
Overdue bool
|
||||
}
|
||||
|
||||
// MyNalogRow is one income on the export page. Name is the exact service description that would be
|
||||
// sent, which is also what an operator must type when filing by hand — the two have to match, or a
|
||||
// later automatic recovery would not recognise the receipt.
|
||||
type MyNalogRow struct {
|
||||
LedgerID string
|
||||
AccountID string
|
||||
At string
|
||||
Amount string
|
||||
Name string
|
||||
Status string
|
||||
Attempts int
|
||||
LastError string
|
||||
ReceiptUUID string
|
||||
ReceiptURL string
|
||||
}
|
||||
|
||||
// MyNalogCancelRow is one registered receipt whose income has been refunded and which is therefore
|
||||
// owed an annulment.
|
||||
type MyNalogCancelRow struct {
|
||||
LedgerID string
|
||||
AccountID string
|
||||
ReceiptUUID string
|
||||
Failed bool
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user