Documentation ¶
Index ¶
- Constants
- type Address
- type BraintreeClient
- func (client *BraintreeClient) Authorize(request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
- func (client *BraintreeClient) Capture(request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
- func (client *BraintreeClient) Refund(request *sleet.RefundRequest) (*sleet.RefundResponse, error)
- func (client *BraintreeClient) Void(request *sleet.VoidRequest) (*sleet.VoidResponse, error)
- type Credentials
- type CreditCard
- type Transaction
- type TransactionRequest
Constants ¶
const (
// TransactionTypeSale is for new, e-commerce transactions. This is the only transaction type supported
TransactionTypeSale = "sale"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Address ¶
type Address struct { FirstName string `xml:"first-name,omitempty"` LastName string `xml:"last-name,omitempty"` StreetAddress *string `xml:"street-address,omitempty"` Locality *string `xml:"locality,omitempty"` Region *string `xml:"region,omitempty"` PostalCode *string `xml:"postal-code,omitempty"` CountryCodeAlpha2 *string `xml:"country-code-alpha2,omitempty"` }
Address is used for Auth request
type BraintreeClient ¶
type BraintreeClient struct {
// contains filtered or unexported fields
}
BraintreeClient uses creds and httpClient to make calls to Braintree service Client functions return error for http error and will return Success=true if action is performed successfully
func NewClient ¶
func NewClient(credentials *Credentials) *BraintreeClient
NewClient creates a Braintree client with creds and default http client
func NewWithHttpClient ¶
func NewWithHttpClient(credentials *Credentials, httpClient *http.Client) *BraintreeClient
NewWithHttpClient creates a Braintree client with creds and user specified http client for custom behavior
func (*BraintreeClient) Authorize ¶
func (client *BraintreeClient) Authorize(request *sleet.AuthorizationRequest) (*sleet.AuthorizationResponse, error)
Authorize a transaction. This transaction must be captured to receive funds
func (*BraintreeClient) Capture ¶
func (client *BraintreeClient) Capture(request *sleet.CaptureRequest) (*sleet.CaptureResponse, error)
Capture an authorized transaction with reference
func (*BraintreeClient) Refund ¶
func (client *BraintreeClient) Refund(request *sleet.RefundRequest) (*sleet.RefundResponse, error)
Refund a captured transaction with reference and specified amount
func (*BraintreeClient) Void ¶
func (client *BraintreeClient) Void(request *sleet.VoidRequest) (*sleet.VoidResponse, error)
Void an authorized transaction with reference (cancels void)
type Credentials ¶
Credentials specifies account information needed to make API calls to Braintree
type CreditCard ¶
type CreditCard struct { Number string `xml:"number,omitempty"` ExpirationDate string `xml:"expiration-date,omitempty"` CVV string `xml:"cvv,omitempty"` }
CreditCard represents raw CC in Braintree
type Transaction ¶
type Transaction struct { ID string `xml:"id"` Status string `xml:"status"` Type string `xml:"type"` CurrencyISOCode string `xml:"currency-iso-code"` Amount string `xml:"amount"` OrderIdD string `xml:"order-id"` CreditCard *CreditCard `xml:"credit-card"` BillingAddress *Address `xml:"billing"` CreatedAt *time.Time `xml:"created-at"` UpdatedAt *time.Time `xml:"updated-at"` AVSErrorResponseCode string `xml:"avs-error-response-code"` AVSPostalCodeResponseCode string `xml:"avs-postal-code-response-code"` AVSStreetAddressResponseCode string `xml:"avs-street-address-response-code"` CVVResponseCode string `xml:"cvv-response-code"` }
Transaction is the response object back from Braintree authorization call
type TransactionRequest ¶
type TransactionRequest struct { XMLName string `xml:"transaction"` Type string `xml:"type,omitempty"` Amount string `xml:"amount"` OrderID string `xml:"order-id,omitempty"` CreditCard *CreditCard `xml:"credit-card,omitempty"` BillingAddress *Address `xml:"billing,omitempty"` }
TransactionRequest is used to start an authorization request for BT