Documentation
¶
Overview ¶
Package settle holds the one settlement primitive shared by the checkout and payment-callback subdomains: marking a gateway-verified payment as paid and enqueueing activation. A single implementation keeps the callback and expiry-time settlement semantics from drifting apart.
Index ¶
Constants ¶
const ( StatusPending = uint8(1) StatusPaid = uint8(2) StatusFinished = uint8(5) )
Order status values of the billing state machine.
Variables ¶
This section is empty.
Functions ¶
func ValidateTradeNo ¶
ValidateTradeNo rejects malformed or hostile gateway trade numbers.
func VerifiedPayment ¶
func VerifiedPayment(ctx context.Context, orders repository.OrderRepo, queue Queue, orderInfo *order.Order, tradeNo string) error
VerifiedPayment implements settlement idempotency. A settlement may only perform Pending -> Paid. A retry for an already-paid order may recreate a previously failed queue insertion, while the deterministic activation task ID prevents concurrent settlements from activating the order twice. Callers must authenticate the gateway response and verify the order amount first.