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 LineItem
- type Link
- type Links
- type OrderInformation
- type PaymentInformation
- type ProcessingInformation
- type ProcessorInformation
- type Request
- type Response
- type ShippingDetails
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 AmountDetails struct { AuthorizedAmount string `json:"authorizedAmount,omitempty"` Amount string `json:"totalAmount,omitempty"` Currency string `json:"currency"` DiscountAmount string `json:"discountAmount,omitempty"` // Level 3 field TaxAmount string `json:"taxAmount,omitempty"` // Level 3 field FreightAmount string `json:"freightAmount,omitempty"` // Level 3 field - If set, "totalAmount" must also be included DutyAmount string `json:"dutyAmount,omitempty"` // Level 3 field }
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,omitempty"` }
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. If level 3 data is present in the authorization request and contains a CustomerReference, the ClientReferenceInformation of this request will be overridden in order to to match the level 3 data's CustomerReference.
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 LineItem ¶ added in v1.0.246
type LineItem struct { ProductCode string `json:"productCode"` ProductName string `json:"productName"` Quantity string `json:"quantity"` UnitPrice string `json:"unitPrice"` TotalAmount string `json:"totalAmount"` DiscountAmount string `json:"discountAmount"` UnitOfMeasure string `json:"unitOfMeasure"` CommodityCode string `json:"commodityCode"` TaxAmount string `json:"taxAmount"` }
type OrderInformation ¶
type OrderInformation struct { BillTo BillingInformation `json:"billTo"` AmountDetails AmountDetails `json:"amountDetails"` LineItems []LineItem `json:"lineItems,omitempty"` // Level 3 field ShipTo ShippingDetails `json:"shipTo,omitempty"` // Level 3 field }
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"` Details *[]Detail `json:"details,omitempty"` }
type ShippingDetails ¶ added in v1.0.246
type ShippingDetails struct { FirstName string `json:"firstName,omitempty"` LastName string `json:"lastName,omitempty"` Address1 string `json:"address1,omitempty"` Address2 string `json:"address2,omitempty"` Locality string `json:"locality,omitempty"` AdminArea string `json:"administrativeArea,omitempty"` PostalCode string `json:"postalCode,omitempty"` Country string `json:"country,omitempty"` District string `json:"district,omitempty"` BuildingNumber string `json:"buildingNumber,omitempty"` Phone string `json:"phoneNumber,omitempty"` Company string `json:"company,omitempty"` }