braintree

package module
v0.0.0-...-b3d43bb Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2019 License: Apache-2.0 Imports: 21 Imported by: 0

README

Brain Tree API Client

And all credits goes to braintree-go

Code was rearranged. Some tests might fail.

Documentation

Index

Constants

View Source
const (
	ModificationKindDiscount = "discount"
	ModificationKindAddOn    = "add_on"
)
View Source
const (
	HdrContentEncoding = "Content-Encoding"
	HdrContentType     = "Content-Type"
	HdrAccept          = "Accept"
	HdrAcceptEncoding  = "Accept-Encoding"
	HdrUserAgent       = "User-Agent"
	HdrAuthorization   = "Authorization"
	HdrApplicationXML  = "application/xml"
)
View Source
const (
	DevURL        = "http://localhost:3000"
	SandboxURL    = "https://api.sandbox.braintreegateway.com:443"
	ProductionURL = "https://api.braintreegateway.com:443"
)
View Source
const (
	FundingDestBank        = "bank"
	FundingDestMobilePhone = "mobile_phone"
	FundingDestEmail       = "email"
)
View Source
const (
	Day   = "day"
	Month = "month"
)
View Source
const (
	CheckWH                             = "check"
	DisbursementWH                      = "disbursement"
	DisbursementExceptionWH             = "disbursement_exception"
	SubscriptionCanceledWH              = "subscription_canceled"
	SubscriptionChargedSuccessfullyWH   = "subscription_charged_successfully"
	SubscriptionChargedUnsuccessfullyWH = "subscription_charged_unsuccessfully"
	SubscriptionExpiredWH               = "subscription_expired"
	SubscriptionTrialEndedWH            = "subscription_trial_ended"
	SubscriptionWentActiveWH            = "subscription_went_active"
	SubscriptionWentPastDueWH           = "subscription_went_past_due"
	SubMerchantAccountApprovedWH        = "sub_merchant_account_approved"
	SubMerchantAccountDeclinedWH        = "sub_merchant_account_declined"
	PartnerMerchantConnectedWH          = "partner_merchant_connected"
	PartnerMerchantDisconnectedWH       = "partner_merchant_disconnected"
	PartnerMerchantDeclinedWH           = "partner_merchant_declined"
	TransactionSettledWH                = "transaction_settled"
	TransactionSettlementDeclinedWH     = "transaction_settlement_declined"
	TransactionDisbursedWH              = "transaction_disbursed"
	DisputeOpenedWH                     = "dispute_opened"
	DisputeLostWH                       = "dispute_lost"
	DisputeWonWH                        = "dispute_won"
	AccountUpdaterDailyReportWH         = "account_updater_daily_report"
)
View Source
const (
	// Exception messages
	BankRejected         = "bank_rejected"
	InsufficientFunds    = "insuffient_funds"
	AccountNotAuthorized = "account_not_authorized"

	// Followup actions
	ContactUs                = "contact_us"
	UpdateFundingInformation = "update_funding_information"
	None                     = "none"
)
View Source
const DateFormat = "2006-01-02"

Variables

View Source
var (
	DefaultClient = &http.Client{
		Timeout:   defaultTimeout,
		Transport: defaultTransport,
	}
)

Functions

func ErrorNameKebabToCamel

func ErrorNameKebabToCamel(src string) string

func ErrorNameSnakeToCamel

func ErrorNameSnakeToCamel(src string) string

func IsTokenNil

func IsTokenNil(src xml.Token) bool

func SetURLForEnv

func SetURLForEnv(name string) (string, error)

func StripNilElements

func StripNilElements(data []byte) ([]byte, error)

StripNilElements parses the xml input, removing any elements that are decorated with the `nil="true"` attribute returning the XML without those elements.

Types

type APIClient

type APIClient struct {
	Key    *Secret
	Logger *log.Logger
	Client *http.Client
}

func New

func New(url, merchId, pubKey, privKey string) *APIClient

func NewWithAccessToken

func NewWithAccessToken(accessToken string) (*APIClient, error)

func NewWithHttpClient

func NewWithHttpClient(url string, merchantId, publicKey, privateKey string, client *http.Client) *APIClient

func (*APIClient) Accept

func (c *APIClient) Accept(ctx context.Context, disputeID string) error

func (*APIClient) AddTextEvidence

func (c *APIClient) AddTextEvidence(ctx context.Context, disputeID string, evidence *DisputeTextEvidenceRequest) (*DisputeEvidence, error)

func (*APIClient) AllDiscounts

func (c *APIClient) AllDiscounts(ctx context.Context) ([]Discount, error)

func (*APIClient) CancelRelease

func (c *APIClient) CancelRelease(ctx context.Context, id string) (*Tx, error)

func (*APIClient) CancelSubscription

func (c *APIClient) CancelSubscription(ctx context.Context, subId string) (*Subscription, error)

func (*APIClient) Clone

func (c *APIClient) Clone(ctx context.Context, id string, tx *TxCloneRequest) (*Tx, error)

func (*APIClient) CreateAddress

func (c *APIClient) CreateAddress(ctx context.Context, custID string, request *AddressRequest) (*Address, error)

func (*APIClient) CreateCard

func (c *APIClient) CreateCard(ctx context.Context, card *CreditCard) (*CreditCard, error)

func (*APIClient) CreateCustomer

func (c *APIClient) CreateCustomer(ctx context.Context, request *CustomerRequest) (*Customer, error)

func (*APIClient) CreateMerchantAccount

func (c *APIClient) CreateMerchantAccount(ctx context.Context, account *MerchantAccount) (*MerchantAccount, error)

func (*APIClient) CreatePayMethod

func (c *APIClient) CreatePayMethod(ctx context.Context, paymentMethodRequest *PaymentMethodRequest) (*PaymentMethod, error)

func (*APIClient) CreatePaymentMethodNonce

func (c *APIClient) CreatePaymentMethodNonce(ctx context.Context, token string) (*PaymentMethodNonce, error)

func (*APIClient) CreateSubscription

func (c *APIClient) CreateSubscription(ctx context.Context, sub *SubscriptionRequest) (*Subscription, error)

func (*APIClient) DeleteAddress

func (c *APIClient) DeleteAddress(ctx context.Context, custID, id string) error

func (*APIClient) DeleteCard

func (c *APIClient) DeleteCard(ctx context.Context, card *CreditCard) error

func (*APIClient) DeleteCustomer

func (c *APIClient) DeleteCustomer(ctx context.Context, id string) error

func (*APIClient) DeletePayMethod

func (c *APIClient) DeletePayMethod(ctx context.Context, token string) error

func (*APIClient) DeletePaypalAccount

func (c *APIClient) DeletePaypalAccount(ctx context.Context, paypalAccount *PayPalAccount) error

func (*APIClient) ExpiringBetween

func (c *APIClient) ExpiringBetween(ctx context.Context, fromDate, toDate time.Time) (*SearchResult, error)

func (*APIClient) ExpiringBetweenPaged

func (c *APIClient) ExpiringBetweenPaged(ctx context.Context, fromDate, toDate time.Time, result *SearchResult) (*CreditCardSearchResult, error)

func (*APIClient) FetchSubscriptions

func (c *APIClient) FetchSubscriptions(ctx context.Context, query *Search) ([]*Subscription, error)

func (*APIClient) FetchTx

func (c *APIClient) FetchTx(ctx context.Context, query *Search) ([]*Tx, error)

func (*APIClient) Finalize

func (c *APIClient) Finalize(ctx context.Context, disputeID string) error

func (*APIClient) FindCard

func (c *APIClient) FindCard(ctx context.Context, token string) (*CreditCard, error)

func (*APIClient) FindCustomer

func (c *APIClient) FindCustomer(ctx context.Context, id string) (*Customer, error)

func (*APIClient) FindDispute

func (c *APIClient) FindDispute(ctx context.Context, disputeID string) (*Dispute, error)

func (*APIClient) FindMerchantAccount

func (c *APIClient) FindMerchantAccount(ctx context.Context, id string) (*MerchantAccount, error)

func (*APIClient) FindPayMethod

func (c *APIClient) FindPayMethod(ctx context.Context, token string) (*PaymentMethod, error)

func (*APIClient) FindPaymentMethodNonce

func (c *APIClient) FindPaymentMethodNonce(ctx context.Context, nonce string) (*PaymentMethodNonce, error)

func (*APIClient) FindPlan

func (c *APIClient) FindPlan(ctx context.Context, id string) (*Plan, error)

func (*APIClient) FindSubscription

func (c *APIClient) FindSubscription(ctx context.Context, subId string) (*Subscription, error)

func (*APIClient) FindTransaction

func (c *APIClient) FindTransaction(ctx context.Context, id string) (*Tx, error)

func (*APIClient) FindTransactionLineItem

func (c *APIClient) FindTransactionLineItem(ctx context.Context, txId string) (LineItems, error)

func (*APIClient) GenerateSettlement

func (c *APIClient) GenerateSettlement(ctx context.Context, s *Settlement) (*SettlementBatchSummary, error)

func (*APIClient) GenerateToken

func (c *APIClient) GenerateToken(ctx context.Context) (string, error)

func (*APIClient) GenerateWithCustomer

func (c *APIClient) GenerateWithCustomer(ctx context.Context, custID string) (string, error)

func (*APIClient) GenerateWithRequest

func (c *APIClient) GenerateWithRequest(ctx context.Context, request *TokenRequest) (string, error)

func (*APIClient) HoldInEscrow

func (c *APIClient) HoldInEscrow(ctx context.Context, id string) (*Tx, error)

func (*APIClient) ListAddons

func (c *APIClient) ListAddons(ctx context.Context) ([]AddOn, error)

func (*APIClient) ListPlans

func (c *APIClient) ListPlans(ctx context.Context) ([]*Plan, error)

func (*APIClient) Parse

func (c *APIClient) Parse(signature, payload string) (*Notification, error)

func (*APIClient) ParseRequest

func (c *APIClient) ParseRequest(r *http.Request) (*Notification, error)

func (*APIClient) Pay

func (c *APIClient) Pay(ctx context.Context, tx *TxRequest) (*Tx, error)

func (*APIClient) Refund

func (c *APIClient) Refund(ctx context.Context, id string, amount ...*Decimal) (*Tx, error)

func (*APIClient) RefundWithRequest

func (c *APIClient) RefundWithRequest(ctx context.Context, id string, request *RefundRequest) (*Tx, error)

func (*APIClient) ReleaseFromEscrow

func (c *APIClient) ReleaseFromEscrow(ctx context.Context, id string) (*Tx, error)

func (*APIClient) RemoveEvidence

func (c *APIClient) RemoveEvidence(ctx context.Context, disputeID string, id string) error

func (*APIClient) RetryCharge

func (c *APIClient) RetryCharge(ctx context.Context, txReq *SubscriptionTransactionRequest) error

func (*APIClient) SamplePayload

func (c *APIClient) SamplePayload(kind, id string) string

func (*APIClient) SandboxRequest

func (c *APIClient) SandboxRequest(kind, id string) (*http.Request, error)

func (*APIClient) SandboxSettle

func (c *APIClient) SandboxSettle(ctx context.Context, transactionID string) (*Tx, error)

func (*APIClient) SandboxSettlementConfirm

func (c *APIClient) SandboxSettlementConfirm(ctx context.Context, transactionID string) (*Tx, error)

func (*APIClient) SandboxSettlementDecline

func (c *APIClient) SandboxSettlementDecline(ctx context.Context, transactionID string) (*Tx, error)

func (*APIClient) SandboxSettlementPending

func (c *APIClient) SandboxSettlementPending(ctx context.Context, transactionID string) (*Tx, error)

func (*APIClient) SearchCustomer

func (c *APIClient) SearchCustomer(ctx context.Context, query *Search, result *SearchResult) (*CustomerSearchResult, error)

func (*APIClient) SearchCustomersByIDs

func (c *APIClient) SearchCustomersByIDs(ctx context.Context, query *Search) (*SearchResult, error)

func (*APIClient) SearchPaypalAccount

func (c *APIClient) SearchPaypalAccount(ctx context.Context, token string) (*PayPalAccount, error)

func (*APIClient) SearchSubscription

func (c *APIClient) SearchSubscription(ctx context.Context, query *Search, searchResult *SearchResult) (*SubscriptionSearchResult, error)

func (*APIClient) SearchSubscriptions

func (c *APIClient) SearchSubscriptions(ctx context.Context, query *Search) (*SearchResult, error)

func (*APIClient) SearchTx

func (c *APIClient) SearchTx(ctx context.Context, query *Search, searchResult *SearchResult) (*TransactionSearchResult, error)

func (*APIClient) SearchTxs

func (c *APIClient) SearchTxs(ctx context.Context, query *Search) (*SearchResult, error)

func (*APIClient) SignPayload

func (c *APIClient) SignPayload(src string) (string, error)

func (*APIClient) SubmitForSettlement

func (c *APIClient) SubmitForSettlement(ctx context.Context, id string, amounts ...*Decimal) (*Tx, error)

func (*APIClient) UpdateAddress

func (c *APIClient) UpdateAddress(ctx context.Context, custID, id string, request *AddressRequest) (*Address, error)

func (*APIClient) UpdateCard

func (c *APIClient) UpdateCard(ctx context.Context, card *CreditCard) (*CreditCard, error)

func (*APIClient) UpdateCustomer

func (c *APIClient) UpdateCustomer(ctx context.Context, request *CustomerRequest) (*Customer, error)

func (*APIClient) UpdateMerchantAccount

func (c *APIClient) UpdateMerchantAccount(ctx context.Context, account *MerchantAccount) (*MerchantAccount, error)

func (*APIClient) UpdatePayMethod

func (c *APIClient) UpdatePayMethod(ctx context.Context, token string, method *PaymentMethodRequest) (*PaymentMethod, error)

func (*APIClient) UpdatePaypalAccount

func (c *APIClient) UpdatePaypalAccount(ctx context.Context, paypalAccount *PayPalAccount) (*PayPalAccount, error)

func (*APIClient) UpdateSubscription

func (c *APIClient) UpdateSubscription(ctx context.Context, subId string, sub *SubscriptionRequest) (*Subscription, error)

func (*APIClient) Verify

func (c *APIClient) Verify(challenge string) (string, error)

func (*APIClient) Void

func (c *APIClient) Void(ctx context.Context, id string) (*Tx, error)

type APIError

type APIError struct {
	ErrorMessage    string
	MerchantAccount *MerchantAccount
	Transaction     *Tx
	// contains filtered or unexported fields
}

func (*APIError) All

func (e *APIError) All() []ValidationError

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) For

func (e *APIError) For(name string) *ValidationErrors

func (*APIError) StatusCode

func (e *APIError) StatusCode() int

func (*APIError) UnmarshalXML

func (e *APIError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type AVSResponseCode

type AVSResponseCode string
const (
	AVSResponseCodeMatches       AVSResponseCode = "M" // The postal code or street address provided matches the information on file with the cardholder's bank.
	AVSResponseCodeDoesNotMatch  AVSResponseCode = "N" // The postal code or street address provided does not match the information on file with the cardholder's bank.
	AVSResponseCodeNotVerified   AVSResponseCode = "U" // The card-issuing bank received the postal code or street address but did not verify whether it was correct. This typically happens if the processor declines an authorization before the bank evaluates the postal code.
	AVSResponseCodeNotProvided   AVSResponseCode = "I" // No postal code or street address was provided.
	AVSResponseCodeNotSupported  AVSResponseCode = "S" // AVS information was provided but the card-issuing bank does not participate in address verification. This typically indicates a card-issuing bank outside of the US, Canada, and the UK.
	AVSResponseCodeSystemError   AVSResponseCode = "E" // A system error prevented any verification of street address or postal code.
	AVSResponseCodeNotApplicable AVSResponseCode = "A" // AVS information was provided but this type of transaction does not support address verification.
)

type AddModificationRequest

type AddModificationRequest struct {
	ModificationRequest
	InheritedFromID string `xml:"inherited-from-id,omitempty"`
}

type AddOn

type AddOn struct {
	XMLName string `xml:"add-on"`
	Modification
}

type AddOnList

type AddOnList struct {
	XMLName string  `xml:"add-ons"`
	AddOns  []AddOn `xml:"add-on"`
}

type Address

type Address struct {
	XMLName            xml.Name
	Id                 string     `xml:"id,omitempty"`
	CustomerId         string     `xml:"customer-id,omitempty"`
	FirstName          string     `xml:"first-name,omitempty"`
	LastName           string     `xml:"last-name,omitempty"`
	Company            string     `xml:"company,omitempty"`
	StreetAddress      string     `xml:"street-address,omitempty"`
	ExtendedAddress    string     `xml:"extended-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"`
	CountryCodeAlpha3  string     `xml:"country-code-alpha3,omitempty"`
	CountryCodeNumeric string     `xml:"country-code-numeric,omitempty"`
	CountryName        string     `xml:"country-name,omitempty"`
	CreatedAt          *time.Time `xml:"created-at,omitempty"`
	UpdatedAt          *time.Time `xml:"updated-at,omitempty"`
}

type AddressRequest

type AddressRequest struct {
	XMLName            xml.Name `xml:"address"`
	FirstName          string   `xml:"first-name,omitempty"`
	LastName           string   `xml:"last-name,omitempty"`
	Company            string   `xml:"company,omitempty"`
	StreetAddress      string   `xml:"street-address,omitempty"`
	ExtendedAddress    string   `xml:"extended-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"`
	CountryCodeAlpha3  string   `xml:"country-code-alpha3,omitempty"`
	CountryCodeNumeric string   `xml:"country-code-numeric,omitempty"`
	CountryName        string   `xml:"country-name,omitempty"`
}

type Addresses

type Addresses struct {
	XMLName string     `xml:"addresses"`
	Address []*Address `xml:"address"`
}

type AndroidPayCard

type AndroidPayCard struct {
	XMLName             xml.Name       `xml:"android-pay-card"`
	Token               string         `xml:"token"`
	CardType            string         `xml:"-"`
	Last4               string         `xml:"-"`
	SourceCardType      string         `xml:"source-card-type"`
	SourceCardLast4     string         `xml:"source-card-last-4"`
	SourceDescription   string         `xml:"source-description"`
	VirtualCardType     string         `xml:"virtual-card-type"`
	VirtualCardLast4    string         `xml:"virtual-card-last-4"`
	ExpirationMonth     string         `xml:"expiration-month"`
	ExpirationYear      string         `xml:"expiration-year"`
	BIN                 string         `xml:"bin"`
	GoogleTransactionID string         `xml:"google-transaction-id"`
	ImageURL            string         `xml:"image-url"`
	Default             bool           `xml:"default"`
	CustomerId          string         `xml:"customer-id"`
	CreatedAt           *time.Time     `xml:"created-at"`
	UpdatedAt           *time.Time     `xml:"updated-at"`
	Subscriptions       *Subscriptions `xml:"subscriptions"`
}

func (*AndroidPayCard) AllSubscriptions

func (a *AndroidPayCard) AllSubscriptions() []*Subscription

func (*AndroidPayCard) ToPaymentMethod

func (a *AndroidPayCard) ToPaymentMethod() *PaymentMethod

func (*AndroidPayCard) UnmarshalXML

func (a *AndroidPayCard) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

type AndroidPayCards

type AndroidPayCards struct {
	AndroidPayCard []*AndroidPayCard `xml:"android-pay-card"`
}

func (*AndroidPayCards) PaymentMethods

func (a *AndroidPayCards) PaymentMethods() []PaymentMethod

type AndroidPayDetail

type AndroidPayDetail struct {
	Token               string `xml:"token"`
	CardType            string `xml:"-"`
	Last4               string `xml:"-"`
	SourceCardType      string `xml:"source-card-type"`
	SourceCardLast4     string `xml:"source-card-last-4"`
	SourceDescription   string `xml:"source-description"`
	VirtualCardType     string `xml:"virtual-card-type"`
	VirtualCardLast4    string `xml:"virtual-card-last-4"`
	ExpirationMonth     string `xml:"expiration-month"`
	ExpirationYear      string `xml:"expiration-year"`
	BIN                 string `xml:"bin"`
	GoogleTransactionID string `xml:"google-transaction-id"`
	ImageURL            string `xml:"image-url"`
}

func (*AndroidPayDetail) UnmarshalXML

func (a *AndroidPayDetail) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type ApplePayCard

type ApplePayCard struct {
	XMLName               xml.Name       `xml:"apple-pay-card"`
	Token                 string         `xml:"token"`
	ImageURL              string         `xml:"image-url"`
	CardType              string         `xml:"card-type"`
	PaymentInstrumentName string         `xml:"payment-instrument-name"`
	SourceDescription     string         `xml:"source-description"`
	BIN                   string         `xml:"bin"`
	Last4                 string         `xml:"last-4"`
	ExpirationMonth       string         `xml:"expiration-month"`
	ExpirationYear        string         `xml:"expiration-year"`
	Expired               bool           `xml:"expired"`
	Default               bool           `xml:"default"`
	CustomerId            string         `xml:"customer-id"`
	CreatedAt             *time.Time     `xml:"created-at"`
	UpdatedAt             *time.Time     `xml:"updated-at"`
	Subscriptions         *Subscriptions `xml:"subscriptions"`
}

func (*ApplePayCard) AllSubscriptions

func (a *ApplePayCard) AllSubscriptions() []*Subscription

func (*ApplePayCard) ToPaymentMethod

func (a *ApplePayCard) ToPaymentMethod() *PaymentMethod

type ApplePayCards

type ApplePayCards struct {
	Cards []*ApplePayCard `xml:"apple-pay-card"`
}

func (*ApplePayCards) PaymentMethods

func (a *ApplePayCards) PaymentMethods() []PaymentMethod

type ApplePayDetail

type ApplePayDetail struct {
	Token                 string `xml:"token"`
	CardType              string `xml:"card-type"`
	PaymentInstrumentName string `xml:"payment-instrument-name"`
	SourceDescription     string `xml:"source-description"`
	CardholderName        string `xml:"cardholder-name"`
	ExpirationMonth       string `xml:"expiration-month"`
	ExpirationYear        string `xml:"expiration-year"`
	Last4                 string `xml:"last-4"`
	BIN                   string `xml:"bin"`
}

type CVVResponseCode

type CVVResponseCode string
const (
	CVVResponseCodeMatches                  CVVResponseCode = "M" // CVVResponseCodeMatches means the CVV provided matches the information on file with the cardholder's bank.
	CVVResponseCodeDoesNotMatch             CVVResponseCode = "N" // CVVResponseCodeDoesNotMatch means the The CVV provided does not match the information on file with the cardholder's bank.
	CVVResponseCodeNotVerified              CVVResponseCode = "U" // CVVResponseCodeNotVerified means the the card-issuing bank received the CVV but did not verify whether it was correct. This typically happens if the processor declines an authorization before the bank evaluates the CVV.
	CVVResponseCodeNotProvided              CVVResponseCode = "I" // CVVResponseCodeNotProvided means the no CVV was provided.
	CVVResponseCodeIssuerDoesNotParticipate CVVResponseCode = "S" // CVVResponseCodeIssuerDoesNotParticipate means the the CVV was provided but the card-issuing bank does not participate in card verification.
	CVVResponseCodeNotApplicable            CVVResponseCode = "A" // CVVResponseCodeNotApplicable means the the CVV was provided but this type of transaction does not support card verification.
)

type CreditCard

type CreditCard struct {
	XMLName                   xml.Name           `xml:"credit-card"`
	CustomerId                string             `xml:"customer-id,omitempty"`
	Token                     string             `xml:"token,omitempty"`
	PaymentMethodNonce        string             `xml:"payment-method-nonce,omitempty"`
	Number                    string             `xml:"number,omitempty"`
	ExpirationDate            string             `xml:"expiration-date,omitempty"`
	ExpirationMonth           string             `xml:"expiration-month,omitempty"`
	ExpirationYear            string             `xml:"expiration-year,omitempty"`
	CVV                       string             `xml:"cvv,omitempty"`
	VenmoSDKPaymentMethodCode string             `xml:"venmo-sdk-payment-method-code,omitempty"`
	Last4                     string             `xml:"last-4,omitempty"`
	Commercial                string             `xml:"commercial,omitempty"`
	Debit                     string             `xml:"debit,omitempty"`
	DurbinRegulated           string             `xml:"durbin-regulated,omitempty"`
	Healthcare                string             `xml:"healthcare,omitempty"`
	Payroll                   string             `xml:"payroll,omitempty"`
	Prepaid                   string             `xml:"prepaid,omitempty"`
	CountryOfIssuance         string             `xml:"country-of-issuance,omitempty"`
	IssuingBank               string             `xml:"issuing-bank,omitempty"`
	UniqueNumberIdentifier    string             `xml:"unique-number-identifier,omitempty"`
	Bin                       string             `xml:"bin,omitempty"`
	CardType                  string             `xml:"card-type,omitempty"`
	CardholderName            string             `xml:"cardholder-name,omitempty"`
	CustomerLocation          string             `xml:"customer-location,omitempty"`
	ImageURL                  string             `xml:"image-url,omitempty"`
	ProductID                 string             `xml:"product-id,omitempty"`
	VenmoSDK                  bool               `xml:"venmo-sdk,omitempty"`
	Default                   bool               `xml:"default,omitempty"`
	Expired                   bool               `xml:"expired,omitempty"`
	Options                   *CreditCardOptions `xml:"options,omitempty"`
	UpdatedAt                 *time.Time         `xml:"updated-at,omitempty"`
	CreatedAt                 *time.Time         `xml:"created-at,omitempty"`
	BillingAddress            *Address           `xml:"billing-address,omitempty"`
	Subscriptions             *Subscriptions     `xml:"subscriptions,omitempty"`
}

func (*CreditCard) AllSubscriptions

func (c *CreditCard) AllSubscriptions() []*Subscription

func (*CreditCard) ToPaymentMethod

func (cc *CreditCard) ToPaymentMethod() *PaymentMethod

type CreditCardOptions

type CreditCardOptions struct {
	VenmoSDKSession               string `xml:"venmo-sdk-session,omitempty"`
	VerificationMerchantAccountId string `xml:"verification-merchant-account-id,omitempty"`
	UpdateExistingToken           string `xml:"update-existing-token,omitempty"`
	MakeDefault                   bool   `xml:"make-default,omitempty"`
	FailOnDuplicatePaymentMethod  bool   `xml:"fail-on-duplicate-payment-method,omitempty"`
	VerifyCard                    *bool  `xml:"verify-card,omitempty"`
}

type CreditCardSearchResult

type CreditCardSearchResult struct {
	TotalItems        int
	CurrentPageNumber int
	PageSize          int
	TotalIDs          []string
	CreditCards       []*CreditCard
}

type CreditCards

type CreditCards struct {
	CreditCard []*CreditCard `xml:"credit-card"`
}

func (*CreditCards) PaymentMethods

func (c *CreditCards) PaymentMethods() []PaymentMethod

type CustomFields

type CustomFields map[string]string

func (CustomFields) MarshalXML

func (c CustomFields) MarshalXML(encoder *xml.Encoder, start xml.StartElement) error

func (*CustomFields) UnmarshalXML

func (c *CustomFields) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

type Customer

type Customer struct {
	XMLName            string           `xml:"customer"`
	Id                 string           `xml:"id"`
	FirstName          string           `xml:"first-name"`
	LastName           string           `xml:"last-name"`
	Company            string           `xml:"company"`
	Email              string           `xml:"email"`
	Phone              string           `xml:"phone"`
	Fax                string           `xml:"fax"`
	Website            string           `xml:"website"`
	PaymentMethodNonce string           `xml:"payment-method-nonce"`
	CustomFields       CustomFields     `xml:"custom-fields"`
	CreditCard         *CreditCard      `xml:"credit-card"`
	CreditCards        *CreditCards     `xml:"credit-cards"`
	PayPalAccounts     *PayPalAccounts  `xml:"paypal-accounts"`
	VenmoAccounts      *VenmoAccounts   `xml:"venmo-accounts"`
	AndroidPayCards    *AndroidPayCards `xml:"android-pay-cards"`
	ApplePayCards      *ApplePayCards   `xml:"apple-pay-cards"`
	Addresses          *Addresses       `xml:"addresses"`
	CreatedAt          *time.Time       `xml:"created-at"`
	UpdatedAt          *time.Time       `xml:"updated-at"`
}

func (*Customer) DefaultCreditCard

func (c *Customer) DefaultCreditCard() *CreditCard

func (*Customer) DefaultPaymentMethod

func (c *Customer) DefaultPaymentMethod() *PaymentMethod

func (*Customer) PaymentMethods

func (c *Customer) PaymentMethods() []PaymentMethod

type CustomerRequest

type CustomerRequest struct {
	XMLName            string       `xml:"customer"`
	ID                 string       `xml:"id,omitempty"`
	FirstName          string       `xml:"first-name,omitempty"`
	LastName           string       `xml:"last-name,omitempty"`
	Company            string       `xml:"company,omitempty"`
	Email              string       `xml:"email,omitempty"`
	Phone              string       `xml:"phone,omitempty"`
	Fax                string       `xml:"fax,omitempty"`
	Website            string       `xml:"website,omitempty"`
	PaymentMethodNonce string       `xml:"payment-method-nonce,omitempty"`
	CustomFields       CustomFields `xml:"custom-fields,omitempty"`
	CreditCard         *CreditCard  `xml:"credit-card,omitempty"`
}

type CustomerSearchResult

type CustomerSearchResult struct {
	TotalItems        int
	CurrentPageNumber int
	PageSize          int
	TotalIDs          []string
	Customers         []*Customer
}

type DailyReport

type DailyReport struct {
	XMLName    xml.Name `xml:"account-updater-daily-report"`
	ReportDate string   `xml:"report-date"`
	ReportURL  string   `xml:"report-url"`
}

type Date

type Date struct {
	time.Time
}

func (*Date) MarshalXML

func (d *Date) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Date) UnmarshalXML

func (d *Date) UnmarshalXML(decoder *xml.Decoder, start xml.StartElement) error

type Decimal

type Decimal struct {
	Unscaled int64
	Scale    int
}

func NewDecimal

func NewDecimal(unscaled int64, scale int) *Decimal

func (*Decimal) Cmp

func (d *Decimal) Cmp(y *Decimal) int

func (*Decimal) MarshalText

func (d *Decimal) MarshalText() (text []byte, err error)

func (*Decimal) String

func (d *Decimal) String() string

func (*Decimal) UnmarshalText

func (d *Decimal) UnmarshalText(text []byte) (err error)

type Descriptor

type Descriptor struct {
	Name  string `xml:"name,omitempty"`
	Phone string `xml:"phone,omitempty"`
	URL   string `xml:"url,omitempty"`
}

type Disbursement

type Disbursement struct {
	XMLName          xml.Name         `xml:"disbursement"`
	Id               string           `xml:"id"`
	ExceptionMessage string           `xml:"exception-message"`
	CurrencyIsoCode  string           `xml:"currency-iso-code"`
	Status           string           `xml:"status"`
	FollowUpAction   string           `xml:"follow-up-action"`
	Success          bool             `xml:"success"`
	Retry            bool             `xml:"retry"`
	IsSubmerchant    bool             `xml:"sub-merchant-account"`
	TransactionIds   []string         `xml:"transaction-ids>item"`
	DisbursementDate *Date            `xml:"disbursement-date"`
	Amount           *Decimal         `xml:"amount"`
	MerchantAccount  *MerchantAccount `xml:"merchant-account"`
}

func (*Disbursement) Transactions

func (d *Disbursement) Transactions(ctx context.Context, c *APIClient) (*TransactionSearchResult, error)

type DisbursementDetail

type DisbursementDetail struct {
	XMLName                        xml.Name `xml:"disbursement-details"`
	DisbursementDate               string   `xml:"disbursement-date"`
	SettlementAmount               *Decimal `xml:"settlement-amount"`
	SettlementCurrencyIsoCode      string   `xml:"settlement-currency-iso-code"`
	SettlementCurrencyExchangeRate *Decimal `xml:"settlement-currency-exchange-rate"`
	FundsHeld                      bool     `xml:"funds-held"`
	Success                        bool     `xml:"success"`
}

type Discount

type Discount struct {
	XMLName string `xml:"discount"`
	Modification
}

type DiscountList

type DiscountList struct {
	XMLName   string     `xml:"discounts"`
	Discounts []Discount `xml:"discount"`
}

type Dispute

type Dispute struct {
	XMLName           string                       `xml:"dispute"`
	CaseNumber        string                       `xml:"case-number"`
	CurrencyISOCode   string                       `xml:"currency-iso-code"`
	ID                string                       `xml:"id"`
	MerchantAccountID string                       `xml:"merchant-account-id"`
	OriginalDisputeID string                       `xml:"original-dispute-id"`
	ProcessorComments string                       `xml:"processor-comments"`
	ReturnCode        string                       `xml:"return-code"`
	ReceivedDate      string                       `xml:"received-date"`
	ReferenceNumber   string                       `xml:"reference-number"`
	ReplyByDate       string                       `xml:"reply-by-date"`
	Kind              DisputeKind                  `xml:"kind"`
	Reason            DisputeReason                `xml:"reason"`
	Status            DisputeStatus                `xml:"status"`
	AmountDisputed    *Decimal                     `xml:"amount-disputed"`
	AmountWon         *Decimal                     `xml:"amount-won"`
	UpdatedAt         *time.Time                   `xml:"updated-at"`
	CreatedAt         *time.Time                   `xml:"created-at"`
	Evidence          []*DisputeEvidence           `xml:"evidence>evidence"`
	StatusHistory     []*DisputeStatusHistoryEvent `xml:"status-history>status-history"`
	Transaction       *DisputeTransaction          `xml:"transaction"`
}

type DisputeCategory

type DisputeCategory string
const (
	DisputeDeviceId                                   DisputeCategory = "DEVICE_ID"
	DisputeDeviceName                                 DisputeCategory = "DEVICE_NAME"
	DisputePriorDigitalGoodsTransactionArn            DisputeCategory = "PRIOR_DIGITAL_GOODS_TRANSACTION_ARN"
	DisputePriorDigitalGoodsTransactionDateTime       DisputeCategory = "PRIOR_DIGITAL_GOODS_TRANSACTION_DATE_TIME"
	DisputeDownloadDateTime                           DisputeCategory = "DOWNLOAD_DATE_TIME"
	DisputeGeographicalLocation                       DisputeCategory = "GEOGRAPHICAL_LOCATION"
	DisputeLegitPaymentsForSameMerchandise            DisputeCategory = "LEGIT_PAYMENTS_FOR_SAME_MERCHANDISE"
	DisputeMerchantWebsiteOrAppAccess                 DisputeCategory = "MERCHANT_WEBSITE_OR_APP_ACCESS"
	DisputePriorNonDisputedTransactionArn             DisputeCategory = "PRIOR_NON_DISPUTED_TRANSACTION_ARN"
	DisputePriorNonDisputedTransactionDateTime        DisputeCategory = "PRIOR_NON_DISPUTED_TRANSACTION_DATE_TIME"
	DisputePriorNonDisputedTransactionEmailAddress    DisputeCategory = "PRIOR_NON_DISPUTED_TRANSACTION_EMAIL_ADDRESS"
	DisputePriorNonDisputedTransactionIpAddress       DisputeCategory = "PRIOR_NON_DISPUTED_TRANSACTION_IP_ADDRESS"
	DisputePriorNonDisputedTransactionPhoneNumber     DisputeCategory = "PRIOR_NON_DISPUTED_TRANSACTION_PHONE_NUMBER"
	DisputePriorNonDisputedTransactionPhysicalAddress DisputeCategory = "PRIOR_NON_DISPUTED_TRANSACTION_PHYSICAL_ADDRESS"
	DisputeProfileSetupOrAppAccess                    DisputeCategory = "PROFILE_SETUP_OR_APP_ACCESS"
	DisputeProofOfAuthorizedSigner                    DisputeCategory = "PROOF_OF_AUTHORIZED_SIGNER"
	DisputeProofOfDeliveryEmpAddress                  DisputeCategory = "PROOF_OF_DELIVERY_EMP_ADDRESS"
	DisputeProofOfDelivery                            DisputeCategory = "PROOF_OF_DELIVERY"
	DisputeProofOfPossessionOrUsage                   DisputeCategory = "PROOF_OF_POSSESSION_OR_USAGE"
	DisputePurchaserEmailAddress                      DisputeCategory = "PURCHASER_EMAIL_ADDRESS"
	DisputePurchaserIpAddress                         DisputeCategory = "PURCHASER_IP_ADDRESS"
	DisputePurchaserName                              DisputeCategory = "PURCHASER_NAME"
	DisputeRecurringTransactionArn                    DisputeCategory = "RECURRING_TRANSACTION_ARN"
	DisputeRecurringTransactionDateTime               DisputeCategory = "RECURRING_TRANSACTION_DATE_TIME"
	DisputeSignedDeliveryForm                         DisputeCategory = "SIGNED_DELIVERY_FORM"
	DisputeSignedOrderForm                            DisputeCategory = "SIGNED_ORDER_FORM"
	DisputeTicketProof                                DisputeCategory = "TICKET_PROOF"
)

type DisputeEvidence

type DisputeEvidence struct {
	XMLName           string          `xml:"evidence"`
	Comment           string          `xml:"comment"`
	CreatedAt         *time.Time      `xml:"created-at"`
	ID                string          `xml:"id"`
	SentToProcessorAt string          `xml:"sent-to-processor-at"`
	URL               string          `xml:"url"`
	Category          DisputeCategory `xml:"category"`
	SequenceNumber    string          `xml:"sequence-number"`
}

type DisputeKind

type DisputeKind string
const (
	DisputeChargeback     DisputeKind = "chargeback"
	DisputePreArbitration DisputeKind = "pre_arbitration"
	DisputeRetrieval      DisputeKind = "retrieval"
)

type DisputeReason

type DisputeReason string
const (
	CancelledRecurringTransactionReason DisputeReason = "cancelled_recurring_transaction"
	CreditNotProcessedReason            DisputeReason = "credit_not_processed"
	DuplicateDisputeReason              DisputeReason = "duplicate"
	FraudDisputeReason                  DisputeReason = "fraud"
	GeneralReason                       DisputeReason = "general"
	InvalidAccountReason                DisputeReason = "invalid_account"
	NotRecognizedReason                 DisputeReason = "not_recognized"
	ProductNotReceivedReason            DisputeReason = "product_not_received"
	ProductUnsatisfactoryReason         DisputeReason = "product_unsatisfactory"
	TransactionAmountDiffersReason      DisputeReason = "transaction_amount_differs"
)

type DisputeStatus

type DisputeStatus string
const (
	DisputeStatusAccepted DisputeStatus = "accepted"
	DisputeStatusDisputed DisputeStatus = "disputed"
	DisputeStatusExpired  DisputeStatus = "expired"
	DisputeStatusOpen     DisputeStatus = "open"
	DisputeStatusLost     DisputeStatus = "lost"
	DisputeStatusWon      DisputeStatus = "won"
)

type DisputeStatusHistoryEvent

type DisputeStatusHistoryEvent struct {
	XMLName          string     `xml:"status-history"`
	DisbursementDate string     `xml:"disbursement-date"`
	EffectiveDate    string     `xml:"effective-date"`
	Status           string     `xml:"status"`
	Timestamp        *time.Time `xml:"timestamp"`
}

type DisputeTextEvidenceRequest

type DisputeTextEvidenceRequest struct {
	XMLName        xml.Name        `xml:"evidence"`
	Content        string          `xml:"comments"`
	Category       DisputeCategory `xml:"category,omitempty"`
	SequenceNumber string          `xml:"sequence-number,omitempty"`
}

type DisputeTransaction

type DisputeTransaction struct {
	XMLName                  string     `xml:"transaction"`
	ID                       string     `xml:"id"`
	OrderID                  string     `xml:"order-id"`
	PaymentInstrumentSubtype string     `xml:"payment-instrument-subtype"`
	PurchaseOrderNumber      string     `xml:"purchase-order-number"`
	Amount                   *Decimal   `xml:"amount"`
	CreatedAt                *time.Time `xml:"created-at"`
}

type EscrowStatus

type EscrowStatus string
const (
	EscrowHoldPending    EscrowStatus = "hold_pending"
	EscrowHeld           EscrowStatus = "held"
	EscrowReleasePending EscrowStatus = "release_pending"
	EscrowReleased       EscrowStatus = "released"
	EscrowRefunded       EscrowStatus = "refunded"
)

type IAPIError

type IAPIError interface {
	error
	StatusCode() int
}

type InvalidResponseError

type InvalidResponseError interface {
	error
	Response() *Response
}

type Key

type Key struct {
	PublicKey  string
	PrivateKey string
}

func NewKey

func NewKey(publicKey, privateKey string) Key

func (Key) HMAC

func (k Key) HMAC(payload string) (string, error)

func (Key) ParseSignature

func (k Key) ParseSignature(signatureKeyPairs string) (string, error)

func (Key) VerifySignature

func (k Key) VerifySignature(signature, payload string) (bool, error)

type LineItem

type LineItem struct {
	Kind           LineItemKind `xml:"kind"`
	Name           string       `xml:"name"`
	Description    string       `xml:"description"`
	UnitOfMeasure  string       `xml:"unit-of-measure"`
	ProductCode    string       `xml:"product-code"`
	CommodityCode  string       `xml:"commodity-code"`
	URL            string       `xml:"url"`
	Quantity       *Decimal     `xml:"quantity"`
	UnitAmount     *Decimal     `xml:"unit-amount"`
	UnitTaxAmount  *Decimal     `xml:"unit-tax-amount"`
	TotalAmount    *Decimal     `xml:"total-amount"`
	TaxAmount      *Decimal     `xml:"tax-amount"`
	DiscountAmount *Decimal     `xml:"discount-amount"`
}

type LineItemKind

type LineItemKind string
const (
	LineItemDebitKind  LineItemKind = "debit"
	LineItemCreditKind LineItemKind = "credit"
)

type LineItemRequest

type LineItemRequest struct {
	Kind           LineItemKind `xml:"kind"`
	Name           string       `xml:"name"`
	Description    string       `xml:"description,omitempty"`
	UnitOfMeasure  string       `xml:"unit-of-measure,omitempty"`
	ProductCode    string       `xml:"product-code,omitempty"`
	CommodityCode  string       `xml:"commodity-code,omitempty"`
	URL            string       `xml:"url,omitempty"`
	Quantity       *Decimal     `xml:"quantity"`
	UnitAmount     *Decimal     `xml:"unit-amount"`
	UnitTaxAmount  *Decimal     `xml:"unit-tax-amount,omitempty"`
	TotalAmount    *Decimal     `xml:"total-amount"`
	TaxAmount      *Decimal     `xml:"tax-amount,omitempty"`
	DiscountAmount *Decimal     `xml:"discount-amount,omitempty"`
}

type LineItemRequests

type LineItemRequests []*LineItemRequest

func (LineItemRequests) MarshalXML

func (r LineItemRequests) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type LineItems

type LineItems []*LineItem

func (*LineItems) UnmarshalXML

func (l *LineItems) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type MerchantAccount

type MerchantAccount struct {
	XMLName                 string                         `xml:"merchant-account,omitempty"`
	Id                      string                         `xml:"id,omitempty"`
	MasterMerchantAccountId string                         `xml:"master-merchant-account-id,omitempty"`
	TOSAccepted             bool                           `xml:"tos_accepted,omitempty"`
	Individual              *MerchantAccountPerson         `xml:"individual,omitempty"`
	Business                *MerchantAccountBusiness       `xml:"business,omitempty"`
	FundingOptions          *MerchantAccountFundingOptions `xml:"funding,omitempty"`
	Status                  string                         `xml:"status,omitempty"`
}

type MerchantAccountBusiness

type MerchantAccountBusiness struct {
	LegalName string   `xml:"legal-name,omitempty"`
	DbaName   string   `xml:"dba-name,omitempty"`
	TaxId     string   `xml:"tax-id,omitempty"`
	Address   *Address `xml:"address,omitempty"`
}

type MerchantAccountFundingOptions

type MerchantAccountFundingOptions struct {
	Destination   string `xml:"destination,omitempty"`
	Email         string `xml:"email,omitempty"`
	MobilePhone   string `xml:"mobile-phone,omitempty"`
	AccountNumber string `xml:"account-number,omitempty"`
	RoutingNumber string `xml:"routing-number,omitempty"`
}

type MerchantAccountPerson

type MerchantAccountPerson struct {
	FirstName   string   `xml:"first-name,omitempty"`
	LastName    string   `xml:"last-name,omitempty"`
	Email       string   `xml:"email,omitempty"`
	Phone       string   `xml:"phone,omitempty"`
	DateOfBirth string   `xml:"date-of-birth,omitempty"`
	SSN         string   `xml:"ssn,omitempty"`
	Address     *Address `xml:"address,omitempty"`
}

type Modification

type Modification struct {
	Id                    string     `xml:"id"`
	Amount                *Decimal   `xml:"amount"`
	Description           string     `xml:"description"`
	Kind                  string     `xml:"kind"`
	Name                  string     `xml:"name"`
	NeverExpires          bool       `xml:"never-expires"`
	Quantity              int        `xml:"quantity"`
	NumberOfBillingCycles int        `xml:"number-of-billing-cycles"`
	CurrentBillingCycle   int        `xml:"current-billing-cycle"`
	UpdatedAt             *time.Time `xml:"updated_at"`
}

type ModificationRequest

type ModificationRequest struct {
	Amount                *Decimal `xml:"amount,omitempty"`
	NumberOfBillingCycles int      `xml:"number-of-billing-cycles,omitempty"`
	Quantity              int      `xml:"quantity,omitempty"`
	NeverExpires          bool     `xml:"never-expires,omitempty"`
}

type ModificationsRequest

type ModificationsRequest struct {
	Add               []AddModificationRequest
	Update            []UpdateModificationRequest
	RemoveExistingIDs []string
}

func (ModificationsRequest) MarshalXML

func (m ModificationsRequest) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type MultiField

type MultiField struct {
	XMLName xml.Name
	Type    string   `xml:"type,attr"`
	Items   []string `xml:"item"`
}

type Notification

type Notification struct {
	XMLName   xml.Name  `xml:"notification"`
	Kind      string    `xml:"kind"`
	Timestamp time.Time `xml:"timestamp"`
	Subject   *Subject  `xml:"subject"`
}

func (*Notification) AccountUpdaterDailyReport

func (n *Notification) AccountUpdaterDailyReport() *DailyReport

func (*Notification) Disbursement

func (n *Notification) Disbursement() *Disbursement

func (*Notification) Dispute

func (n *Notification) Dispute() *Dispute

func (*Notification) MerchantAccount

func (n *Notification) MerchantAccount() *MerchantAccount

type Options

type Options struct {
	FailOnDuplicatePaymentMethod bool  `xml:"fail-on-duplicate-payment-method,omitempty"`
	MakeDefault                  bool  `xml:"make-default,omitempty"`
	VerifyCard                   *bool `xml:"verify-card,omitempty"`
}

type PayPalAccount

type PayPalAccount struct {
	XMLName       xml.Name              `xml:"paypal-account"`
	CustomerId    string                `xml:"customer-id,omitempty"`
	Token         string                `xml:"token,omitempty"`
	Email         string                `xml:"email,omitempty"`
	ImageURL      string                `xml:"image-url,omitempty"`
	Default       bool                  `xml:"default,omitempty"`
	CreatedAt     *time.Time            `xml:"created-at,omitempty"`
	UpdatedAt     *time.Time            `xml:"updated-at,omitempty"`
	Subscriptions *Subscriptions        `xml:"subscriptions,omitempty"`
	Options       *PayPalAccountOptions `xml:"options,omitempty"`
}

func (*PayPalAccount) AllSubscriptions

func (a *PayPalAccount) AllSubscriptions() []*Subscription

func (*PayPalAccount) ToPaymentMethod

func (a *PayPalAccount) ToPaymentMethod() *PaymentMethod

type PayPalAccountOptions

type PayPalAccountOptions struct {
	MakeDefault bool `xml:"make-default,omitempty"`
}

type PayPalAccounts

type PayPalAccounts struct {
	Accounts []*PayPalAccount `xml:"paypal-account"`
}

func (*PayPalAccounts) PaymentMethods

func (a *PayPalAccounts) PaymentMethods() []PaymentMethod

type PayPalDetail

type PayPalDetail struct {
	PayerEmail                    string `xml:"payer-email,omitempty"`
	PaymentID                     string `xml:"payment-id,omitempty"`
	AuthorizationID               string `xml:"authorization-id,omitempty"`
	Token                         string `xml:"token,omitempty"`
	ImageURL                      string `xml:"image-url,omitempty"`
	DebugID                       string `xml:"debug-id,omitempty"`
	PayeeEmail                    string `xml:"payee-email,omitempty"`
	CustomField                   string `xml:"custom-field,omitempty"`
	PayerID                       string `xml:"payer-id,omitempty"`
	PayerFirstName                string `xml:"payer-first-name,omitempty"`
	PayerLastName                 string `xml:"payer-last-name,omitempty"`
	PayerStatus                   string `xml:"payer-status,omitempty"`
	SellerProtectionStatus        string `xml:"seller-protection-status,omitempty"`
	RefundID                      string `xml:"refund-id,omitempty"`
	CaptureID                     string `xml:"capture-id,omitempty"`
	TransactionFeeAmount          string `xml:"transaction-fee-amount,omitempty"`
	TransactionFeeCurrencyISOCode string `xml:"transaction-fee-currency-iso-code,omitempty"`
	Description                   string `xml:"description,omitempty"`
}

type PaymentMethod

type PaymentMethod struct {
	CustomerId string
	Token      string
	Default    bool
	ImageURL   string
}

type PaymentMethodNonce

type PaymentMethodNonce struct {
	Type             string                     `xml:"type"`
	Nonce            string                     `xml:"nonce"`
	Details          *PaymentMethodNonceDetails `xml:"details"`
	ThreeDSecureInfo *ThreeDSecureInfo          `xml:"three-d-secure-info"`
}

type PaymentMethodNonceDetails

type PaymentMethodNonceDetails struct {
	CardType string `xml:"card-type"`
	Last2    string `xml:"last-two"`
}

type PaymentMethodRequest

type PaymentMethodRequest struct {
	XMLName            xml.Name                     `xml:"payment-method"`
	CustomerId         string                       `xml:"customer-id,omitempty"`
	Token              string                       `xml:"token,omitempty"`
	PaymentMethodNonce string                       `xml:"payment-method-nonce,omitempty"`
	Options            *PaymentMethodRequestOptions `xml:"options,omitempty"`
}

type PaymentMethodRequestOptions

type PaymentMethodRequestOptions struct {
	VerificationMerchantAccountId string `xml:"verification-merchant-account-id,omitempty"`
	MakeDefault                   bool   `xml:"make-default,omitempty"`
	FailOnDuplicatePaymentMethod  bool   `xml:"fail-on-duplicate-payment-method,omitempty"`
	VerifyCard                    *bool  `xml:"verify-card,omitempty"`
}

type PaymentType

type PaymentType string
const (
	AndroidPayCardType   PaymentType = "android_pay_card"
	ApplePayCardType     PaymentType = "apple_pay_card"
	CreditCardType       PaymentType = "credit_card"
	MasterpassCardType   PaymentType = "masterpass_card"
	PaypalAccountType    PaymentType = "paypal_account"
	VenmoAccountType     PaymentType = "venmo_account"
	VisaCheckoutCardType PaymentType = "visa_checkout_card"
)

type Plan

type Plan struct {
	XMLName               string       `xml:"plan"`
	Id                    string       `xml:"id"`
	MerchantId            string       `xml:"merchant-id"`
	BillingDayOfMonth     *int         `xml:"billing-day-of-month"`
	BillingFrequency      *int         `xml:"billing-frequency"`
	CurrencyISOCode       string       `xml:"currency-iso-code"`
	Description           string       `xml:"description"`
	Name                  string       `xml:"name"`
	NumberOfBillingCycles *int         `xml:"number-of-billing-cycles"`
	Price                 *Decimal     `xml:"price"`
	TrialDuration         *int         `xml:"trial-duration"`
	TrialDurationUnit     string       `xml:"trial-duration-unit"`
	TrialPeriod           bool         `xml:"trial-period"`
	CreatedAt             *time.Time   `xml:"created-at"`
	UpdatedAt             *time.Time   `xml:"updated-at"`
	AddOns                AddOnList    `xml:"add-ons"`
	Discounts             DiscountList `xml:"discounts"`
}

type Plans

type Plans struct {
	XMLName string  `xml:"plans"`
	Plan    []*Plan `xml:"plan"`
}

type RangeField

type RangeField struct {
	XMLName xml.Name
	Is      float64 `xml:"is,omitempty"`
	Min     float64 `xml:"min,omitempty"`
	Max     float64 `xml:"max,omitempty"`
}

type Record

type Record struct {
	Count             int      `xml:"count"`
	XMLName           string   `xml:"record"`
	CardType          string   `xml:"card-type"`
	MerchantAccountId string   `xml:"merchant-account-id"`
	Kind              string   `xml:"kind"`
	AmountSettled     *Decimal `xml:"amount-settled"`
}

type RefundRequest

type RefundRequest struct {
	XMLName string   `xml:"transaction"`
	Amount  *Decimal `xml:"amount"`
	OrderID string   `xml:"order-id,omitempty"`
}

type RejectionReason

type RejectionReason string
const (
	ApplicationIncompleteReason RejectionReason = "application_incomplete"
	AVSReason                   RejectionReason = "avs"
	AVSAndCVVReason             RejectionReason = "avs_and_cvv"
	CVVReason                   RejectionReason = "cvv"
	DuplicateReason             RejectionReason = "duplicate"
	FraudReason                 RejectionReason = "fraud"
	ThreeDSecureReason          RejectionReason = "three_d_secure"
	UnknownReason               RejectionReason = "unrecognized"
)

type Response

type Response struct {
	*http.Response
	Body []byte
}

type ResponseCode

type ResponseCode int

func (ResponseCode) Int

func (rc ResponseCode) Int() int

func (ResponseCode) MarshalText

func (rc ResponseCode) MarshalText() ([]byte, error)

func (*ResponseCode) UnmarshalText

func (rc *ResponseCode) UnmarshalText(text []byte) error

type ResponseType

type ResponseType string
const (
	ResponseTypeApproved     ResponseType = "approved"
	ResponseTypeSoftDeclined ResponseType = "soft_declined"
	ResponseTypeHardDeclined ResponseType = "hard_declined"
)

type RiskData

type RiskData struct {
	ID       string `xml:"id"`
	Decision string `xml:"decision"`
}

type RiskDataRequest

type RiskDataRequest struct {
	CustomerBrowser string `xml:"customer-browser"`
	CustomerIP      string `xml:"customer-ip"`
}
type Search struct {
	// contains filtered or unexported fields
}

func (*Search) AddMultiField

func (s *Search) AddMultiField(field string) *MultiField

func (*Search) AddRangeField

func (s *Search) AddRangeField(field string) *RangeField

func (*Search) AddTextField

func (s *Search) AddTextField(field string) *TextField

func (*Search) AddTimeField

func (s *Search) AddTimeField(field string) *TimeField

func (*Search) MarshalXML

func (s *Search) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Search) ShallowCopy

func (s *Search) ShallowCopy() *Search

type SearchResult

type SearchResult struct {
	Page      int
	PageSize  int
	PageCount int
	IDs       []string
}

type Secret

type Secret struct {
	Key
	Raw     string
	URL     string
	MerchId string
}

func NewAPIKey

func NewAPIKey(url string, merchId, publicKey, privateKey string) *Secret

func NewAccessToken

func NewAccessToken(accessTokenStr string) (*Secret, error)

func (Secret) AuthorizationHeader

func (t Secret) AuthorizationHeader() string

type Settlement

type Settlement struct {
	XMLName string `xml:"settlement_batch_summary"`
	Date    string `xml:"settlement_date"`
}

type SettlementBatchSummary

type SettlementBatchSummary struct {
	XMLName string     `xml:"settlement-batch-summary"`
	Records XMLRecords `xml:"records"`
}

type SignatureError

type SignatureError struct {
	Message string
}

func (SignatureError) Error

func (i SignatureError) Error() string

type Status

type Status string
const (
	StatusAuthorizationExpired   Status = "authorization_expired"
	StatusAuthorizing            Status = "authorizing"
	StatusAuthorized             Status = "authorized"
	StatusGatewayRejected        Status = "gateway_rejected"
	StatusFailed                 Status = "failed"
	StatusProcessorDeclined      Status = "processor_declined"
	StatusSettled                Status = "settled"
	StatusSettlementConfirmed    Status = "settlement_confirmed"
	StatusSettlementDeclined     Status = "settlement_declined"
	StatusSettlementPending      Status = "settlement_pending"
	StatusSettling               Status = "settling"
	StatusSubmittedForSettlement Status = "submitted_for_settlement"
	StatusVoided                 Status = "voided"
	StatusUnknown                Status = "unrecognized"
)

type Subject

type Subject struct {
	XMLName                   xml.Name         `xml:"subject"`
	APIErrorResponse          *APIError        `xml:"api-error-response,omitempty"`
	Disbursement              *Disbursement    `xml:"disbursement,omitempty"`
	Subscription              *Subscription    `xml:",omitempty"`
	MerchantAccount           *MerchantAccount `xml:"merchant-account,omitempty"`
	Transaction               *Tx              `xml:",omitempty"`
	Dispute                   *Dispute         `xml:"dispute,omitempty"`
	AccountUpdaterDailyReport *DailyReport     `xml:"account-updater-daily-report,omitempty"`
}

type Subscription

type Subscription struct {
	XMLName                 string                     `xml:"subscription"`
	Id                      string                     `xml:"id"`
	BillingDayOfMonth       string                     `xml:"billing-day-of-month"`
	BillingPeriodEndDate    string                     `xml:"billing-period-end-date"`
	BillingPeriodStartDate  string                     `xml:"billing-period-start-date"`
	CurrentBillingCycle     string                     `xml:"current-billing-cycle"`
	DaysPastDue             string                     `xml:"days-past-due"`
	FailureCount            string                     `xml:"failure-count"`
	FirstBillingDate        string                     `xml:"first-billing-date"`
	MerchantAccountId       string                     `xml:"merchant-account-id"`
	NextBillingDate         string                     `xml:"next-billing-date"`
	PaidThroughDate         string                     `xml:"paid-through-date"`
	PaymentMethodToken      string                     `xml:"payment-method-token"`
	PlanId                  string                     `xml:"plan-id"`
	TrialDurationUnit       string                     `xml:"trial-duration-unit"`
	TrialDuration           string                     `xml:"trial-duration"`
	Status                  SubscriptionStatus         `xml:"status"`
	NeverExpires            bool                       `xml:"never-expires"`
	TrialPeriod             bool                       `xml:"trial-period"`
	Balance                 *Decimal                   `xml:"balance"`
	NextBillAmount          *Decimal                   `xml:"next-bill-amount"`
	NextBillingPeriodAmount *Decimal                   `xml:"next-billing-period-amount"`
	Price                   *Decimal                   `xml:"price"`
	Transactions            *Transactions              `xml:"transactions"`
	Options                 *SubscriptionOpts          `xml:"options"`
	Descriptor              *Descriptor                `xml:"descriptor"`
	AddOns                  *AddOnList                 `xml:"add-ons"`
	Discounts               *DiscountList              `xml:"discounts"`
	NumberOfBillingCycles   *int                       `xml:"number-of-billing-cycles"`
	CreatedAt               *time.Time                 `xml:"created-at,omitempty"`
	UpdatedAt               *time.Time                 `xml:"updated-at,omitempty"`
	StatusEvents            []*SubscriptionStatusEvent `xml:"status-history>status-event"`
}

type SubscriptionDetail

type SubscriptionDetail struct {
	BillingPeriodStartDate string `xml:"billing-period-start-date"`
	BillingPeriodEndDate   string `xml:"billing-period-end-date"`
}

type SubscriptionOpts

type SubscriptionOpts struct {
	DoNotInheritAddOnsOrDiscounts        bool `xml:"do-not-inherit-add-ons-or-discounts,omitempty"`
	ProrateCharges                       bool `xml:"prorate-charges,omitempty"`
	ReplaceAllAddOnsAndDiscounts         bool `xml:"replace-all-add-ons-and-discounts,omitempty"`
	RevertSubscriptionOnProrationFailure bool `xml:"revert-subscription-on-proration-failure,omitempty"`
	StartImmediately                     bool `xml:"start-immediately,omitempty"`
}

type SubscriptionRequest

type SubscriptionRequest struct {
	XMLName               string                `xml:"subscription"`
	Id                    string                `xml:"id,omitempty"`
	FailureCount          string                `xml:"failure-count,omitempty"`
	FirstBillingDate      string                `xml:"first-billing-date,omitempty"`
	MerchantAccountId     string                `xml:"merchant-account-id,omitempty"`
	PaymentMethodNonce    string                `xml:"paymentMethodNonce,omitempty"`
	PaymentMethodToken    string                `xml:"paymentMethodToken,omitempty"`
	PlanId                string                `xml:"planId,omitempty"`
	TrialDuration         string                `xml:"trial-duration,omitempty"`
	TrialDurationUnit     string                `xml:"trial-duration-unit,omitempty"`
	NeverExpires          *bool                 `xml:"never-expires,omitempty"`
	BillingDayOfMonth     *int                  `xml:"billing-day-of-month,omitempty"`
	NumberOfBillingCycles *int                  `xml:"number-of-billing-cycles,omitempty"`
	Options               *SubscriptionOpts     `xml:"options,omitempty"`
	Price                 *Decimal              `xml:"price,omitempty"`
	TrialPeriod           *bool                 `xml:"trial-period,omitempty"`
	Descriptor            *Descriptor           `xml:"descriptor,omitempty"`
	AddOns                *ModificationsRequest `xml:"add-ons,omitempty"`
	Discounts             *ModificationsRequest `xml:"discounts,omitempty"`
}

type SubscriptionSearchResult

type SubscriptionSearchResult struct {
	TotalItems        int
	CurrentPageNumber int
	PageSize          int
	TotalIDs          []string
	Subscriptions     []*Subscription
}

type SubscriptionStatus

type SubscriptionStatus string
const (
	SubscriptionStatusActive       SubscriptionStatus = "Active"
	SubscriptionStatusCanceled     SubscriptionStatus = "Canceled"
	SubscriptionStatusExpired      SubscriptionStatus = "Expired"
	SubscriptionStatusPastDue      SubscriptionStatus = "Past Due"
	SubscriptionStatusPending      SubscriptionStatus = "Pending"
	SubscriptionStatusUnrecognized SubscriptionStatus = "Unrecognized"
)

type SubscriptionStatusEvent

type SubscriptionStatusEvent struct {
	Timestamp          time.Time          `xml:"timestamp"`
	Status             SubscriptionStatus `xml:"status"`
	CurrencyISOCode    string             `xml:"currency-iso-code"`
	User               string             `xml:"user"`
	PlanID             string             `xml:"plan-id"`
	SubscriptionSource string             `xml:"subscription-source"`
	Balance            *Decimal           `xml:"balance"`
	Price              *Decimal           `xml:"price"`
}

type SubscriptionTransactionOptionsRequest

type SubscriptionTransactionOptionsRequest struct {
	SubmitForSettlement bool `xml:"submit-for-settlement"`
}

type SubscriptionTransactionRequest

type SubscriptionTransactionRequest struct {
	SubscriptionID string
	Amount         *Decimal
	Options        *SubscriptionTransactionOptionsRequest
}

func (*SubscriptionTransactionRequest) MarshalXML

type Subscriptions

type Subscriptions struct {
	Subscription []*Subscription `xml:"subscription"`
}

type TextField

type TextField struct {
	XMLName    xml.Name
	Is         string `xml:"is,omitempty"`
	IsNot      string `xml:"is-not,omitempty"`
	StartsWith string `xml:"starts-with,omitempty"`
	EndsWith   string `xml:"ends-with,omitempty"`
	Contains   string `xml:"contains,omitempty"`
}

type ThreeDSecureEnrolled

type ThreeDSecureEnrolled string
const (
	EnrolledYes            ThreeDSecureEnrolled = "Y"
	EnrolledNo             ThreeDSecureEnrolled = "N"
	EnrolledUnavailable    ThreeDSecureEnrolled = "U"
	EnrolledBypass         ThreeDSecureEnrolled = "B"
	EnrolledRequestFailure ThreeDSecureEnrolled = "E"
)

type ThreeDSecureInfo

type ThreeDSecureInfo struct {
	Status                 ThreeDSecureStatus   `xml:"status"`
	Enrolled               ThreeDSecureEnrolled `xml:"enrolled"`
	LiabilityShiftPossible bool                 `xml:"liability-shift-possible"`
	LiabilityShifted       bool                 `xml:"liability-shifted"`
}

type ThreeDSecureStatus

type ThreeDSecureStatus string
const (
	ThreeDSecureUnsupportedCard                              ThreeDSecureStatus = "unsupported_card"
	ThreeDSecureLookupError                                  ThreeDSecureStatus = "lookup_error"
	ThreeDSecureLookupEnrolled                               ThreeDSecureStatus = "lookup_enrolled"
	ThreeDSecureLookupNotEnrolled                            ThreeDSecureStatus = "lookup_not_enrolled"
	ThreeDSecureAuthenticateSuccessfulIssuerNotParticipating ThreeDSecureStatus = "authenticate_successful_issuer_not_participating"
	ThreeDSecureAuthenticationUnavailable                    ThreeDSecureStatus = "authentication_unavailable"
	ThreeDSecureAuthenticateSignatureVerificationFailed      ThreeDSecureStatus = "authenticate_signature_verification_failed"
	ThreeDSecureAuthenticateSuccessful                       ThreeDSecureStatus = "authenticate_successful"
	ThreeDSecureAuthenticateAttemptSuccessful                ThreeDSecureStatus = "authenticate_attempt_successful"
	ThreeDSecureAuthenticateFailed                           ThreeDSecureStatus = "authenticate_failed"
	ThreeDSecureAuthenticateUnableToAuthenticate             ThreeDSecureStatus = "authenticate_unable_to_authenticate"
	ThreeDSecureAuthenticateError                            ThreeDSecureStatus = "authenticate_error"
)

type TimeField

type TimeField struct {
	XMLName xml.Name
	Is      time.Time
	Min     time.Time
	Max     time.Time
}

func (TimeField) MarshalXML

func (d TimeField) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TokenRequest

type TokenRequest struct {
	XMLName           string   `xml:"client-token"`
	CustomerID        string   `xml:"customer-id,omitempty"`
	MerchantAccountID string   `xml:"merchant-account-id,omitempty"`
	Options           *Options `xml:"options,omitempty"`
	Version           int      `xml:"version"`
}

type TransactionSearchResult

type TransactionSearchResult struct {
	TotalItems        int
	CurrentPageNumber int
	PageSize          int
	TotalIDs          []string
	Transactions      []*Tx
}

type Transactions

type Transactions struct {
	Transaction []*Tx `xml:"transaction"`
}

type Tx

type Tx struct {
	ProcessorResponseCode        ResponseCode        `xml:"processor-response-code"`
	ProcessorResponseType        ResponseType        `xml:"processor-response-type"`
	EscrowStatus                 EscrowStatus        `xml:"escrow-status"`
	PaymentInstrumentType        PaymentType         `xml:"payment-instrument-type"`
	AVSErrorResponseCode         AVSResponseCode     `xml:"avs-error-response-code"`
	AVSPostalCodeResponseCode    AVSResponseCode     `xml:"avs-postal-code-response-code"`
	AVSStreetAddressResponseCode AVSResponseCode     `xml:"avs-street-address-response-code"`
	CVVResponseCode              CVVResponseCode     `xml:"cvv-response-code"`
	GatewayRejectionReason       RejectionReason     `xml:"gateway-rejection-reason"`
	CustomFields                 CustomFields        `xml:"custom-fields"`
	ProcessorAuthorizationCode   string              `xml:"processor-authorization-code"`
	SettlementBatchId            string              `xml:"settlement-batch-id"`
	XMLName                      string              `xml:"transaction"`
	Id                           string              `xml:"id"`
	Status                       Status              `xml:"status"`
	Type                         string              `xml:"type"`
	CurrencyISOCode              string              `xml:"currency-iso-code"`
	OrderId                      string              `xml:"order-id"`
	PaymentMethodToken           string              `xml:"payment-method-token"`
	PaymentMethodNonce           string              `xml:"payment-method-nonce"`
	MerchantAccountId            string              `xml:"merchant-account-id"`
	PlanId                       string              `xml:"plan-id"`
	SubscriptionId               string              `xml:"subscription-id"`
	DeviceData                   string              `xml:"device-data"`
	RefundId                     string              `xml:"refund-id"`
	ProcessorResponseText        string              `xml:"processor-response-text"`
	AdditionalProcessorResponse  string              `xml:"additional-processor-response"`
	Channel                      string              `xml:"channel"`
	PurchaseOrderNumber          string              `xml:"purchase-order-number"`
	TaxExempt                    bool                `xml:"tax-exempt"`
	CreatedAt                    *time.Time          `xml:"created-at"`
	UpdatedAt                    *time.Time          `xml:"updated-at"`
	AuthorizationExpiresAt       *time.Time          `xml:"authorization-expires-at"`
	ThreeDSecureInfo             *ThreeDSecureInfo   `xml:"three-d-secure-info,omitempty"`
	Amount                       *Decimal            `xml:"amount"`
	SubscriptionDetails          *SubscriptionDetail `xml:"subscription"`
	CreditCard                   *CreditCard         `xml:"credit-card"`
	Customer                     *Customer           `xml:"customer"`
	BillingAddress               *Address            `xml:"billing"`
	ShippingAddress              *Address            `xml:"shipping"`
	TaxAmount                    *Decimal            `xml:"tax-amount"`
	ServiceFeeAmount             *Decimal            `xml:"service-fee-amount,attr"`
	DisbursementDetails          *DisbursementDetail `xml:"disbursement-details"`
	PayPalDetails                *PayPalDetail       `xml:"paypal"`
	VenmoAccountDetails          *VenmoAccountDetail `xml:"venmo-account"`
	AndroidPayDetails            *AndroidPayDetail   `xml:"android-pay-card"`
	ApplePayDetails              *ApplePayDetail     `xml:"apple-pay"`
	RiskData                     *RiskData           `xml:"risk-data"`
	Descriptor                   *Descriptor         `xml:"descriptor"`
	RefundedTransactionId        *string             `xml:"refunded-transaction-id"`
	RefundIds                    *[]string           `xml:"refund-ids>item"`
	Disputes                     []*Dispute          `xml:"disputes>dispute"`
}

func (*Tx) UnmarshalXML

func (t *Tx) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type TxCloneOpts

type TxCloneOpts struct {
	SubmitForSettlement bool `xml:"submit-for-settlement"`
}

type TxCloneRequest

type TxCloneRequest struct {
	XMLName string       `xml:"transaction-clone"`
	Amount  *Decimal     `xml:"amount"`
	Channel string       `xml:"channel"`
	Options *TxCloneOpts `xml:"options"`
}

type TxOpts

type TxOpts struct {
	SubmitForSettlement              bool                       `xml:"submit-for-settlement,omitempty"`
	StoreInVault                     bool                       `xml:"store-in-vault,omitempty"`
	StoreInVaultOnSuccess            bool                       `xml:"store-in-vault-on-success,omitempty"`
	AddBillingAddressToPaymentMethod bool                       `xml:"add-billing-address-to-payment-method,omitempty"`
	StoreShippingAddressInVault      bool                       `xml:"store-shipping-address-in-vault,omitempty"`
	HoldInEscrow                     bool                       `xml:"hold-in-escrow,omitempty"`
	SkipAdvancedFraudChecking        bool                       `xml:"skip_advanced_fraud_checking,omitempty"`
	TransactionOptionsPaypalRequest  *TxPaypalOptsRequest       `xml:"paypal,omitempty"`
	ThreeDSecure                     *TxThreeDSecureOptsRequest `xml:"three-d-secure,omitempty"`
}

type TxPaypalOptsRequest

type TxPaypalOptsRequest struct {
	CustomField       string
	PayeeEmail        string
	Description       string
	SupplementaryData map[string]string
}

func (TxPaypalOptsRequest) MarshalXML

func (r TxPaypalOptsRequest) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type TxRequest

type TxRequest struct {
	XMLName             string           `xml:"transaction"`
	CustomerID          string           `xml:"customer-id,omitempty"`
	Type                string           `xml:"type,omitempty"`
	OrderId             string           `xml:"order-id,omitempty"`
	PaymentMethodToken  string           `xml:"payment-method-token,omitempty"`
	PaymentMethodNonce  string           `xml:"payment-method-nonce,omitempty"`
	MerchantAccountId   string           `xml:"merchant-account-id,omitempty"`
	PlanId              string           `xml:"plan-id,omitempty"`
	DeviceData          string           `xml:"device-data,omitempty"`
	Channel             string           `xml:"channel,omitempty"`
	PurchaseOrderNumber string           `xml:"purchase-order-number,omitempty"`
	TaxExempt           bool             `xml:"tax-exempt,omitempty"`
	CustomFields        CustomFields     `xml:"custom-fields,omitempty"`
	TransactionSource   TxSource         `xml:"transaction-source,omitempty"`
	LineItems           LineItemRequests `xml:"line-items,omitempty"`
	Amount              *Decimal         `xml:"amount"`
	CreditCard          *CreditCard      `xml:"credit-card,omitempty"`
	Customer            *CustomerRequest `xml:"customer,omitempty"`
	BillingAddress      *Address         `xml:"billing,omitempty"`
	ShippingAddress     *Address         `xml:"shipping,omitempty"`
	TaxAmount           *Decimal         `xml:"tax-amount,omitempty"`
	Options             *TxOpts          `xml:"options,omitempty"`
	ServiceFeeAmount    *Decimal         `xml:"service-fee-amount,attr,omitempty"`
	RiskData            *RiskDataRequest `xml:"risk-data,omitempty"`
	Descriptor          *Descriptor      `xml:"descriptor,omitempty"`
}

type TxSource

type TxSource string
const (
	RecurringFirst TxSource = "recurring_first"
	Recurring      TxSource = "recurring"
	MOTO           TxSource = "moto"
	Merchant       TxSource = "merchant"
)

type TxThreeDSecureOptsRequest

type TxThreeDSecureOptsRequest struct {
	Required bool `xml:"required"`
}

type UpdateModificationRequest

type UpdateModificationRequest struct {
	ModificationRequest
	ExistingID string `xml:"existing-id,omitempty"`
}

type ValidationError

type ValidationError struct {
	Code      string
	Attribute string
	Message   string
}

func (*ValidationError) UnmarshalXML

func (e *ValidationError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type ValidationErrors

type ValidationErrors struct {
	Object           string
	ValidationErrors []ValidationError
	Children         map[string]*ValidationErrors
}

func (*ValidationErrors) All

func (r *ValidationErrors) All() []ValidationError

func (*ValidationErrors) AllDeep

func (r *ValidationErrors) AllDeep() []ValidationError

func (*ValidationErrors) For

func (*ValidationErrors) ForIndex

func (r *ValidationErrors) ForIndex(i int) *ValidationErrors

func (*ValidationErrors) On

func (r *ValidationErrors) On(name string) []ValidationError

func (*ValidationErrors) UnmarshalXML

func (r *ValidationErrors) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

type VenmoAccount

type VenmoAccount struct {
	XMLName           xml.Name       `xml:"venmo-account"`
	CustomerId        string         `xml:"customer-id"`
	Token             string         `xml:"token"`
	Username          string         `xml:"username"`
	VenmoUserID       string         `xml:"venmo-user-id"`
	SourceDescription string         `xml:"source-description"`
	ImageURL          string         `xml:"image-url"`
	CreatedAt         *time.Time     `xml:"created-at"`
	UpdatedAt         *time.Time     `xml:"updated-at"`
	Subscriptions     *Subscriptions `xml:"subscriptions"`
	Default           bool           `xml:"default"`
}

func (*VenmoAccount) AllSubscriptions

func (v *VenmoAccount) AllSubscriptions() []*Subscription

func (*VenmoAccount) ToPaymentMethod

func (v *VenmoAccount) ToPaymentMethod() *PaymentMethod

type VenmoAccountDetail

type VenmoAccountDetail struct {
	Token             string `xml:"token,omitempty"`
	Username          string `xml:"username,omitempty"`
	VenmoUserID       string `xml:"venmo-user-id,omitempty"`
	SourceDescription string `xml:"source-description,omitempty"`
	ImageURL          string `xml:"image-url,omitempty"`
}

type VenmoAccounts

type VenmoAccounts struct {
	Accounts []*VenmoAccount `xml:"venmo-account"`
}

func (*VenmoAccounts) PaymentMethods

func (v *VenmoAccounts) PaymentMethods() []PaymentMethod

type XMLRecords

type XMLRecords struct {
	XMLName string   `xml:"records"`
	Type    []Record `xml:"record"`
}

Jump to

Keyboard shortcuts

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