Validates and deep-clones the gateway payload. Normalises OrderStatus,
ErrorCode, actionCode to string (or undefined).
SatimUnexpectedResponseError on schema violations.
Cardholder IP address as reported by the gateway, or undefined.
Cardholder name as printed on the card, or undefined.
Card expiry in YYYYMM format, or undefined.
Masked PAN (e.g. 4111**1111) as redacted by the gateway, or undefined.
Issuer-generated approval code, or undefined for non-success responses.
The order number as echoed by the gateway, or undefined.
Captured amount in major units (e.g. DA). Returns undefined when the
gateway value is absent, non-satim-module, fractional, or exceeds
Number.MAX_SAFE_INTEGER — these cases indicate a malformed response
that should not be silently coerced. Callers needing strictness should
also call verifyAmount.
OrderStatus "2": deposited (success).
OrderStatus "4": refunded.
OrderStatus "0": registered but not paid yet.
OrderStatus "3": authorization voided / reversed.
OrderStatus "1": funds held, awaiting capture.
Session timed out (actionCode === "-2007"), only when no terminal OrderStatus is present.
Customer cancelled (actionCode === "10" or message matches "payment is cancelled").
Bank declined (actionCode ∈ {"2003","111"}, or respCode outside
{"", "00"}, or message matches "payment is declined").
Catch-all failure predicate — true iff every other predicate is false.
Mutual-exclusivity contract enforcement point: any response that does
not fit a narrower predicate lands here.
Localised success/info message. Falls back to getErrorMessage for non-success terminal states.
Source order on success: params.respCode_desc, then
actionCodeDescription, then a fixed English fallback.
Localised failure message keyed to the active predicate.
For declined payments, the message is the SDK's generic
"Your transaction was rejected" rather than the gateway's specific
respCode_desc (e.g. "Do not honor"). Callers needing the raw
gateway reason should read it from getRawResponse.
Assert captured amount equals expectedAmount. Compares minor-unit
integers via the same IEEE-754-safe toMinorUnits pipeline
used at registration.
Sole defence against partial-capture manipulation. Satim.confirm()
calls this automatically on isSuccessful() responses — bypassing
requires constructing ConfirmResponse directly, which also
bypasses the gateway call entirely.
SatimUnexpectedResponseError when the gateway amount is absent, non-satim-module, fractional, or mismatches.
Shallow copy of the raw gateway response with cardholder PII redacted.
Redacted fields: Ip, Pan, cardholderName, expiration.
Use for debugging, logging, error reporting. Mutating the returned
object does not affect this wrapper. For PII access, call the
dedicated getCardPan / getCardHolderName / getCardExpiry /
getIpAddress methods.
Immutable wrapper around an order-management response.
Invariants:
_rawis a deep clone validated and normalised at construction.