diff --git a/qbirr.go b/qbirr.go index ebb59e0..b4fd14a 100644 --- a/qbirr.go +++ b/qbirr.go @@ -59,6 +59,40 @@ type VerifyResult struct { Payer string `json:"payer"` Amount float64 `json:"amount"` Error string `json:"error"` + + // PaidAmount is the amount the receipt ACTUALLY shows, in ETB. 0 when + // unreadable. On a short payment compare it to Amount to see what arrived. + PaidAmount float64 `json:"paid_amount"` + + // Retryable TRUE means "we could not reach the bank", so Verified=false is NOT + // a verdict on the payment — it is "not checked yet". Retry, or fall back to + // manual review. NEVER reject an order on this. Check it BEFORE acting on + // Verified=false. + Retryable bool `json:"retryable"` + + // Code is a stable machine-readable reason; branch on this instead of parsing + // Error. Empty on success. Values: RECEIPT_NOT_FOUND, AMOUNT_MISMATCH, + // RECEIVER_MISMATCH, RECEIPT_EXPIRED, RECEIPT_UNREADABLE, REFERENCE_INVALID, + // RECEIVER_ACCOUNT_REQUIRED, UNSUPPORTED_INPUT, VERIFICATION_FAILED, + // DUPLICATE_REFERENCE, UPSTREAM_UNAVAILABLE (the only retryable one). + Code string `json:"code"` + + // ReceiverSource is which receiver identity was actually checked: "settings" + // (your saved account — strongest), "request" (the receiver_name/account you + // sent), or "none" (NOTHING was checked: Verified=true with "none" means the + // reference exists and the amount matches, but says nothing about who + // received the money). + ReceiverSource string `json:"receiver_source"` + + // Sandbox is true only on TEST-... responses. + Sandbox bool `json:"sandbox"` +} + +// IsOutage reports whether this result is "we could not check" rather than a +// verdict on the payment. When true, retry or review manually — do not treat the +// payment as invalid. +func (r VerifyResult) IsOutage() bool { + return !r.Verified && r.Retryable } // UsageStatus is the response from /api/v1/usage.