fix(creditcall): preserve detailed SDK failure diagnostics
This commit is contained in:
@@ -22,6 +22,8 @@ type creditCallSaleOutcome struct {
|
||||
Approved bool
|
||||
FailureType string
|
||||
FailureDescription string
|
||||
|
||||
confirmationDiagnostic creditCallDiagnostic
|
||||
}
|
||||
|
||||
func (app *App) creditCallClient() *http.Client {
|
||||
@@ -84,13 +86,16 @@ func (app *App) executeCreditCallSale(
|
||||
mail.SendEmailOnError(app.cfg.Hotel, app.cfg.Kiosk, "Payment confirmation failed", "Reference: "+ref+", Error: "+err.Error())
|
||||
outcome.FailureType = types.ResultError
|
||||
outcome.FailureDescription = "ConfirmTransactionError"
|
||||
outcome.confirmationDiagnostic = creditCallConfirmationErrorDiagnostic(err)
|
||||
return outcome
|
||||
}
|
||||
|
||||
// Intentionally reuse both records: XML appends confirmation entries, and
|
||||
// missing confirmation fields/receipts retain their existing legacy behavior.
|
||||
if err := trResult.ParseTransactionResult(body); err != nil {
|
||||
logging.Error(types.ServiceName, err.Error(), "Parse confirm result error", string(op), "", "", 0)
|
||||
initialEntryCount := len(trResult.Entries)
|
||||
parseErr := trResult.ParseTransactionResult(body)
|
||||
if parseErr != nil {
|
||||
logging.Error(types.ServiceName, parseErr.Error(), "Parse confirm result error", string(op), "", "", 0)
|
||||
}
|
||||
result.FillFromTransactionResult(trResult)
|
||||
res = result.Fields[types.TransactionResult]
|
||||
@@ -107,6 +112,7 @@ func (app *App) executeCreditCallSale(
|
||||
outcome.Payment = result
|
||||
outcome.FailureType = res
|
||||
outcome.FailureDescription = result.Fields[types.Errors]
|
||||
outcome.confirmationDiagnostic = creditCallConfirmationResultDiagnostic(trResult.Entries[initialEntryCount:], parseErr != nil)
|
||||
return outcome
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user