Documentation ¶
Index ¶
Constants ¶
View Source
const (
RootCertificateUrl = "https://www.apple.com/certificateauthority/AppleRootCA-G3.cer"
)
View Source
const ( // TransactionTimeWindow is the window of time, in minutes, where // transactions can fit to limit replay attacks TransactionTimeWindow = 5 * time.Minute )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ApplePaySessionURL ¶
type ApplePaySessionURL struct {
// contains filtered or unexported fields
}
func ParseApplePaySessionURL ¶
func ParseApplePaySessionURL(str string) (*ApplePaySessionURL, error)
func (*ApplePaySessionURL) String ¶
func (u *ApplePaySessionURL) String() string
func (*ApplePaySessionURL) UnmarshalJSON ¶
func (u *ApplePaySessionURL) UnmarshalJSON(bytes []byte) error
func (*ApplePaySessionURL) Validate ¶
func (u *ApplePaySessionURL) Validate() error
type ApplePayToken ¶
type ApplePayToken struct { // ApplicationPrimaryAccountNumber is the device-specific account number of the card that funds this // transaction ApplicationPrimaryAccountNumber string `json:"applicationPrimaryAccountNumber"` // expirationDate is the card expiration date in the format YYMMDD // use ExpirationTime function to access the time.Time value ExpirationDate expirationDate `json:"applicationExpirationDate"` // CurrencyCode is the ISO 4217 numeric currency code, as a string to preserve leading zeros CurrencyCode string `json:"currencyCode"` // TransactionAmount is the value of the transaction TransactionAmount uint `json:"transactionAmount"` // CardholderName is the name on the card CardholderName string `json:"cardholderName,omitempty"` // DeviceManufacturerIdentifier is a hex-encoded device manufacturer identifier DeviceManufacturerIdentifier string `json:"deviceManufacturerIdentifier"` // PaymentDataType is either 3DSecure or, if using Apple Pay in China, EMV PaymentDataType string `json:"paymentDataType"` // PaymentData contains detailed payment data PaymentData struct { // OnlinePaymentCryptogram is the 3-D Secure cryptogram OnlinePaymentCryptogram string `json:"onlinePaymentCryptogram,omitempty"` // ECIIndicator is the Electronic Commerce Indicator for the status of 3-D Secure ECIIndicator string `json:",omitempty"` // EMVData is the output from the Secure Element EMVData []byte `json:",omitempty"` // EncryptedPINData is the PIN encrypted with the bank's key EncryptedPINData string `json:",omitempty"` } }
ApplePayToken is the decrypted form of Response.Token.PaymentData.Data
func Decrypt ¶
func Decrypt(data []byte) (*ApplePayToken, error)
func (*ApplePayToken) Cryptogram ¶
func (t *ApplePayToken) Cryptogram() string
func (*ApplePayToken) ExpirationTime ¶
func (t *ApplePayToken) ExpirationTime() time.Time
func (*ApplePayToken) HasCryptogram ¶
func (t *ApplePayToken) HasCryptogram() bool
type IApplePayHandler ¶
type IApplePayHandler interface { Decrypt([]byte) (*ApplePayToken, error) Session(ApplePaySessionURL, string, string) ([]byte, error) MerchantId() string }
IApplePayHandler is the interface for Apple Pay handlers
type IOption ¶
type IOption func(*applePayHandler) error
func MerchantCertificate ¶
func MerchantCertificate(crt tls.Certificate) IOption
func ProcessingCertificate ¶
func ProcessingCertificate(crt tls.Certificate) IOption
Click to show internal directories.
Click to hide internal directories.