start of preauth
This commit is contained in:
+29
-1
@@ -248,7 +248,7 @@ func nullableFloatArg(nf sql.NullFloat64) interface{} {
|
||||
}
|
||||
|
||||
// BuildRedirectURL builds the redirect URL to send the guest to after payment.
|
||||
func BuildRedirectURL(result map[string]string) string {
|
||||
func BuildPaymentRedirectURL(result map[string]string) string {
|
||||
res := result[TransactionResult]
|
||||
tType := result[TransactionType]
|
||||
|
||||
@@ -284,6 +284,34 @@ func BuildRedirectURL(result map[string]string) string {
|
||||
return BuildFailureURL(res, result[Errors])
|
||||
}
|
||||
|
||||
func BuildPreauthRedirectURL(result map[string]string) string {
|
||||
res := result[TransactionResult]
|
||||
tType := result[TransactionType]
|
||||
|
||||
// Transaction approved?
|
||||
if strings.EqualFold(res, ResultApproved) {
|
||||
switch {
|
||||
// Transaction type AccountVerification?
|
||||
case strings.EqualFold(tType, AccountVerificationType):
|
||||
log.WithField(LogResult, result[TransactionResult]).
|
||||
Info("Account verification approved")
|
||||
|
||||
return buildSuccessURL(result)
|
||||
|
||||
// Transaction type Sale?
|
||||
case strings.EqualFold(tType, SaleTransactionType):
|
||||
// Transaction confirmed?
|
||||
log.WithField(LogResult, result[ConfirmResult]).
|
||||
Info("Transaction approved and confirmed")
|
||||
|
||||
return buildSuccessURL(result)
|
||||
}
|
||||
}
|
||||
|
||||
// Not approved
|
||||
return BuildFailureURL(res, result[Errors])
|
||||
}
|
||||
|
||||
func buildSuccessURL(result map[string]string) string {
|
||||
q := url.Values{}
|
||||
q.Set("TxnReference", result[Reference])
|
||||
|
||||
Reference in New Issue
Block a user