Documentation
¶
Overview ¶
Entities provide even more information about the type of response received from services.
It's important to note that you should use the correct methods when validating and serializing the response. The difference is explicitly indicated in the method name, indicating which type of entity it works with.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateResponseCardResult ¶
func ValidateResponseCardResult(response interface{}) bool
Validates if the response result from the tokenization method is valid.
The `response` parameter is an object that represents the response.
It returns a boolean value indicating whether the response is valid or not.
func ValidateResponseTransactionResult ¶
func ValidateResponseTransactionResult(response interface{}) bool
Validates if the response result from the transaction method is valid.
The `response` parameter is an object that represents the response.
It returns a boolean value indicating whether the response is valid or not.
Types ¶
type CardResult ¶
type CardResult struct {
// Card status
Status string `json:"status,omitempty"`
// Card number masked
Mask string `json:"mask,omitempty"`
// Card network brand
Network string `json:"network,omitempty"`
// Card type (debit/credit)
Type string `json:"type,omitempty"`
// Car bin number
Bin string `json:"bin,omitempty"`
// Card last 4 numbers
Last string `json:"last,omitempty"`
// Card unique hash number
Hash string `json:"hash,omitempty"`
// Billing address
Address string `json:"address,omitempty"`
// Billing country
Country string `json:"country,omitempty"`
// Billing state
State string `json:"state,omitempty"`
// Billing city
City string `json:"city,omitempty"`
// The zip
Zip string `json:"zip,omitempty"`
// Billing customer email
Email string `json:"email,omitempty"`
// Billing phone
Phone string `json:"phone,omitempty"`
}
CardResult provides a specific structure for a response coming from a transaction with a tokenized card.
func FromResponseCardResult ¶
func FromResponseCardResult(response interface{}) (*CardResult, error)
This function converts a SuccessResponse into a CardResult entity by obtaining the type of the response, retrieving its data field, and returning it as a CardResult entity.
The `response` parameter is an object that represents the response.
If the entity is nil, the function returns a new empty CardResult. If an error occurs at any point during execution, the function returns a new empty CardResult along with the error.
type TransactionResult ¶
type TransactionResult struct {
// Transaction response type
TransactionType string `json:"transaction_type,omitempty"`
// Transaction redeemed points
TransactionEedeemedPoints float64 `json:"transaction_redeemed_points,omitempty"`
// Approved amount on capture/sale
TransactionApprovedAmount float64 `json:"transaction_approved_amount,omitempty"`
// Initial or registered transaction amount
TransactionAmount float64 `json:"transaction_amount,omitempty"`
// Transaction AUTH reference code
TransactionAuth string `json:"transaction_auth,omitempty"`
// Transacction network terminal ID
TransactionTerminal string `json:"transaction_terminal,omitempty"`
// Transaction network merchant ID
TransactionMerchant string `json:"transaction_merchant,omitempty"`
// CVV2 result response code
ResponseCvn string `json:"response_cvn,omitempty"`
// Address verification code response
ResponseAvs string `json:"response_avs,omitempty"`
// CAVV network evaluation result code
ResponseCavv string `json:"response_cavv,omitempty"`
// Transaction identifier
TransactionId string `json:"transaction_id,omitempty"`
// Transaction STAN, proccesor transacction identifier or transaction reference
TransactionReference string `json:"transaction_reference,omitempty"`
// Transaction result time
TransactionTime string `json:"transaction_time,omitempty"`
// Transaction result date
TransactionDate string `json:"transaction_date,omitempty"`
// Response is financial approved
ResponseApproved bool `json:"response_approved,omitempty"`
// Response fatal not completed or excecution interrupted
ResponseIncomplete bool `json:"response_incomplete,omitempty"`
// Proccesor response code
ResponseCode string `json:"response_code,omitempty"`
// Network response time
ResponseTime string `json:"response_time,omitempty"`
// Proccesor response message
ResponseReason string `json:"response_reason,omitempty"`
// Transaction installment type
InstallmentType string `json:"installment_type,omitempty"`
// Transaction installment value
InstallmentMonths string `json:"installment_months,omitempty"`
// Payment unique identifier
PaymentUuid string `json:"payment_uuid,omitempty"`
// Payment integrity validation hash
PaymentHash string `json:"payment_hash,omitempty"`
}
TransactionResult provides a specific structure for a response coming from a transaction.
func FromResponseTransactionResult ¶
func FromResponseTransactionResult(response interface{}) (*TransactionResult, error)
This function converts a valid response into a TransactionResult entity by obtaining the type of the response, retrieving its data field, and returning it as a TransactionResult entity.
The `response` parameter is an object that represents the response.
If the entity is nil, the function returns a new empty TransactionResult. If an error occurs at any point during execution, the function returns a new empty TransactionResult along with the error.