Documentation
¶
Index ¶
- Constants
- type AccessToken
- type Address
- type BillingAddress
- type Brand
- type Card
- type ClientCredentials
- type Credit
- type CreditResponse
- type Currency
- type Customer
- type Debit
- type Detail
- type Device
- type ErrorResponseSchemaV1
- type ErrorResponseSchemaV2
- type Order
- type Payment
- type PaymentResponse
- type ProductType
- type Response
- type RestClient
- type Shipping
- type Token
- type TransactionType
- type Verification
Constants ¶
View Source
const ( Mastercard Brand = "Mastercard" Visa Brand = "Visa" Amex Brand = "Amex" Elo Brand = "Elo" Hipercard Brand = "Hipercard" Verified = "VERIFIED" NotVerified = "NOT VERIFIED" Denied = "DENIED" Error = "ERROR" )
View Source
const ( // Identificador do tipo de produto vendido dentre as opções (product_type) CashCarry ProductType = "cash_carry" DigitalContent ProductType = "digital_content" DigitalGoods ProductType = "digital_goods" DigitalPhysical ProductType = "digital_physical" GiftCard ProductType = "gift_card" PhysicalGoods ProductType = "physical_goods" RenewSubs ProductType = "renew_subs" Service ProductType = "service" // Tipo de transação (transaction_type) // Pagamento completo à vista, parcelado sem juros, parcelado com juros. Full TransactionType = "FULL" InstallNoInterest TransactionType = "INSTALL_NO_INTEREST" InstallWithInterest TransactionType = "INSTALL_WITH_INTEREST" // Status da transação (status) PaymentCanceled = "CANCELED" PaymentApproved = "APPROVED" PaymentDenied = "DENIED" PaymentAuthorized = "AUTHORIZED" PaymentConfirmed = "CONFIRMED" RealBrazilian Currency = "BRL" DollarUS Currency = "USD" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessToken ¶
type AccessToken struct { Token string `json:"access_token"` TokenType string `json:"token_type"` ExpiresIn int `json:"expires_in"` Scope string `json:"scope"` // contains filtered or unexported fields }
func (AccessToken) Expired ¶
func (at AccessToken) Expired() bool
type Address ¶
type Address struct { Street string `json:"street,omitempty"` Number string `json:"number,omitempty"` Complement string `json:"complement,omitempty"` District string `json:"district,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` Country string `json:"country,omitempty"` PostalCode string `json:"postal_code,omitempty"` }
type BillingAddress ¶
type BillingAddress struct { Street string `json:"street,omitempty"` Number string `json:"number,omitempty"` Complement string `json:"complement,omitempty"` District string `json:"district,omitempty"` City string `json:"city,omitempty"` State string `json:"state,omitempty"` Country string `json:"country,omitempty"` PostalCode string `json:"postal_code,omitempty"` }
type Card ¶
type Card struct { CardNumber string `json:"-"` NumberToken string `json:"number_token"` Brand Brand `json:"brand"` CardHolderName string `json:"cardholder_name"` ExpirationMonth string `json:"expiration_month"` ExpirationYear string `json:"expiration_year"` SecurityCode string `json:"security_code"` CustomerID string `json:"-"` }
func (Card) Verify ¶
func (c Card) Verify(cc ClientCredentials) (Verification, error)
type ClientCredentials ¶
type ClientCredentials struct { ClientID string ClientSecret string SellerID string Sandbox bool AccessToken AccessToken }
func (ClientCredentials) Basic ¶
func (cc ClientCredentials) Basic() string
func (ClientCredentials) Bearer ¶
func (cc ClientCredentials) Bearer() string
func (ClientCredentials) HasSeller ¶
func (cc ClientCredentials) HasSeller() bool
func (ClientCredentials) NewAccessToken ¶
func (cc ClientCredentials) NewAccessToken() (AccessToken, error)
func (ClientCredentials) URL ¶
func (cc ClientCredentials) URL() string
type Credit ¶
type Credit struct { Delayed bool `json:"delayed"` Authenticated bool `json:"authenticated"` PreAuthorization bool `json:"pre_authorization"` SaveCardData bool `json:"save_card_data"` TransactionType TransactionType `json:"transaction_type"` NumberInstallments int `json:"number_installments"` SoftDescriptor string `json:"soft_descriptor"` DynamicMCC int `json:"dynamic_mcc"` Card Card `json:"card"` }
func (Credit) MarshalJSON ¶
type CreditResponse ¶
type CreditResponse struct { Delayed bool `json:"delayed"` AuthorizationCode string `json:"authorization_code"` AuthorizedAt time.Time `json:"authorized_at"` ReasonCode string `json:"reason_code"` ReasonMessage string `json:"reason_message"` Acquirer string `json:"acquirer"` SoftDescriptor string `json:"soft_descriptor"` Brand Brand `json:"brand"` TerminalNSU string `json:"terminal_nsu"` AcquirerTransactionID string `json:"acquirer_transaction_id"` TransactionID string `json:"transaction_id"` }
func (*CreditResponse) UnmarshalJSON ¶
func (cr *CreditResponse) UnmarshalJSON(data []byte) error
type Customer ¶
type Customer struct { CustomerID string `json:"customer_id"` FirstName string `json:"first_name,omitempty"` LastName string `json:"last_name,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` DocumentType string `json:"document_type,omitempty"` DocumentNumber string `json:"document_number,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` BillingAddress BillingAddress `json:"billing_address,omitempty"` }
type Debit ¶
type Debit struct { CardHolderMobile string `json:"cardholder_mobile"` SoftDescriptor string `json:"soft_descriptor"` DynamicMCC int `json:"dynamic_mcc"` Authenticated bool `json:"authenticated"` Card Card `json:"card"` }
func (Debit) MarshalJSON ¶
type ErrorResponseSchemaV1 ¶
type ErrorResponseSchemaV1 struct { Message string `json:"message"` Name string `json:"name"` Details []Detail `json:"details"` }
func (ErrorResponseSchemaV1) String ¶
func (e ErrorResponseSchemaV1) String() string
type ErrorResponseSchemaV2 ¶
type Order ¶
type Order struct { OrderID string `json:"order_id"` SalesTax int `json:"sales_tax"` ProductType ProductType `json:"product_type"` }
type Payment ¶
type Payment struct { SellerID string `json:"seller_id,omitempty"` Amount float64 `json:"amount"` Currency Currency `json:"currency"` Order Order `json:"order"` Customer Customer `json:"customer"` Device Device `json:"device,omitempty"` Shippings []Shipping `json:"shippings,omitempty"` Credit Credit `json:"credit,omitempty"` Debit Debit `json:"debit,omitempty"` }
func (Payment) MarshalJSON ¶
func (Payment) Pay ¶
func (p Payment) Pay(c ClientCredentials) (PaymentResponse, error)
type PaymentResponse ¶
type PaymentResponse struct { PaymentID string `json:"payment_id"` SellerID string `json:"seller_id"` Amount float64 `json:"amount"` Currency Currency `json:"currency"` OrderID string `json:"order_id"` Status string `json:"status"` ReceivedAt time.Time `json:"received_at"` Credit CreditResponse `json:"credit"` }
func (PaymentResponse) Approved ¶
func (p PaymentResponse) Approved() bool
func (PaymentResponse) Authorized ¶
func (p PaymentResponse) Authorized() bool
func (PaymentResponse) Canceled ¶
func (p PaymentResponse) Canceled() bool
func (PaymentResponse) Confirmed ¶
func (p PaymentResponse) Confirmed() bool
func (PaymentResponse) Denied ¶
func (p PaymentResponse) Denied() bool
func (*PaymentResponse) UnmarshalJSON ¶
func (p *PaymentResponse) UnmarshalJSON(data []byte) error
type ProductType ¶
type ProductType string
type RestClient ¶
type RestClient struct {
// contains filtered or unexported fields
}
func NewRestClient ¶
func NewRestClient(c ClientCredentials) RestClient
func (RestClient) AuthBasic ¶
func (r RestClient) AuthBasic() RestClient
type Shipping ¶
type Shipping struct { FirstName string `json:"first_name,omitempty"` Name string `json:"name,omitempty"` Email string `json:"email,omitempty"` PhoneNumber string `json:"phone_number,omitempty"` ShippingAmount float64 `json:"shipping_amount,omitempty"` Address Address `json:"address,omitempty"` }
func (Shipping) MarshalJSON ¶
type TransactionType ¶
type TransactionType string
type Verification ¶
type Verification struct { Status string `json:"status"` VerificationID string `json:"verification_id"` AuthorizationCode string `json:"authorization_code"` }
func (Verification) Denied ¶
func (v Verification) Denied() bool
func (Verification) NotVerified ¶
func (v Verification) NotVerified() bool
func (Verification) Verified ¶
func (v Verification) Verified() bool
Click to show internal directories.
Click to hide internal directories.