Documentation ¶
Index ¶
- type AVSResultCode
- type AuthorizeNetClient
- func (client *AuthorizeNetClient) Authorize(request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
- func (client *AuthorizeNetClient) Capture(request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
- func (client *AuthorizeNetClient) Refund(request *sleet.RefundRequest) (*sleet.RefundResponse, error)
- func (client *AuthorizeNetClient) Void(request *sleet.VoidRequest) (*sleet.VoidResponse, error)
- type BillingAddress
- type CAVVResultCode
- type CVVResultCode
- type CreateTransactionRequest
- type CreditCard
- type Error
- type MerchantAuthentication
- type Message
- type Messages
- type Payment
- type Request
- type Response
- type ResponseCode
- type ResultCode
- type TransactionRequest
- type TransactionResponse
- type TransactionResponseMessage
- type TransactionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AVSResultCode ¶ added in v1.1.500
type AVSResultCode string
AVSResultCode result of AVS check
const ( AVSResultNotPresent AVSResultCode = "B" AVSResultError AVSResultCode = "E" AVSResultNotApplicable AVSResultCode = "P" // AVS is not applicable for this transaction. AVSResultRetry AVSResultCode = "R" // AVS was unavailable or timed out. AVSResultNotSupportedIssuer AVSResultCode = "S" AVSResultPostMatchAddressMatch AVSResultCode = "Y" // The street address and postal code matched. AVSResultNoMatch AVSResultCode = "N" AVSResultPostNoMatchAddressMatch AVSResultCode = "A" AVSResultZipMatchAddressNoMatch AVSResultCode = "W" AVSResultZipMatchAddressMatch AVSResultCode = "X" // Both the street address and the US ZIP+4 code matched. AVSResultPostMatchAddressNoMatch AVSResultCode = "Z" AVSResultNotSupportedInternational AVSResultCode = "G" // The card was issued by a bank outside the U.S. and does not support AVS. )
type AuthorizeNetClient ¶
type AuthorizeNetClient struct {
// contains filtered or unexported fields
}
AuthorizeNetClient uses merchant name and transaction key to process requests. Optionally can provide custom http clients
func NewClient ¶
func NewClient(merchantName string, transactionKey string, environment common.Environment) *AuthorizeNetClient
NewClient uses authentication above with a default http client
func NewWithHttpClient ¶
func NewWithHttpClient(merchantName string, transactionKey string, environment common.Environment, httpClient *http.Client) *AuthorizeNetClient
NewWithHttpClient uses authentication with custom http client
func (*AuthorizeNetClient) Authorize ¶
func (client *AuthorizeNetClient) Authorize(request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
Authorize a transaction for specified amount using Auth.net REST APIs
func (*AuthorizeNetClient) Capture ¶
func (client *AuthorizeNetClient) Capture(request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
Capture an authorized transaction by transaction reference using the transactionTypePriorAuthCapture flag
func (*AuthorizeNetClient) Refund ¶
func (client *AuthorizeNetClient) Refund(request *sleet.RefundRequest) (*sleet.RefundResponse, error)
Refund a captured transaction with amount and captured transaction reference
func (*AuthorizeNetClient) Void ¶
func (client *AuthorizeNetClient) Void(request *sleet.VoidRequest) (*sleet.VoidResponse, error)
Void an existing authorized transaction
type BillingAddress ¶
type BillingAddress struct { FirstName string `json:"firstName"` LastName string `json:"lastName"` Company string `json:"company"` Address *string `json:"address"` City *string `json:"city"` State *string `json:"state"` Zip *string `json:"zip"` Country *string `json:"country"` }
BillingAddress is used in TransactionRequest for making an auth call
type CAVVResultCode ¶ added in v1.1.500
type CAVVResultCode string
CAVVResultCode The cardholder authentication verification value (CAVV) result code from the issuer.
const ( CAVVResultBadRequest CAVVResultCode = "0" CAVVResultFailed CAVVResultCode = "1" CAVVResultPassed CAVVResultCode = "2" CAVVResultAttemptIncomplete CAVVResultCode = "3" CAVVResultSytemError CAVVResultCode = "4" )
type CVVResultCode ¶ added in v1.1.500
type CVVResultCode string
CVVResultCode result of cvv check
const ( CVVResultMatched CVVResultCode = "M" CVVResultNoMatch CVVResultCode = "N" CVVResultNotProcessed CVVResultCode = "P" CVVResultNotPresent CVVResultCode = "S" CVVResultUnableToProcess CVVResultCode = "U" )
type CreateTransactionRequest ¶
type CreateTransactionRequest struct { MerchantAuthentication MerchantAuthentication `json:"merchantAuthentication"` RefID *string `json:"refId,omitempty"` TransactionRequest TransactionRequest `json:"transactionRequest"` }
CreateTransactionRequest specifies the merchant authentication to be used for request as well as transaction details specified in transactionRequest
type CreditCard ¶
type CreditCard struct { CardNumber string `json:"cardNumber"` ExpirationDate string `json:"expirationDate"` CardCode *string `json:"cardCode,omitempty"` }
CreditCard is raw cc info
type MerchantAuthentication ¶
type MerchantAuthentication struct { Name string `json:"name"` TransactionKey string `json:"transactionKey"` }
MerchantAuthentication is the name/key pair to authenticate Auth.net calls
type Message ¶
Message is similar to Error with code that maps to Auth.net internals and text for human readability
type Messages ¶
type Messages struct { ResultCode ResultCode `json:"resultCode"` Message []Message `json:"message"` }
Messages is used to augment responses with codes and readable messages
type Payment ¶
type Payment struct {
CreditCard CreditCard `json:"creditCard"`
}
Payment specifies the credit card to be authorized (only payment option for now)
type Request ¶
type Request struct {
CreateTransactionRequest CreateTransactionRequest `json:"createTransactionRequest"`
}
Request contains a createTransactionRequest for authorizations
type Response ¶
type Response struct { TransactionResponse TransactionResponse `json:"transactionResponse"` RefID string `json:"refId"` Messsages Messages `json:"messages"` }
Response is a generic Auth.net response
type ResponseCode ¶ added in v1.1.500
type ResponseCode string
ResponseCode response code representing information about the status of the payment request.
const ( ResponseCodeApproved ResponseCode = "1" ResponseCodeDeclined ResponseCode = "2" ResponseCodeError ResponseCode = "3" ResponseCodeHeld ResponseCode = "4" )
type ResultCode ¶ added in v1.1.500
type ResultCode string
ResultCode result of request (ok/error)
const ( ResultCodeOK ResultCode = "Ok" ResultCodeError ResultCode = "Error" )
type TransactionRequest ¶
type TransactionRequest struct { TransactionType TransactionType `json:"transactionType"` Amount *string `json:"amount,omitempty"` Payment *Payment `json:"payment,omitempty"` BillingAddress *BillingAddress `json:"billTo,omitempty"` RefTransactionID *string `json:"refTransId,omitempty"` }
TransactionRequest has the raw credit card info as Payment and amount to authorize
type TransactionResponse ¶
type TransactionResponse struct { ResponseCode ResponseCode `json:"responseCode"` AuthCode string `json:"authCode"` AVSResultCode AVSResultCode `json:"avsResultCode"` CVVResultCode CVVResultCode `json:"cvvResultCode"` CAVVResultCode CAVVResultCode `json:"cavvResultCode"` TransID string `json:"transId"` RefTransID string `json:"refTransID"` TransHash string `json:"transHash"` AccountNumber string `json:"accountNumber"` AccountType string `json:"accountType"` Messages []TransactionResponseMessage `json:"messages"` Errors []Error `json:"errors"` }
TransactionResponse contains the information from issuer about AVS, CVV and whether or not authorization was successful
type TransactionResponseMessage ¶
type TransactionResponseMessage struct { Code string `json:"code"` Description string `json:"description"` }
TransactionResponseMessage contains additional information about transaction result from processor
type TransactionType ¶ added in v1.1.500
type TransactionType string
const ( TransactionTypeAuthOnly TransactionType = "authOnlyTransaction" TransactionTypeVoid TransactionType = "voidTransaction" TransactionTypePriorAuthCapture TransactionType = "priorAuthCaptureTransaction" TransactionTypeRefund TransactionType = "refundTransaction" )