Documentation ¶
Index ¶
- Variables
- func AmountToString(amount *Amount) string
- type AVSResponse
- type Amount
- type AuthorizationRequest
- type AuthorizationResponse
- type BillingAddress
- type CVVResponse
- type CaptureRequest
- type CaptureResponse
- type Client
- type Code
- type CreditCard
- type Currency
- type Level3Data
- type LineItem
- type RefundRequest
- type RefundResponse
- type VoidRequest
- type VoidResponse
Constants ¶
This section is empty.
Variables ¶
var CURRENCIES = map[Code]Currency{}/* 166 elements not displayed */
CURRENCIES maps the precision to the currency symbol used for lookups for some PsP providers that rely on these values for amount calculation One example is Braintree which uses its own amount structure requiring the precision of a currency
Functions ¶
func AmountToString ¶
AmountToString converts string with floating point eg 12.34.
Types ¶
type AVSResponse ¶ added in v1.0.225
type AVSResponse int
AVSResponse represents a possible Address Verification System response.
const ( AVSResponseUnknown AVSResponse = iota AVSResponseError // The AVS is unavailable due to a system error. AVSResponseUnsupported // The issuing bank does not support AVS. AVSResponseSkipped // Verification was not performed for this transaction. AVSResponseZip9MatchAddressMatch // 9-digit ZIP matches, street address matches. AVSResponseZip9MatchAddressNoMatch // 9-digit ZIP matches, street address doesn't match. AVSResponseZip5MatchAddressMatch // 5-digit ZIP matches, street address matches. AVSResponseZip5MatchAddressNoMatch // 5-digit ZIP matches, street address doesn't match. AVSresponseZipMatchAddressMatch // 5 or 9 digit ZIP matches, street address matches. AVSResponseZipNoMatchAddressMatch // ZIP doesn't match, street address matches. AVSResponseZipMatchAddressUnverified // ZIP matches, street address not verified. AVSResponseZipUnverifiedAddressMatch // ZIP not verified, street address matches. AVSResponseMatch // Generic "everything matches" AVSResponseNoMatch // Generic "nothing matches" AVSResponseNonUsZipMatchAddressMatch // (Non U.S. cards) ZIP matches, street address matches. AVSResponseNonUsZipNoMatchAddressNoMatch // (Non U.S. cards) ZIP and street address don't match. AVSResponseNonUsZipUnverifiedAddressMatch // (Non U.S. cards) ZIP unverified, street address matches. AVSResponseNameNoMatch // Cardholder's name doesn't match. AVSResponseNameNoMatchAddressMatch // Cardholder's name doesn't match, street address matches. AVSResponseNameNoMatchZipMatch // Cardholder's name doesn't match but ZIP code matches AVSResponseNameNoMatchZipMatchAddressMatch // Cardholder's name doesn't match but both zip/address do match AVSResponseNameMatchZipMatchAddressNoMatch // Cardholder's name and ZIP match, street address doesn't match. AVSResponseNameMatchZipNoMatchAddressMatch // Cardholder's name and street address match, ZIP doesn't match. AVSResponseNameMatchZipNoMatchAddressNoMatch // Cardholder's name matches, ZIP and street address don't match. AVSResponseNameMatchZipMatchAddressMatch // Cardholder's name, zip, and address all match )
Consts representing the various AVSResponses we can get We keep this pretty general to translate into any of our PsPs we support
func (AVSResponse) String ¶ added in v1.0.225
func (code AVSResponse) String() string
String returns a string representation of a AVS response code
type AuthorizationRequest ¶
type AuthorizationRequest struct { Amount Amount CreditCard *CreditCard BillingAddress *BillingAddress Level3Data *Level3Data ClientTransactionReference *string // Custom transaction reference metadata that will be associated with this request Channel string // for Psps that track the sales channel Options map[string]interface{} }
AuthorizationRequest specifies needed information for request to authorize by PsPs Note: Only credit cards are supported Note: Options is a generic key-value pair that can be used to provide additional information to PsP
type AuthorizationResponse ¶
type AuthorizationResponse struct { // Raw fields contain the untranslated responses from processors, while // the non-raw fields are the best parsings to a single standard, with // loss of granularity minimized. The latter should be preferred when // treating Sleet as a black box. Success bool TransactionReference string AvsResult AVSResponse CvvResult CVVResponse Response string ErrorCode string AvsResultRaw string CvvResultRaw string }
AuthorizationResponse is a generic response returned back to client after data massaging from PsP Response The raw AVS and CVV are included if applicable Success is true if Auth went through successfully
type BillingAddress ¶
type BillingAddress struct { StreetAddress1 *string StreetAddress2 *string Locality *string RegionCode *string PostalCode *string CountryCode *string // ISO 2-digit code Company *string Email *string }
BillingAddress used for AVS checks for auth calls
type CVVResponse ¶ added in v1.0.225
type CVVResponse int
CVVResponse represents a possible CVV/CVN verification response.
const ( CVVResponseUnknown CVVResponse = iota // Unknown CVV code returned by processor CVVResponseNoResponse // No verification response was given CVVResponseError // An error prevented verification (e.g. data validation check failed) CVVResponseUnsupported // CVV verification is not supported CVVResponseMatch // CVV matches CVVResponseNoMatch // CVV doesn't match CVVResponseNotProcessed // Verification didn't happen (e.g. auth already declined by bank before checking CVV) CVVResponseRequiredButMissing // CVV should be present, but it was reported as not CVVResponseSuspicious // The issuing bank determined this transaction to be suspicious CVVResponseSkipped // Verification was not performed for this transaction )
Enum representing general CVV responses that we have
func (CVVResponse) String ¶ added in v1.0.225
func (code CVVResponse) String() string
String returns a string representation of a CVV response code
type CaptureRequest ¶
type CaptureRequest struct { Amount *Amount TransactionReference string ClientTransactionReference *string // Custom transaction reference metadata that will be associated with this request }
CaptureRequest specifies the authorized transaction to capture and also an amount for partial capture use cases
type CaptureResponse ¶
CaptureResponse will have Success be true if transaction is captured and also a reference to be used for subsequent operations
type Client ¶
type Client interface { Authorize(request *AuthorizationRequest) (*AuthorizationResponse, error) Capture(request *CaptureRequest) (*CaptureResponse, error) Void(request *VoidRequest) (*VoidResponse, error) Refund(request *RefundRequest) (*RefundResponse, error) }
Client defines the Sleet interface which takes in a generic request and returns a generic response The translations for each specific PsP takes place in the corresponding gateways/<PsP> folders The four supported methods are Auth, Capture, Void, Refund
type Code ¶ added in v1.0.310
type Code string
Code represents ISO 4217 Currency Codes
const ( AED Code = "AED" AFN Code = "AFN" ALL Code = "ALL" AMD Code = "AMD" ANG Code = "ANG" AOA Code = "AOA" ARS Code = "ARS" AUD Code = "AUD" AWG Code = "AWG" AZN Code = "AZN" BAM Code = "BAM" BBD Code = "BBD" BDT Code = "BDT" BGN Code = "BGN" BHD Code = "BHD" BIF Code = "BIF" BMD Code = "BMD" BND Code = "BND" BOB Code = "BOB" BOV Code = "BOV" BRL Code = "BRL" BSD Code = "BSD" BTN Code = "BTN" BWP Code = "BWP" BYN Code = "BYN" BZD Code = "BZD" CAD Code = "CAD" CDF Code = "CDF" CHE Code = "CHE" CHF Code = "CHF" CHW Code = "CHW" CLF Code = "CLF" CLP Code = "CLP" CNY Code = "CNY" COP Code = "COP" COU Code = "COU" CRC Code = "CRC" CUC Code = "CUC" CUP Code = "CUP" CVE Code = "CVE" CZK Code = "CZK" DJF Code = "DJF" DKK Code = "DKK" DOP Code = "DOP" DZD Code = "DZD" EGP Code = "EGP" ERN Code = "ERN" ETB Code = "ETB" EUR Code = "EUR" FJD Code = "FJD" FKP Code = "FKP" GBP Code = "GBP" GEL Code = "GEL" GHS Code = "GHS" GIP Code = "GIP" GMD Code = "GMD" GNF Code = "GNF" GTQ Code = "GTQ" GYD Code = "GYD" HKD Code = "HKD" HNL Code = "HNL" HRK Code = "HRK" HTG Code = "HTG" HUF Code = "HUF" IDR Code = "IDR" ILS Code = "ILS" INR Code = "INR" IQD Code = "IQD" IRR Code = "IRR" ISK Code = "ISK" JMD Code = "JMD" JOD Code = "JOD" JPY Code = "JPY" KES Code = "KES" KGS Code = "KGS" KHR Code = "KHR" KMF Code = "KMF" KPW Code = "KPW" KRW Code = "KRW" KWD Code = "KWD" KYD Code = "KYD" KZT Code = "KZT" LAK Code = "LAK" LBP Code = "LBP" LKR Code = "LKR" LRD Code = "LRD" LSL Code = "LSL" LYD Code = "LYD" MAD Code = "MAD" MDL Code = "MDL" MGA Code = "MGA" MKD Code = "MKD" MMK Code = "MMK" MNT Code = "MNT" MOP Code = "MOP" MRU Code = "MRU" MUR Code = "MUR" MVR Code = "MVR" MWK Code = "MWK" MXN Code = "MXN" MXV Code = "MXV" MYR Code = "MYR" MZN Code = "MZN" NAD Code = "NAD" NGN Code = "NGN" NIO Code = "NIO" NOK Code = "NOK" NPR Code = "NPR" NZD Code = "NZD" OMR Code = "OMR" PAB Code = "PAB" PEN Code = "PEN" PGK Code = "PGK" PHP Code = "PHP" PKR Code = "PKR" PLN Code = "PLN" PYG Code = "PYG" QAR Code = "QAR" RON Code = "RON" RSD Code = "RSD" RUB Code = "RUB" RWF Code = "RWF" SAR Code = "SAR" SBD Code = "SBD" SCR Code = "SCR" SDG Code = "SDG" SEK Code = "SEK" SGD Code = "SGD" SHP Code = "SHP" SLL Code = "SLL" SOS Code = "SOS" SRD Code = "SRD" SSP Code = "SSP" STN Code = "STN" SVC Code = "SVC" SYP Code = "SYP" SZL Code = "SZL" THB Code = "THB" TJS Code = "TJS" TMT Code = "TMT" TND Code = "TND" TOP Code = "TOP" TRY Code = "TRY" TTD Code = "TTD" TWD Code = "TWD" TZS Code = "TZS" UAH Code = "UAH" UGX Code = "UGX" USD Code = "USD" USN Code = "USN" UYI Code = "UYI" UYU Code = "UYU" UYW Code = "UYW" UZS Code = "UZS" VES Code = "VES" VND Code = "VND" VUV Code = "VUV" WST Code = "WST" XAF Code = "XAF" XAG Code = "XAG" XAU Code = "XAU" XBA Code = "XBA" XBB Code = "XBB" XBC Code = "XBC" XBD Code = "XBD" XCD Code = "XCD" XDR Code = "XDR" XOF Code = "XOF" XPD Code = "XPD" XPF Code = "XPF" XPT Code = "XPT" XSU Code = "XSU" XTS Code = "XTS" XUA Code = "XUA" XXX Code = "XXX" YER Code = "YER" ZAR Code = "ZAR" ZMW Code = "ZMW" ZWL Code = "ZWL" )
ISO 4217 Code List
type CreditCard ¶
type CreditCard struct { FirstName string LastName string Number string ExpirationMonth int ExpirationYear int CVV string }
CreditCard represents raw credit card information
type Currency ¶ added in v1.0.310
Currency maps to the CURRENCIES list in currency.go specifying the symbol and precision for the currency
type Level3Data ¶
type Level3Data struct { CustomerReference string TaxAmount Amount DiscountAmount Amount ShippingAmount Amount DutyAmount Amount DestinationPostalCode string DestinationCountryCode string DestinationAdminArea string LineItems []LineItem }
Level3Data contains all of the information needed for Level3 processing including LineItems
type LineItem ¶
type LineItem struct { Description string ProductCode string UnitPrice Amount Quantity int64 TotalAmount Amount ItemTaxAmount Amount ItemDiscountAmount Amount UnitOfMeasure string CommodityCode string }
LineItem is used for Level3 Processing if enabled (not default). Specifies information per item in the order
type RefundRequest ¶
type RefundRequest struct { Amount *Amount TransactionReference string ClientTransactionReference *string // Custom transaction reference metadata that will be associated with this request Options map[string]interface{} }
RefundRequest for refunding a captured transaction with generic Options and amount to be refunded
type RefundResponse ¶
RefundResponse indicating if request went through successfully
type VoidRequest ¶
type VoidRequest struct { TransactionReference string ClientTransactionReference *string // Custom transaction reference metadata that will be associated with this request }
VoidRequest cancels an authorized transaction
type VoidResponse ¶
VoidResponse also specifies a transaction reference if PsP uses different transaction references for different states