firstdata

package
v1.1.888 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2021 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AVSResponse

type AVSResponse struct {
	StreetMatch   AVSResponseCode `json:"streetMatch"`
	PostCodeMatch AVSResponseCode `json:"postalCodeMatch"`
}

AVSResponse contains the avs response codes for the provided street and zip code

type AVSResponseCode

type AVSResponseCode string

AVSResponseCode represents the valid avs response codes for street address and zip code that can be present in a AVSResponse struct

const (
	AVSResponseMatch      AVSResponseCode = "Y"
	AVSResponseNotMatch   AVSResponseCode = "N"
	AVSResponseNoInput    AVSResponseCode = "NO_INPUT_DATA"
	AVSResponseNotChecked AVSResponseCode = "NOT_CHECKED"
)

type ApprovedAmount

type ApprovedAmount struct {
	Total    float64 `json:"total"`
	Currency string  `json:"currency"`
}

ApprovedAmount contains the approved transaction value and currency returned from a firstdata response

type CVVResponseCode

type CVVResponseCode string

CVVResponseCode represents the valid cvv response codes that can be present in a firstdata response

const (
	CVVResponseMatched      CVVResponseCode = "MATCHED"
	CVVResponseNotMatched   CVVResponseCode = "NOT_MATCHED"
	CVVResponseNotProcessed CVVResponseCode = "NOT_PROCESSED"
	CVVResponseNotCertified CVVResponseCode = "NOT_CERTIFIED"
	CVVResponseNotChecked   CVVResponseCode = "NOT_CHECKED"
	CVVResponseNotPresent   CVVResponseCode = "NOT_PRESENT"
)

type Credentials added in v1.1.420

type Credentials struct {
	ApiKey    string
	ApiSecret string
}

Credentials contains the merchant api key and secret for the firstdata gateway

type Error

type Error struct {
	Code    string        `json:"code"`
	Message string        `json:"message"`
	Details []ErrorDetail `json:"details"`
}

Error holds error information returned from a firstdata API call

type ErrorDetail

type ErrorDetail struct {
	Field   string `json:"field"`
	Message string `json:"message"`
}

ErrorDetail holds additional information about an error

type ExpiryDate

type ExpiryDate struct {
	Month string `json:"month"`
	Year  string `json:"year"` // Last 2 digits of year. "21" if the year is "2021"
}

ExpiryDate contains the expiry month and year (in 2 digit format) for a credit card

type FirstdataClient added in v1.1.420

type FirstdataClient struct {
	// contains filtered or unexported fields
}

FirstdataClient contains the endpoint and credentials for the firstdata api as well as a client to send requests

func NewClient added in v1.1.420

func NewClient(env common.Environment, credentials Credentials) *FirstdataClient

NewClient creates a new firstdataClient with the given credentials and a default httpClient

func (*FirstdataClient) Authorize added in v1.1.422

Authorize make a payment authorization request to FirstData for the given payment details. If successful, the authorization response will be returned.

func (*FirstdataClient) Capture added in v1.1.422

func (client *FirstdataClient) Capture(request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)

Capture captures an authorized payment through FirstData. If successful, the capture response will be returned.

func (*FirstdataClient) Refund added in v1.1.433

func (client *FirstdataClient) Refund(request *sleet.RefundRequest) (*sleet.RefundResponse, error)

Refund refunds a Firstdata payment. Multiple refunds can be made on the same payment, but the total amount refunded should not exceed the payment total.

func (*FirstdataClient) Void added in v1.1.433

func (client *FirstdataClient) Void(request *sleet.VoidRequest) (*sleet.VoidResponse, error)

Void transforms a sleet void request into a first data VoidTransaction request and makes the request A transaction that has not yet been capture or has already been settled cannot be voided

type PaymentCard

type PaymentCard struct {
	Number       string     `json:"number"`
	SecurityCode string     `json:"securityCode"`
	ExpiryDate   ExpiryDate `json:"expiryDate"`
}

PaymentCard contains information about a credit card

type PaymentMethod

type PaymentMethod struct {
	PaymentCard PaymentCard `json:"paymentCard"`
}

PaymentMethod contains information on the payment medium the transaction is to be charged to

type ProcessorData

type ProcessorData struct {
	ReferenceNumber         string          `json:"referenceNumber"`
	AuthorizationCode       string          `json:"authorizationCode"`
	ResponseCode            string          `json:"responseCode"`
	ResponseMessage         string          `json:"responseMessage"`
	Network                 string          `json:"network"`
	AssociationResponseCode string          `json:"associationResponseCode"`
	AVSResponse             AVSResponse     `json:"avsResponse"`
	SecurityCodeResponse    CVVResponseCode `json:"securityCodeResponse"`
}

ProcessorData contains processor specific responses sent back primarily through authorize call

type Request

type Request struct {
	RequestType       RequestType       `json:"requestType"`
	TransactionAmount TransactionAmount `json:"transactionAmount"`
	PaymentMethod     PaymentMethod     `json:"paymentMethod"`
}

Request contains the information needed for all request types (Auth, Capture, Void, Refund)

type RequestType

type RequestType string

RequestType represents the valid requestType values that can be sent in a firstdata request

const (
	RequestTypeAuth    RequestType = "PaymentCardPreAuthTransaction"
	RequestTypeCapture RequestType = "PostAuthTransaction"
	RequestTypeRefund  RequestType = "ReturnTransaction"
	RequestTypeVoid    RequestType = "VoidTransaction"
)

type Response

type Response struct {
	ClientRequestId     string            `json:"clientRequestId"`
	ApiTraceId          string            `json:"apiTraceId"`
	ResponseType        string            `json:"responseType"`
	OrderId             *string           `json:"orderId"`
	IPGTransactionId    string            `json:"ipgTransactionId"`
	TransactionType     string            `json:"transactionType"`
	TransactionOrigin   string            `json:"transactionOrigin"`
	TransactionTime     int               `json:"transactionTime"` //EPOCH seconds
	ApprovedAmount      ApprovedAmount    `json:"approvedAmount"`
	TransactionStatus   TransactionStatus `json:"transactionStatus"`
	TransactionState    TransactionState  `json:"transactionState"`
	SchemeTransactionId string            `json:"schemeTransactionId"`
	Processor           ProcessorData     `json:"processor"`
	Error               *Error            `json:"error"`
}

Response contains all of the relevant fields for all firstdata API call responses. This struct contains the combined fields of the firstdata TransactionResponse,ErrorResponse and TransactionErrorResponse

type TransactionAmount

type TransactionAmount struct {
	Total    string `json:"total"`
	Currency string `json:"currency"`
}

TransactionAmount specifies the transaction value and currency for a firstdata api call

type TransactionState

type TransactionState string

TransactionState represents the valid transaction states that can be present in a firstdata response

const (
	StateAuthorized   TransactionState = "AUTHORIZED"
	StateCaptured     TransactionState = "CAPTURED"
	StateDeclined     TransactionState = "DECLINED"
	StateChecked      TransactionState = "CHECKED"
	StateCompletedGet TransactionState = "COMPLETED_GET"
	StateInitialized  TransactionState = "INITIALIZED"
	StatePending      TransactionState = "PENDING"
	StateReady        TransactionState = "READY"
	StateTemplate     TransactionState = "TEMPLATE"
	StateSettled      TransactionState = "SETTLED"
	StateVoided       TransactionState = "VOIDED"
	StateWaiting      TransactionState = "WAITING"
)

type TransactionStatus

type TransactionStatus string

TransactionStatus represents the valid transaction statuses that can be present in a firstdata response

const (
	StatusApproved         TransactionStatus = "APPROVED"
	StatusWaiting          TransactionStatus = "WAITING"
	StatusValidationFailed TransactionStatus = "VALIDATION_FAILED"
	StatusProcessingFailed TransactionStatus = "PROCESSING_FAILED"
	StatusDeclined         TransactionStatus = "DECLINED"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL