Documentation ¶
Index ¶
- Constants
- type AVSResultCode
- type AuthorizeNetClient
- func (client *AuthorizeNetClient) Authorize(request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
- func (client *AuthorizeNetClient) AuthorizeWithContext(ctx context.Context, request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
- func (client *AuthorizeNetClient) Capture(request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
- func (client *AuthorizeNetClient) CaptureWithContext(ctx context.Context, request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
- func (client *AuthorizeNetClient) GetTransactionDetails(request *sleet.TransactionDetailsRequest) (*sleet.TransactionDetailsResponse, error)
- func (client *AuthorizeNetClient) GetTransactionDetailsWithContext(ctx context.Context, request *sleet.TransactionDetailsRequest) (*sleet.TransactionDetailsResponse, error)
- func (client *AuthorizeNetClient) Refund(request *sleet.RefundRequest) (*sleet.RefundResponse, error)
- func (client *AuthorizeNetClient) RefundWithContext(ctx context.Context, request *sleet.RefundRequest) (*sleet.RefundResponse, error)
- func (client *AuthorizeNetClient) Void(request *sleet.VoidRequest) (*sleet.VoidResponse, error)
- func (client *AuthorizeNetClient) VoidWithContext(ctx context.Context, request *sleet.VoidRequest) (*sleet.VoidResponse, error)
- type BillingAddress
- type CAVVResultCode
- type CVVResultCode
- type CreateTransactionRequest
- type CreditCard
- type Customer
- type Error
- type ExtendedAmount
- type GetTransactionDetailsRequest
- type LineItem
- type MerchantAuthentication
- type Message
- type MessageResponseCode
- type Messages
- type OpaqueData
- type Order
- type Payment
- type Request
- type Response
- type ResponseCode
- type ResultCode
- type ShippingAddress
- type Transaction
- type TransactionRequest
- type TransactionResponse
- type TransactionResponseMessage
- type TransactionType
Constants ¶
const (
GooglePayPaymentDescriptor = "COMMON.GOOGLE.INAPP.PAYMENT"
)
const (
InvoiceNumberMaxLength = 20
)
const (
MessageResponseCodeAlreadyCaptured = "311"
)
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) AuthorizeWithContext ¶ added in v1.1.1297
func (client *AuthorizeNetClient) AuthorizeWithContext(ctx context.Context, request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
AuthorizeWithContext 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) CaptureWithContext ¶ added in v1.1.1297
func (client *AuthorizeNetClient) CaptureWithContext(ctx context.Context, request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
CaptureWithContext captures an authorized transaction by transaction reference using the transactionTypePriorAuthCapture flag
func (*AuthorizeNetClient) GetTransactionDetails ¶ added in v1.1.1362
func (client *AuthorizeNetClient) GetTransactionDetails(request *sleet.TransactionDetailsRequest) (*sleet.TransactionDetailsResponse, error)
GetTransactionDetails Use this function to get detailed information about a specific transaction. Used to get the last 4 digits of a card to support Google Pay
func (*AuthorizeNetClient) GetTransactionDetailsWithContext ¶ added in v1.1.1362
func (client *AuthorizeNetClient) GetTransactionDetailsWithContext(ctx context.Context, request *sleet.TransactionDetailsRequest) (*sleet.TransactionDetailsResponse, error)
GetTransactionDetails Use this function to get detailed information about a specific transaction. Used to get the last 4 digits of a card to support Google Pay
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) RefundWithContext ¶ added in v1.1.1297
func (client *AuthorizeNetClient) RefundWithContext(ctx context.Context, request *sleet.RefundRequest) (*sleet.RefundResponse, error)
RefundWithContext refunds 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
func (*AuthorizeNetClient) VoidWithContext ¶ added in v1.1.1297
func (client *AuthorizeNetClient) VoidWithContext(ctx context.Context, request *sleet.VoidRequest) (*sleet.VoidResponse, error)
VoidWithContext voids 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"` PhoneNumber *string `json:"phoneNumber"` }
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"` IsPaymentToken *bool `json:"isPaymentToken,omitempty"` Cryptogram string `json:"cryptogram,omitempty"` }
CreditCard is raw cc info
type ExtendedAmount ¶ added in v1.1.1368
type GetTransactionDetailsRequest ¶ added in v1.1.1362
type GetTransactionDetailsRequest struct { MerchantAuthentication MerchantAuthentication `json:"merchantAuthentication,omitempty"` TransID string `json:"transId,omitempty"` }
GetTransactionDetailsRequest contains a transaction ID for fetching transaction details
type LineItem ¶ added in v1.1.900
type LineItem struct { ItemId string `json:"itemId,omitempty"` // min length = 1, max length = 31 Name string `json:"name,omitempty"` // min length = 1, max length = 31 Description string `json:"description,omitempty"` // max length = 255 Quantity string `json:"quantity,omitempty"` // decimal as string, max decimal precision = 4 UnitPrice string `json:"unitPrice,omitempty"` // decimal as string, max decimal precision = 4 Taxable string `json:"taxable,omitempty"` // boolean as string }
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 MessageResponseCode ¶ added in v1.1.1035
type MessageResponseCode string
MessageResponseCode message API response codes specific to AuthorizeNet
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 OpaqueData ¶ added in v1.1.1323
type OpaqueData struct { DataDescriptor string `json:"dataDescriptor"` DataValue string `json:"dataValue"` }
OpaqueData Contains dataDescriptor and dataValue dataDescriptor Specifies how the request should be processed. dataValue Base64 encoded data that contains encrypted payment data known as the payment nonce. The nonce is valid for 15 minutes
type Order ¶ added in v1.1.780
type Order struct {
InvoiceNumber string `json:"invoiceNumber"`
}
Order is used in TransactionRequest for passing information about the order
type Payment ¶
type Payment struct { CreditCard *CreditCard `json:"creditCard,omitempty"` OpaqueData *OpaqueData `json:"opaqueData,omitempty"` }
Payment specifies the credit card to be authorized (only payment option for now)
type Request ¶
type Request struct { CreateTransactionRequest *CreateTransactionRequest `json:"createTransactionRequest,omitempty"` GetTransactionDetailsRequest *GetTransactionDetailsRequest `json:"getTransactionDetailsRequest,omitempty"` }
Request contains a createTransactionRequest for authorizations
func BuildTransactionDetailsRequest ¶ added in v1.1.1362
type Response ¶
type Response struct { TransactionResponse TransactionResponse `json:"transactionResponse"` Transaction *Transaction `json:"transaction,omitempty"` 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 ShippingAddress ¶ added in v1.1.1048
type ShippingAddress 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"` }
ShippingAddress is used in TransactionRequest for making an auth call
type Transaction ¶ added in v1.1.1362
type Transaction struct { TransID string `json:"transId,omitempty"` Payment *Payment `json:"payment,omitempty"` }
Transaction describes the transaction details
type TransactionRequest ¶
type TransactionRequest struct { TransactionType TransactionType `json:"transactionType"` Amount *string `json:"amount,omitempty"` Payment *Payment `json:"payment,omitempty"` RefTransactionID *string `json:"refTransId,omitempty"` Order *Order `json:"order,omitempty"` LineItem json.RawMessage `json:"lineItems,omitempty"` // this is really a repeating LineItem, but authorize.net expects it in object not array // since not valid json, just going to represent as JSON string Tax *ExtendedAmount `json:"tax,omitempty"` Duty *ExtendedAmount `json:"duty,omitempty"` Shipping *ExtendedAmount `json:"shipping,omitempty"` Customer *Customer `json:"customer,omitempty"` BillingAddress *BillingAddress `json:"billTo,omitempty"` ShippingAddress *ShippingAddress `json:"shipTo,omitempty"` CustomerIP *string `json:"customerIP,omitempty"` }
TransactionRequest has the raw credit card info as Payment and amount to authorize ************************************************************************* ************************************************************************* ***** AUTHORIZE NET HAS STRICT JSON ORDERING DUE TO XML TRANSLATION ***** ***** YOU MUST FOLLOW FIELD ORDER AS SPECIFIED IN THEIR API DOCS ***** ***** https://developer.authorize.net/api/reference/index.html ***** ************************************************************************* *************************************************************************
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 MessageResponseCode `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" TransactionTypeAuthCapture TransactionType = "authCaptureTransaction" TransactionTypeVoid TransactionType = "voidTransaction" TransactionTypePriorAuthCapture TransactionType = "priorAuthCaptureTransaction" TransactionTypeRefund TransactionType = "refundTransaction" )