72 lines
2.2 KiB
Go
72 lines
2.2 KiB
Go
package types
|
|
|
|
import (
|
|
"database/sql"
|
|
"encoding/xml"
|
|
"time"
|
|
)
|
|
|
|
const (
|
|
DateOnly = "2006-01-02"
|
|
CustomLayout = "2006-01-02 15:04:05 -0700"
|
|
LinkTakePreauthorization = "http://127.0.0.1:18181/start-transaction/"
|
|
LinkTakePayment = "http://127.0.0.1:18181/start-and-confirm-transaction/"
|
|
LinkTransactionInformation = "http://127.0.0.1:18181/transaction-information/"
|
|
LinkVoidTransaction = "http://127.0.0.1:18181/void-transaction/"
|
|
// Transaction types
|
|
SaleTransactionType = "sale"
|
|
AccountVerificationType = "account verification"
|
|
|
|
// Transaction results
|
|
ResultApproved = "approved"
|
|
ResultDeclined = "declined"
|
|
ResultCancelled = "cancelled"
|
|
ResultPending = "pending"
|
|
ResultStateUncommitted = "uncommitted"
|
|
ResultStateVoided = "voided"
|
|
ResultError = "error"
|
|
CheckinSuccessfulEndpoint = "/successful" // Endpoint to send guest to after successful payment
|
|
CheckinUnsuccessfulEndpoint = "/unsuccessful"
|
|
|
|
// Response map keys
|
|
CardReference = "CARD_REFERENCE"
|
|
CardHash = "CARD_HASH"
|
|
Errors = "ERRORS"
|
|
ReceiptData = "RECEIPT_DATA"
|
|
ReceiptDataMerchant = "RECEIPT_DATA_MERCHANT"
|
|
ReceiptDataCardholder = "RECEIPT_DATA_CARDHOLDER"
|
|
Reference = "REFERENCE"
|
|
PAN_MASKED = "PAN_MASKED"
|
|
EXPIRY_DATE = "EXPIRY_DATE"
|
|
TransactionResult = "TRANSACTION_RESULT"
|
|
TransactionType = "TRANSACTION_TYPE"
|
|
TransactionState = "TRANSACTION_STATE"
|
|
ConfirmResult = "CONFIRM_RESULT"
|
|
ConfirmErrors = "CONFIRM_ERRORS"
|
|
TotalAmount = "TOTAL_AMOUNT"
|
|
|
|
// Log field keys
|
|
LogFieldError = "error"
|
|
LogFieldDescription = "description"
|
|
LogResult = "transactionResult"
|
|
)
|
|
|
|
type (
|
|
TransactionReferenceRequest struct {
|
|
XMLName xml.Name `xml:"TransactionReferenceRequest"`
|
|
TransactionReference string `xml:"TransactionReference"`
|
|
}
|
|
|
|
PreauthRec struct {
|
|
Id int64
|
|
TxnReference string
|
|
TotalMinorUnits int64
|
|
TotalAmount float64
|
|
TxnDateTime time.Time
|
|
DepartureDate time.Time // date-only (00:00)
|
|
ReleaseDate time.Time
|
|
Released bool
|
|
ReleasedAt sql.NullTime
|
|
}
|
|
)
|