Documentation ¶
Index ¶
- Constants
- 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 CreateTransactionRequest
- type CreditCard
- type Error
- type MerchantAuthentication
- type Message
- type Messages
- type Payment
- type Request
- type Response
- type TransactionRequest
- type TransactionResponse
- type TransactionResponseMessage
Constants ¶
const (
// ResponseCodeApproved indicates the successful response from authnet requests
ResponseCodeApproved = "1"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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) *AuthorizeNetClient
NewClient uses authentication above with a default http client
func NewWithHttpClient ¶
func NewWithHttpClient(merchantName string, transactionKey string, 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 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 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 TransactionRequest ¶
type TransactionRequest struct { TransactionType string `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 string `json:"responseCode"` AuthCode string `json:"authCode"` AVSResultCode string `json:"avsResultCode"` CVVResultCode string `json:"cvvResultCode"` CAVVResultCode string `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