Documentation ¶
Index ¶
- Variables
- type AmountDetails
- type BillingInformation
- type CardInformation
- type ClientReferenceInformation
- type CybersourceClient
- func (client *CybersourceClient) Authorize(request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
- func (client *CybersourceClient) Capture(request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
- func (client *CybersourceClient) Refund(request *sleet.RefundRequest) (*sleet.RefundResponse, error)
- func (client *CybersourceClient) Void(request *sleet.VoidRequest) (*sleet.VoidResponse, error)
- type Detail
- type Environment
- type ErrorInformation
- type Link
- type Links
- type OrderInformation
- type PaymentInformation
- type ProcessingInformation
- type ProcessorInformation
- type Request
- type Response
Constants ¶
This section is empty.
Variables ¶
var ( // Sandbox is the CyberSource test environment for testing API requests. Sandbox = NewEnvironment("apitest.cybersource.com") // Production is the CyberSource live environment for executing real payments. Production = NewEnvironment("api.cybersource.com") )
Functions ¶
This section is empty.
Types ¶
type AmountDetails ¶ added in v1.0.206
type BillingInformation ¶
type BillingInformation struct { FirstName string `json:"firstName"` LastName string `json:"lastName"` Address1 string `json:"address1"` Address2 string `json:"address2,omitempty"` PostalCode string `json:"postalCode"` Locality string `json:"locality"` AdminArea string `json:"administrativeArea"` Country string `json:"country"` Phone string `json:"phoneNumber"` Company string `json:"company,omitempty"` Email string `json:"email"` }
type CardInformation ¶
type CybersourceClient ¶
type CybersourceClient struct {
// contains filtered or unexported fields
}
CybersourceClient represents an HTTP client and the associated authentication information required for making an API request.
func NewClient ¶
func NewClient(env Environment, merchantID string, sharedSecretKeyID string, sharedSecretKey string) *CybersourceClient
NewClient returns a new client for making CyberSource API requests for a given merchant using a specified authentication key.
func NewWithHttpClient ¶
func NewWithHttpClient(env Environment, merchantID string, sharedSecretKeyID string, sharedSecretKey string, httpClient *http.Client) *CybersourceClient
NewWithHttpClient returns a client for making CyberSource API requests for a given merchant using a specified authentication key. The given HTTP client will be used to make the requests.
func (*CybersourceClient) Authorize ¶
func (client *CybersourceClient) Authorize(request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
Authorize make a payment authorization request to CyberSource for the given payment details. If successful, the authorization response will be returned.
func (*CybersourceClient) Capture ¶
func (client *CybersourceClient) Capture(request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
Capture captures an authorized payment through CyberSource. If successful, the capture response will be returned. Multiple captures can be made on the same authorization, but the total amount captured should not exceed the total authorized amount.
func (*CybersourceClient) Refund ¶
func (client *CybersourceClient) Refund(request *sleet.RefundRequest) (*sleet.RefundResponse, error)
Refund refunds a CyberSource payment. If successful, the refund response will be returned. Multiple refunds can be made on the same payment, but the total amount refunded should not exceed the payment total.
func (*CybersourceClient) Void ¶
func (client *CybersourceClient) Void(request *sleet.VoidRequest) (*sleet.VoidResponse, error)
Void cancels a CyberSource payment. If successful, the void response will be returned. A previously voided payment or one that has already been settled cannot be voided.
type Environment ¶ added in v1.0.206
type Environment struct {
// contains filtered or unexported fields
}
func NewEnvironment ¶ added in v1.0.206
func NewEnvironment(host string) Environment
func (Environment) Host ¶ added in v1.0.206
func (e Environment) Host() string
type ErrorInformation ¶ added in v1.0.206
type ErrorInformation struct { Reason string `json:"reason"` Message string `json:"message"` Details *[]Detail `json:"details,omitempty"` }
ErrorInformation holds error information from an otherwise successful authorization request.
type OrderInformation ¶
type OrderInformation struct { BillTo BillingInformation `json:"billTo"` AmountDetails AmountDetails `json:"amountDetails"` }
type PaymentInformation ¶
type PaymentInformation struct {
Card CardInformation `json:"card"`
}
type ProcessingInformation ¶
type ProcessorInformation ¶
type Request ¶
type Request struct { ClientReferenceInformation *ClientReferenceInformation `json:"clientReferenceInformation,omitempty"` ProcessingInformation *ProcessingInformation `json:"processingInformation,omitempty"` OrderInformation *OrderInformation `json:"orderInformation,omitempty"` PaymentInformation *PaymentInformation `json:"paymentInformation,omitempty"` }
Should we just combine these to one Request and have pointers?
type Response ¶
type Response struct { Links *Links `json:"_links,omitempty"` ID *string `json:"id,omitempty"` SubmitTimeUTC string `json:"submitTimeUtc"` Status string `json:"status"` // TODO: Make into enum ReconciliationID *string `json:"reconciliationId,omitempty"` ErrorInformation *ErrorInformation `json:"errorInformation,omitempty"` ClientReferenceInformation *ClientReferenceInformation `json:"clientReferenceInformation,omitempty"` ProcessorInformation *ProcessorInformation `json:"processorInformation,omitempty"` OrderInformation *OrderInformation `json:"orderInformation,omitempty"` ErrorReason *string `json:"reason,omitempty"` ErrorMessage *string `json:"message,omitempty"` }