feat: add CreditCall preauth streaming

This commit is contained in:
2026-09-10 12:04:41 +01:00
parent c8cbd1e7a3
commit 1969aaa1d2
9 changed files with 598 additions and 66 deletions
+12 -3
View File
@@ -125,6 +125,15 @@ func BuildPaymentRedirectURL(result map[string]string) string {
}
func BuildPreauthRedirectURL(result map[string]string) (string, bool) {
approved, persist := PreauthDecision(result)
if approved {
return BuildSuccessURL(result), persist
}
return BuildFailureURL(result[types.TransactionResult], result[types.Errors]), false
}
// PreauthDecision preserves the returned-type approval and persistence rules.
func PreauthDecision(result map[string]string) (approved, persist bool) {
res := result[types.TransactionResult]
tType := result[types.TransactionType]
@@ -136,7 +145,7 @@ func BuildPreauthRedirectURL(result map[string]string) (string, bool) {
log.WithField(types.LogResult, result[types.TransactionResult]).
Info("Account verification approved")
return BuildSuccessURL(result), false
return true, false
// Transaction type Sale?
case strings.EqualFold(tType, types.SaleTransactionType):
@@ -144,12 +153,12 @@ func BuildPreauthRedirectURL(result map[string]string) (string, bool) {
log.WithField(types.LogResult, result[types.ConfirmResult]).
Info("Amount preauthorized successfully")
return BuildSuccessURL(result), true
return true, true
}
}
// Not approved
return BuildFailureURL(res, result[types.Errors]), false
return false, false
}
func BuildSuccessURL(result map[string]string) string {