fix/safe-retries #2

Merged
apoloz merged 2 commits from fix/safe-retries into main 2026-09-29 07:47:03 +00:00
Owner

отключение повторов для денежныг операций

отключение повторов для денежныг операций
apoloz added 2 commits 2026-09-29 07:46:58 +00:00
Three request classes in Sbp\Requests\DigitalRuble\CashLink used the HasStringBody
trait and CmsSigner::canonicalize() without importing them, so loading the class
fataled with 'Trait not found' / 'Class not found'.
Saloon retries whenever an exception is thrown (handleRetry defaults to true)
and both connectors set tries = 3, so POST /payoffs, PATCH /payoffs/{id}/accept
and SBP QrcReversalRequest were sent to the bank up to three times while the
caller believed it had made a single request. For payouts a repeated POST is a
duplicate-payment risk, not a harmless retry.

HasSafeRetries replaces the HasTries default at the connector level (Saloon
retries only when the per-send callable, the request and the connector all
allow it):
- a deterministic bank verdict (4xx/5xx) is never retried;
- an explicit deny-list covers money operations;
- an explicit allow-list keeps retries for read-only SBP operations, since that
  API uses POST even for reads (GetQrcReversalDataRequest stays denied: the bank
  matches the following reversal against it, EBD 44 / I14044);
- by default only GET/HEAD/OPTIONS are retried.

Every decision is logged through the connector's PSR-3 logger as
'[alfa-sdk][retry]', so physical request count per operation is countable via
X-Request-ID.

Tests: tests/Feature/RetryPolicyTest.php (23 tests), including an assertion on
the real retry loop that a failing non-idempotent POST is sent exactly once,
while a read-only GET still uses all configured attempts.
apoloz merged commit 4fc0f42610 into main 2026-09-29 07:47:02 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: apoloz/alfa-bank-sdk#2