56 lines
2.3 KiB
Go
56 lines
2.3 KiB
Go
// Package paymentapi defines the modern Hardlink terminal contract and its HTTP client.
|
|
// It contains no provider selection, PMS posting or guest-journey logic.
|
|
package paymentapi
|
|
|
|
const (
|
|
Sale = "sale"
|
|
Preauth = "preauth"
|
|
SalePath = "/api/payment/sale"
|
|
PreauthPath = "/api/payment/preauth"
|
|
)
|
|
|
|
// PreauthRequirement describes a later required hold; validating it never executes it.
|
|
type PreauthRequirement struct {
|
|
Amount int64 `json:"amount"`
|
|
CheckoutDate string `json:"checkoutDate,omitempty"`
|
|
}
|
|
|
|
// Request uses integer minor units and currency supplied by CMS.
|
|
type Request struct {
|
|
Reference string `json:"reference,omitempty"`
|
|
Amount int64 `json:"amount"`
|
|
Currency string `json:"currency,omitempty"`
|
|
CheckoutDate string `json:"checkoutDate,omitempty"`
|
|
RequiredPreauth *PreauthRequirement `json:"requiredPreauth,omitempty"`
|
|
}
|
|
|
|
// Result is authoritative terminal outcome and metadata, never a PMS description.
|
|
// CurrencyCode is configured bookkeeping currency, not settlement-currency evidence.
|
|
type Result struct {
|
|
Outcome string `json:"outcome"`
|
|
HTTPStatus int `json:"httpStatus"`
|
|
Reason string `json:"reason,omitempty"`
|
|
Retryable bool `json:"retryable"`
|
|
Message string `json:"message,omitempty"`
|
|
Provider string `json:"provider,omitempty"`
|
|
AmountMinor int64 `json:"amountMinor"`
|
|
CurrencyCode string `json:"currencyCode,omitempty"`
|
|
TransactionReference string `json:"transactionReference,omitempty"`
|
|
CardType string `json:"cardType,omitempty"`
|
|
MaskedCardNumber string `json:"maskedCardNumber,omitempty"`
|
|
ExpiryDate string `json:"expiryDate,omitempty"`
|
|
CardHash string `json:"cardHash,omitempty"`
|
|
CardReference string `json:"cardReference,omitempty"`
|
|
ReceiptNumber string `json:"receiptNumber,omitempty"`
|
|
SequenceNumber string `json:"sequenceNumber,omitempty"`
|
|
AuthorizationCode string `json:"authorizationCode,omitempty"`
|
|
LastFour string `json:"lastFour,omitempty"`
|
|
}
|
|
|
|
// Frame carries observational progress or one final result.
|
|
type Frame struct {
|
|
Type string `json:"type"`
|
|
Code string `json:"code,omitempty"`
|
|
Result *Result `json:"result,omitempty"`
|
|
}
|