Files
hardlink/internal/trustpayments/types.go
T

45 lines
1.0 KiB
Go

package trustpayments
// These are provider-call values, not persistent operations or kiosk sessions.
const (
Approved = "APPROVED_VALIDATED"
Declined = "DECLINED"
Cancelled = "CANCELLED"
Pending = "PENDING"
Unknown = "UNKNOWN"
Review = "REVIEW_REQUIRED"
)
type Request struct {
Kind string
Amount int64
Currency string
}
type Operation struct {
Request Request
RefID, TxnDate string
}
type Metadata struct {
Receipt, Sequence, AuthCode, CardType, LastFour string
}
func (m Metadata) Description(ref string) string {
s := "Tx " + ref
for _, v := range [][2]string{{"Rec", m.Receipt}, {"Seq", m.Sequence}, {"Hash", m.AuthCode}, {"Ref", m.CardType + m.LastFour}} {
if v[1] != "" {
s += " " + v[0] + " " + v[1]
}
}
return s
}
type Result struct {
State, RefID, Currency, Code string
Amount int64
Metadata Metadata
ObservedAmount, ObservedFinalAmount int64
ObservedAmountKnown, ObservedFinalKnown bool
}