Documentation
¶
Index ¶
- Constants
- func DateFormat(date time.Time) string
- type Account
- type AccountResults
- type AccountStatus
- type AccountStatusEvent
- type Asaas
- func (this *Asaas) AccountCreate(account *Account) (*Response, error)
- func (this *Asaas) AccountDocumentSend(doc *Document) (*Response, error)
- func (this *Asaas) AccountDocuments() (*Response, error)
- func (this *Asaas) AccountGet() (*Response, error)
- func (this *Asaas) AccountList() (*Response, error)
- func (this *Asaas) AccountStatus() (*Response, error)
- func (this *Asaas) AccountUpdate(account *Account) (*Response, error)
- func (this *Asaas) BankAccountMainCreateOrUpdate(bankAccount *BankAccountSimple) (*Response, error)
- func (this *Asaas) CurrentBalance() (*Response, error)
- func (this *Asaas) CustomerCreate(customer *Customer) (*Response, error)
- func (this *Asaas) CustomerFind(filter map[string]string) (*Response, error)
- func (this *Asaas) CustomerFindByKey(key string, value string) (*Response, error)
- func (this *Asaas) CustomerGet(id string) (*Response, error)
- func (this *Asaas) CustomerUpdate(customer *Customer) (*Response, error)
- func (this *Asaas) FinancialTransactionsList(filter *DefaultFilter) (*Response, error)
- func (this *Asaas) InstallmentCancel(installmentId string) (*Response, error)
- func (this *Asaas) InstallmentGet(installmentId string) (*Response, error)
- func (this *Asaas) InstallmentRefund(installmentId string) (*Response, error)
- func (this *Asaas) InstallmentsGet(installmentId string) (*Response, error)
- func (this *Asaas) Log(message string, args ...interface{})
- func (this *Asaas) PaymentCancel(id string) (*Response, error)
- func (this *Asaas) PaymentCreate(payment *Payment) (*Response, error)
- func (this *Asaas) PaymentFind(filter map[string]string) (*Response, error)
- func (this *Asaas) PaymentFindByKey(key string, value string) (*Response, error)
- func (this *Asaas) PaymentGet(id string) (*Response, error)
- func (this *Asaas) PaymentGetPixQrCode(id string) (*Response, error)
- func (this *Asaas) PaymentLinkCancel(peymentLinkId string) (*Response, error)
- func (this *Asaas) PaymentLinkCreate(payment *Payment) (*Response, error)
- func (this *Asaas) PaymentLinkFind(filter map[string]string) (*Response, error)
- func (this *Asaas) PaymentLinkFindByKey(key string, value string) (*Response, error)
- func (this *Asaas) PaymentLinkGet(peymentLinkId string) (*Response, error)
- func (this *Asaas) PaymentReceiveInCash(payment *PaymentInCash) (*Response, error)
- func (this *Asaas) PaymentRefund(id string) (*Response, error)
- func (this *Asaas) Payments(filter *DefaultFilter) (*Response, error)
- func (this *Asaas) SetValidationError(key string, value string)
- func (this *Asaas) SubscriptionCancel(subscriptionId string) (*Response, error)
- func (this *Asaas) SubscriptionCreate(payment *Payment) (*Response, error)
- func (this *Asaas) SubscriptionFind(filter map[string]string) (*Response, error)
- func (this *Asaas) SubscriptionFindByKey(key string, value string) (*Response, error)
- func (this *Asaas) SubscriptionGet(subscriptionId string) (*Response, error)
- func (this *Asaas) SubscriptionPaymentsGet(subscriptionId string) (*Response, error)
- func (this *Asaas) SubscriptionUpdate(payment *Payment) (*Response, error)
- func (this *Asaas) SubscriptionUpdateCardToken(payment *Payment) (*Response, error)
- func (this *Asaas) TokenCreate(tokenRequest *TokenRequest) (*Response, error)
- func (this *Asaas) TransferCreate(transfer *Transfer) (*Response, error)
- func (this *Asaas) TransferGet(id string) (*Response, error)
- func (this *Asaas) TransferList(filter *DefaultFilter) (*Response, error)
- func (this *Asaas) Wallets() (*Response, error)
- func (this *Asaas) WebhookCreateOrChange(webhook *WebhookObject) (*Response, error)
- func (this *Asaas) WebhookStatus(webhookType WebhookType) (*Response, error)
- type Bank
- type BankAccount
- type BankAccountSimple
- type BillingType
- type Card
- type CardHolderInfo
- type CardResponse
- type ChargeType
- type CompanyType
- type Customer
- type CustomerResults
- type Customers
- type DefaultFilter
- type Discount
- type DiscountType
- type Document
- type DocumentDescription
- type DocumentEntry
- type DocumentResponse
- type DocumentResponsible
- type DocumentStatus
- type DocumentType
- type Documents
- type EventType
- type FinancialTransaction
- type FinancialTransactionResults
- type Fine
- type Interest
- type Payment
- func NewPaymenInstallmenttWithBoleto(customerId string, orderId string, value float64, installmentCount int64) *Payment
- func NewPaymenInstallmenttWithCard(customerId string, orderId string, value float64, installmentCount int64) *Payment
- func NewPayment() *Payment
- func NewPaymentLink(value float64, chargeType ChargeType, dueDateLimitDays int64) *Payment
- func NewPaymentLinkWithBoleto(value float64, chargeType ChargeType, dueDateLimitDays int64) *Payment
- func NewPaymentLinkWithCard(value float64, chargeType ChargeType) *Payment
- func NewPaymentWithBoleto(customerId string, orderId string, dueDate time.Time, value float64) *Payment
- func NewPaymentWithCard(customerId string, orderId string, value float64) *Payment
- func NewPaymentWithPix(customerId string, orderId string, dueDate time.Time, value float64) *Payment
- func NewSubscription() *Payment
- func NewSubscriptionWithBoleto(customerId string, orderId string, cycle api.SubscriptionCycle, ...) *Payment
- func NewSubscriptionWithCard(customerId string, orderId string, cycle api.SubscriptionCycle, ...) *Payment
- func NewSubscriptionWithCardToken(paymentId string) *Payment
- type PaymentInCash
- type PaymentResults
- type PaymentType
- type PersonType
- type Response
- func (this *Response) BuildStatus()
- func (this *Response) ErrorsCount() int
- func (this *Response) ErrorsToMap() map[string]string
- func (this *Response) FirstError() string
- func (this *Response) GetPayZenSOAPStatus() api.TransactionStatus
- func (this *Response) GetPaymentType() api.PaymentType
- func (this *Response) HasError() bool
- type ResponseError
- type ResultProcessor
- type Split
- type TokenRequest
- type Transfer
- type TransferEvent
- type TransferEventData
- type TransferResult
- type TransferResults
- type Wallet
- type WalletResults
- type Webhook
- type WebhookData
- type WebhookObject
- type WebhookType
Constants ¶
const ( AsaasProdApiUrl = "https://api.asaas.com/v3" AsaasTestApiUrl = "https://sandbox.asaas.com/api/v3" AccesTokenHeader = "access_token" )
Variables ¶
This section is empty.
Functions ¶
func DateFormat ¶
Types ¶
type Account ¶
type Account struct { Name string `json:"name" valid:"Required"` Email string `json:"email" valid:"Required"` LoginEmail string `json:"loginEmail,omitempty" valid:""` CpfCnpj string `json:"cpfCnpj" valid:"Required"` CompanyType CompanyType `json:"companyType"` Phone string `json:"phone" valid:"Required"` MobilePhone string `json:"mobilePhone" valid:"Required"` Address string `json:"address" valid:"Required"` AddressNumber string `json:"addressNumber" valid:"Required"` Complement string `json:"complement"` Province string `json:"province" valid:"Required"` // bairro PostalCode string `json:"postalCode" valid:"Required"` // bairro BankAccount *BankAccountSimple `json:"bankAccount,omitempty" valid:""` // result WalletId string `json:"walletId,omitempty"` ApiKey string `json:"apiKey,omitempty"` //City string `json:"city,omitempty"` State string `json:"state,omitempty"` Country string `json:"country,omitempty"` CompanyName string `json:"companyName,omitempty"` PersonType PersonType `json:"personType,omitempty"` Webhooks []*WebhookObject `json:"webhooks"` }
func NewAccount ¶
func NewAccount(bankAccount *BankAccountSimple) *Account
func (*Account) AddWebhook ¶
func (this *Account) AddWebhook(objects ...*WebhookObject) *Account
type AccountResults ¶
type AccountResults struct { Object string `json:"object"` HasMore bool `json:"hasMore"` TotalCount int64 `json:"totalCount"` Limit int64 `json:"limit"` Offset int64 `json:"offset"` Data []*Account `json:"data"` }
func (*AccountResults) Count ¶
func (this *AccountResults) Count() int
func (*AccountResults) First ¶
func (this *AccountResults) First() *Account
func (*AccountResults) HasData ¶
func (this *AccountResults) HasData() bool
func (*AccountResults) Last ¶
func (this *AccountResults) Last() *Account
type AccountStatus ¶
type AccountStatusEvent ¶
type AccountStatusEvent struct { Event string `json:"event"` Status *AccountStatus `json:"accountStatus"` }
type Asaas ¶
type Asaas struct { Debug bool EntityValidator *validator.EntityValidator EntityValidatorResult *validator.EntityValidatorResult Lang string ValidationErrors map[string]string HasValidationError bool Mode api.AsaasMode AccessToken string }
func (*Asaas) AccountDocumentSend ¶
func (*Asaas) AccountDocuments ¶
func (*Asaas) AccountGet ¶
func (*Asaas) AccountList ¶
func (*Asaas) AccountStatus ¶
func (*Asaas) BankAccountMainCreateOrUpdate ¶
func (this *Asaas) BankAccountMainCreateOrUpdate(bankAccount *BankAccountSimple) (*Response, error)
func (*Asaas) CurrentBalance ¶
func (*Asaas) CustomerCreate ¶
func (*Asaas) CustomerFind ¶
func (*Asaas) CustomerFindByKey ¶
func (*Asaas) CustomerUpdate ¶
func (*Asaas) FinancialTransactionsList ¶
func (this *Asaas) FinancialTransactionsList(filter *DefaultFilter) (*Response, error)
func (*Asaas) InstallmentCancel ¶
/ / Somente cobranças aguardando pagamento ou vencidas podem ser removidas. /
func (*Asaas) InstallmentGet ¶
func (*Asaas) InstallmentRefund ¶
/ / É possível estornar cobranças via cartão de crédito recebidas ou confirmadas. / Ao fazer isto o saldo correspondente é debitado de sua conta no Asaas e a cobrança / cancelada no cartão do seu cliente. / O cancelamento pode levar até 10 dias úteis para aparecer na fatura de seu cliente. /
func (*Asaas) InstallmentsGet ¶
/ / busca todas as parcelas de uma parcelamento /
func (*Asaas) PaymentCancel ¶
/ / Somente cobranças aguardando pagamento ou vencidas podem ser removidas. /
func (*Asaas) PaymentFind ¶
func (*Asaas) PaymentFindByKey ¶
func (*Asaas) PaymentGetPixQrCode ¶
func (*Asaas) PaymentLinkCancel ¶
func (*Asaas) PaymentLinkCreate ¶
func (*Asaas) PaymentLinkFind ¶
func (*Asaas) PaymentLinkFindByKey ¶
func (*Asaas) PaymentLinkGet ¶
func (*Asaas) PaymentReceiveInCash ¶
func (this *Asaas) PaymentReceiveInCash(payment *PaymentInCash) (*Response, error)
func (*Asaas) PaymentRefund ¶
/ / É possível estornar cobranças via cartão de crédito recebidas ou confirmadas. / Ao fazer isto o saldo correspondente é debitado de sua conta no Asaas e a cobrança / cancelada no cartão do seu cliente. / O cancelamento pode levar até 10 dias úteis para aparecer na fatura de seu cliente. /
func (*Asaas) SetValidationError ¶
func (*Asaas) SubscriptionCancel ¶
func (*Asaas) SubscriptionCreate ¶
func (*Asaas) SubscriptionFind ¶
func (*Asaas) SubscriptionFindByKey ¶
func (*Asaas) SubscriptionGet ¶
func (*Asaas) SubscriptionPaymentsGet ¶
func (*Asaas) SubscriptionUpdate ¶
func (*Asaas) SubscriptionUpdateCardToken ¶
Sobre a atualização, você consegue atualizar o cartão de uma assinatura por exemplo: Na assinatura, quando o cliente paga com cartão de crédito, o cartão dele é automaticamente cadastrado para ser usado na recorrência. Caso o cliente queira informar outro cartão, você precisará recuperar uma cobrança dessa assinatura que ainda não tenha sido paga (confirmada). Para listar as cobranças de uma assinatura e os status, use as instruções desse trecho de nosso manual -> https://asaasv3.docs.apiary.io/#reference/0/assinaturas/listar-cobrancas-de-uma-assinatura Após recuperar o ID da cobrança, você precisará fazer uma chamada adicional no seguinte endpoint, passando o ID da cobrança no lugar do {id_cobranca}: /api/v3/payments/{id_cobrança}/payWithCreditCard" ["POST"]
{ "creditCard":{ "holderName":"marcelo h almeida", "number":"5162306219378829", "expiryMonth":"05", "expiryYear":"2021", "ccv":"318" }, "creditCardHolderInfo":{ "name":"Marcelo Henrique Almeida", "email":"marcelo.almeida@gmail.com", "cpfCnpj":"24971563792", "postalCode":"89223-005", "addressNumber":"277", "addressComplement":null, "phone":"4738010919", "mobilePhone":"47998781877" } }
Ou, pode ser enviado apenas o Token caso você tenha tokenização habilitada e possua o token do cartão a ser utilizado, dessa forma:
{ "creditCardToken": "461f086a-e2ff-426e-b1ab-22f9118a07e8" }
func (*Asaas) TokenCreate ¶
func (this *Asaas) TokenCreate(tokenRequest *TokenRequest) (*Response, error)
func (*Asaas) TransferCreate ¶
func (*Asaas) TransferList ¶
func (this *Asaas) TransferList(filter *DefaultFilter) (*Response, error)
func (*Asaas) WebhookCreateOrChange ¶
func (this *Asaas) WebhookCreateOrChange(webhook *WebhookObject) (*Response, error)
func (*Asaas) WebhookStatus ¶
func (this *Asaas) WebhookStatus(webhookType WebhookType) (*Response, error)
type BankAccount ¶
type BankAccount struct { Bank *Bank `json:"bank" valid:"Required"` AccountName string `json:"accountName"` // Nome da conta bancária OwnerName string `json:"ownerName" valid:"Required"` //Data de nascimento do proprietário da conta. //Somente quando a conta bancária não pertencer ao mesmo CPF ou CNPJ da conta Asaas. OwnerBirthDate string `json:"ownerBirthDate"` CpfCnpj string `json:"cpfCnpj" valid:"Required"` Agency string `json:"agency" valid:"Required"` Account string `json:"account" valid:"Required"` AccountDigit string `json:"accountDigit" valid:"Required"` BankAccountType api.BankAccountType `json:"bankAccountType" valid:"Required"` }
func NewBankAccount ¶
func NewBankAccount(bank *Bank, bankAccountType api.BankAccountType) *BankAccount
type BankAccountSimple ¶
type BankAccountSimple struct { Bank string `json:"bank" valid:"Required"` AccountName string `json:"accountName"` // Nome da conta bancária Name string `json:"name" valid:"Required"` //Data de nascimento do proprietário da conta. //Somente quando a conta bancária não pertencer ao mesmo CPF ou CNPJ da conta Asaas. OwnerBirthDate string `json:"ownerBirthDate"` CpfCnpj string `json:"cpfCnpj" valid:"Required"` Agency string `json:"agency" valid:"Required"` Account string `json:"account" valid:"Required"` AccountDigit string `json:"accountDigit" valid:"Required"` BankAccountType api.BankAccountType `json:"bankAccountType" valid:"Required"` }
func NewBankAccountSimple ¶
func NewBankAccountSimple(bank string, bankAccountType api.BankAccountType) *BankAccountSimple
type BillingType ¶
type BillingType string
const ( BillingBoleto BillingType = "BOLETO" // ao gerar um pagamento CREDIT_CARD sem informar os dados do carão, // será retornado um link de pagamento onde será possível pagar // com catão de crédito ou débito BillingCreditCard BillingType = "CREDIT_CARD" BillingUndefined BillingType = "UNDEFINED" // Perguntar ao Cliente BillingDebitCard BillingType = "DEBIT_CARD" // webhook BillingPix BillingType = "PIX" // webhook BillingTransfer BillingType = "TRANSFER" // webhook BillingDeposit BillingType = "DEPOSIT" // webhook )
type CardHolderInfo ¶
type CardHolderInfo struct { Name string `json:"name" valid:"Required"` Email string `json:"email" valid:"Required"` CpfCnpj string `json:"cpfCnpj" valid:"Required"` PostalCode string `json:"postalCode" valid:"Required"` AddressNumber string `json:"addressNumber" valid:"Required"` AddressComplement string `json:"addressComplement"` Phone string `json:"phone" valid:"Required"` MobilePhone string `json:"mobilePhone"` }
type CardResponse ¶
type CardResponse struct { Number string `json:"creditCardNumber"` // Últimos 4 dígitos do cartão utilizado Brand string `json:"creditCardBrand"` // Bandeira do cartão utilizado Token string `json:"creditCardToken"` // Token do cartão de crédito que poderá ser enviado nas próximas transações sem a necessidade de informar novamente os dados de cartão e do titular. }
type ChargeType ¶
type ChargeType string
const ( ChargeTypeNone ChargeType = "" Detached ChargeType = "DETACHED" // avulsa Recurrent ChargeType = "RECURRENT" // assinatura Installment ChargeType = "INSTALLMENT" // parcelado )
type CompanyType ¶
type CompanyType string
const ( MEI CompanyType = "MEI" LIMITED CompanyType = "LIMITED" INDIVIDUAL CompanyType = "INDIVIDUAL" ASSOCIATION CompanyType = "ASSOCIATION" )
type Customer ¶
type Customer struct { Id string `json:"id,omitempty"` Name string `json:"name", valid:"Required"` CpfCnpj string `json:"cpfCnpj" valid:"Required"` Email string `json:"email"` MobilePhone string `json:"mobilePhone"` Phone string `json:"phone"` NotificationDisabled bool `json:"notificationDisabled"` // true para desabilitar o envio de notificações de cobrança ExternalReference string `json:"externalReference" valid:"Required"` AdditionalEmails string `json:"additionalEmails"` // Emails adicionais para envio de notificações de cobrança separados por "," Address string `json:"address"` AddressNumber string `json:"addressNumber"` Province string `json:"province"` PostalCode string `json:"postalCode"` City string `json:"city"` State string `json:"state"` }
func NewCustomer ¶
type CustomerResults ¶
type CustomerResults struct { Object string `json:"object"` HasMore bool `json:"hasMore"` TotalCount int64 `json:"totalCount"` Limit int64 `json:"limit"` Offset int64 `json:"offset"` Data []*Customer `json:"data"` }
func (*CustomerResults) Count ¶
func (this *CustomerResults) Count() int
func (*CustomerResults) First ¶
func (this *CustomerResults) First() *Customer
func (*CustomerResults) HasData ¶
func (this *CustomerResults) HasData() bool
func (*CustomerResults) Last ¶
func (this *CustomerResults) Last() *Customer
type DefaultFilter ¶
type DefaultFilter struct { Limit int64 Offset int64 StartDate string FinishDate string DateCreated string // transfer filter BankAccountType api.BankAccountType // transfer filter }
func NewDefaultFilter ¶
func NewDefaultFilter() *DefaultFilter
func (*DefaultFilter) SetDateCreated ¶
func (this *DefaultFilter) SetDateCreated(date time.Time)
func (*DefaultFilter) SetFinishDate ¶
func (this *DefaultFilter) SetFinishDate(date time.Time)
func (*DefaultFilter) SetStartDate ¶
func (this *DefaultFilter) SetStartDate(date time.Time)
func (*DefaultFilter) ToMap ¶
func (this *DefaultFilter) ToMap() map[string]string
type Discount ¶
type Discount struct { Value float64 `json:"value"` // Valor percentual ou fixo de desconto a ser aplicado sobre o valor da cobrança DueDateLimitDays int64 `json:"dueDateLimitDays"` // Dias antes do vencimento para aplicar desconto. Ex: 0 = até o vencimento, 1 = até um dia antes, 2 = até dois dias antes, e assim por diante Type DiscountType `json:"type"` }
/ / Informações de desconto /
func NewDiscount ¶
func NewDiscount(value float64, dueDateLimitDays int64, discountType DiscountType) *Discount
type DiscountType ¶
type DiscountType string
const ( DiscountFixed DiscountType = "FIXED" DiscountPercentage DiscountType = "PERCENTAGE" )
type Document ¶
type Document struct { Id string `json:"-"` DocumentFile io.Reader `json:"documentFile"` Type DocumentType `json:"type"` }
type DocumentDescription ¶
type DocumentDescription struct { Id string `json:"id"` Status string `json:"status"` Type string `json:"type"` Title string `json:"title"` Description string `json:"description"` Responsible *DocumentResponsible `json:"responsible"` OnboardingUrl string `json:"onboardingUrl"` Documents []*DocumentEntry `json:"documents"` }
type DocumentEntry ¶
type DocumentResponse ¶
type DocumentResponse struct { Id string `json:"id"` Status DocumentStatus `json:"status"` }
type DocumentResponsible ¶
type DocumentStatus ¶
type DocumentStatus string
const ( NOT_SENT DocumentStatus = "NOT_SENT" PENDING DocumentStatus = "PENDING" APPROVED DocumentStatus = "APPROVED" REJECTED DocumentStatus = "REJECTED" )
type DocumentType ¶
type DocumentType string
const ( IDENTIFICATION DocumentType = "IDENTIFICATION" SOCIAL_CONTRACT DocumentType = "SOCIAL_CONTRACT" ENTREPRENEUR_REQUIREMENT DocumentType = "ENTREPRENEUR_REQUIREMENT" MINUTES_OF_ELECTION DocumentType = "MINUTES_OF_ELECTION" CUSTOM DocumentType = "CUSTOM" )
type Documents ¶
type Documents struct { RejectReasons string `json:"rejectReasons"` Data []*DocumentDescription `json:"data"` }
type EventType ¶
type EventType string
const ( // Transference //Geração de nova transferência. TransferCreated EventType = "TRANSFER_CREATED" //Transferência pendente de execução. TransferPending EventType = "TRANSFER_PENDING" //Transferência em processamento bancário. TransferInBankProcessing EventType = "TRANSFER_IN_BANK_PROCESSING" //Transferência bloqueada. TransferBlocked EventType = "TRANSFER_BLOCKED" //Transferência realizada. TransferDone EventType = "TRANSFER_DONE" //Transferência falhou. TransferFailed EventType = "TRANSFER_FAILED" //Transferência cancelada. TransferCancelled EventType = "TRANSFER_CANCELLED" // Payment //Geração de nova cobrança. PaymentCreated EventType = "PAYMENT_CREATED" //Pagamento em cartão aguardando aprovação pela análise manual de risco. PaymentAwaitingRiskAnalysis EventType = "PAYMENT_AWAITING_RISK_ANALYSIS" //Pagamento em cartão aprovado pela análise manual de risco. PaymentApprovedByRiskAnalysis EventType = "PAYMENT_APPROVED_BY_RISK_ANALYSIS" //Pagamento em cartão reprovado pela análise manual de risco. PaymentReprovedByRiskAnalysis EventType = "PAYMENT_REPROVED_BY_RISK_ANALYSIS" //Pagamento em cartão que foi autorizado e precisa ser capturado. PaymentAuthorized EventType = "PAYMENT_AUTHORIZED" //Alteração no vencimento ou valor de cobrança existente. PaymentUpdated EventType = "PAYMENT_UPDATED" //Cobrança confirmada (pagamento efetuado, porém o saldo ainda não foi disponibilizado). PaymentConfirmed EventType = "PAYMENT_CONFIRMED" //Cobrança recebida. PaymentReceived EventType = "PAYMENT_RECEIVED" //Falha no pagamento de cartão de crédito PaymentCreditCardCaptureRefused EventType = "PAYMENT_CREDIT_CARD_CAPTURE_REFUSED" //Cobrança antecipada. PaymentAnticipated EventType = "PAYMENT_ANTICIPATED" //Cobrança vencida. PaymentOverdue EventType = "PAYMENT_OVERDUE" //Cobrança removida. PaymentDeleted EventType = "PAYMENT_DELETED" //Cobrança restaurada. PaymentRestored EventType = "PAYMENT_RESTORED" //Cobrança estornada. PaymentRefunded EventType = "PAYMENT_REFUNDED" //Estorno em processamento (liquidação já está agendada, cobrança será estornada após executar a liquidação). PaymentRefundInProgress EventType = "PAYMENT_REFUND_IN_PROGRESS" //Recebimento em dinheiro desfeito. PaymentReceivedInCashUndone EventType = "PAYMENT_RECEIVED_IN_CASH_UNDONE" //Recebido chargeback. PaymentChargebackRequested EventType = "PAYMENT_CHARGEBACK_REQUESTED" //Em disputa de chargeback (caso sejam apresentados documentos para contestação). PaymentChargebackDispute EventType = "PAYMENT_CHARGEBACK_DISPUTE" //Disputa vencida, aguardando repasse da adquirente. PaymentAwaitingChargebackReversal EventType = "PAYMENT_AWAITING_CHARGEBACK_REVERSAL" //Recebimento de negativação. PaymentDunningReceived EventType = "PAYMENT_DUNNING_RECEIVED" //Requisição de negativação. PaymentDunningRequested EventType = "PAYMENT_DUNNING_REQUESTED" //Boleto da cobrança visualizado pelo cliente. PaymentBankSlipViewed EventType = "PAYMENT_BANK_SLIP_VIEWED" //Fatura da cobrança visualizada pelo cliente. PaymentCheckoutViewed EventType = "PAYMENT_CHECKOUT_VIEWED" //Account Status //Conta bancária aprovada AccountStatusBankAccountInfoApproved EventType = "ACCOUNT_STATUS_BANK_ACCOUNT_INFO_APPROVED" //Conta bancária está em análise AccountStatusBankAccountInfoAwaitingApproval EventType = "ACCOUNT_STATUS_BANK_ACCOUNT_INFO_AWAITING_APPROVAL" //Conta bancária voltou para pendente AccountStatusBankAccountInfoPending EventType = "ACCOUNT_STATUS_BANK_ACCOUNT_INFO_PENDING" //Conta bancária reprovada AccountStatusBankAccountInfoRejected EventType = "ACCOUNT_STATUS_BANK_ACCOUNT_INFO_REJECTED" //Informações comerciais aprovada AccountStatusCommercialInfoApproved EventType = "ACCOUNT_STATUS_COMMERCIAL_INFO_APPROVED" //Informações comerciais em análise AccountStatusCommercialInfoAwaitingApproval EventType = "ACCOUNT_STATUS_COMMERCIAL_INFO_AWAITING_APPROVAL" //Informações comerciais voltou para pendente AccountStatusCommercialInfoPending EventType = "ACCOUNT_STATUS_COMMERCIAL_INFO_PENDING" //Informações comerciais reprovada AccountStatusCommercialInfoRejected EventType = "ACCOUNT_STATUS_COMMERCIAL_INFO_REJECTED" //Documentos aprovados AccountStatusDocumentApprovedEventType = "ACCOUNT_STATUS_DOCUMENT_APPROVED" //Documentos em análise AccountStatusDocumentAwaitingApproval EventType = "ACCOUNT_STATUS_DOCUMENT_AWAITING_APPROVAL" //Documentos voltaram para pendente AccountStatusDocumentPendingEventType = "ACCOUNT_STATUS_DOCUMENT_PENDING" //Documentos reprovados AccountStatusDocumentRejectedEventType = "ACCOUNT_STATUS_DOCUMENT_REJECTED" //Conta aprovada AccountStatusGeneralApprovalApproved EventType = "ACCOUNT_STATUS_GENERAL_APPROVAL_APPROVED" //Conta em análise AccountStatusGeneralApprovalAwaitingApproval EventType = "ACCOUNT_STATUS_GENERAL_APPROVAL_AWAITING_APPROVAL" //Conta voltou para pendente AccountStatusGeneralApprovalPending EventType = "ACCOUNT_STATUS_GENERAL_APPROVAL_PENDING" //Conta reprovada AccountStatusGeneralApprovalRejected EventType = "ACCOUNT_STATUS_GENERAL_APPROVAL_REJECTED" )
type FinancialTransaction ¶
type FinancialTransactionResults ¶
type FinancialTransactionResults struct { Object string `json:"object"` HasMore bool `json:"hasMore"` TotalCount int64 `json:"totalCount"` Limit int64 `json:"limit"` Offset int64 `json:"offset"` Data []*FinancialTransaction `json:"data"` }
func (*FinancialTransactionResults) Count ¶
func (this *FinancialTransactionResults) Count() int
func (*FinancialTransactionResults) First ¶
func (this *FinancialTransactionResults) First() *FinancialTransaction
func (*FinancialTransactionResults) HasData ¶
func (this *FinancialTransactionResults) HasData() bool
func (*FinancialTransactionResults) Last ¶
func (this *FinancialTransactionResults) Last() *FinancialTransaction
type Fine ¶
type Fine struct { Value float64 `json:"value"` // Percentual de multa sobre o valor da cobrança para pagamento após o vencimento PostalService bool `json:"postalService"` // Define se a cobrança será enviada via Correios }
/ / Informações de multa para pagamento após o vencimento /
type Interest ¶
type Interest struct {
Value float64 `json:"value"` // Percentual de juros ao mês sobre o valor da cobrança para pagamento após o vencimento
}
/ / Informações de juros para pagamento após o vencimento /
func NewInterest ¶
type Payment ¶
type Payment struct { BillingType BillingType `json:"billingType" valid:"Required"` Value float64 `json:"value" valid:"Required"` // Valor da cobrança DueDate string `json:"dueDate,omitempty" valid:""` // date do vencimento da cobrança Description string `json:"description,omitempty"` ExternalReference string `json:"externalReference,omitempty"` // Campo livre para busca InstallmentCount int64 `json:"installmentCount,omitempty"` // Número de parcelas (somente no caso de cobrança parcelada) InstallmentValue int64 `json:"installmentValue,omitempty"` // Valor de cada parcela (somente no caso de cobrança parcelada) TotalValue float64 `json:"totalValue,omitempty"` // valor total para parcelamento Discount *Discount `json:"discount,omitempty"` Interest *Interest `json:"interest,omitempty"` Fine *Fine `json:"file,omitempty"` PostalService bool `json:"postalService,omitempty"` Customer string `json:"customer"` Card *Card `json:"creditCard,omitempty"` // obrigatório compra cartão CardHolderInfo *CardHolderInfo `json:"creditCardHolderInfo,omitempty"` // obrigatório compra cartão CardToken string `json:"creditCardToken,omitempty"` // obrigatório compra cartão RemoteIp string `json:"remoteIp,omitempty"` // obrigatório compra cartão Splits []*Split `json:"split,omitempty"` PaymentType PaymentType `json:"-"` // subscription SubscriptionCycle api.SubscriptionCycle `json:"cycle,omitempty"` NextDueDate string `json:"nextDueDate,omitempty"` // Vencimento da primeira mensalidade EndDate string `json:"endDate,omitempty"` // Data limite para vencimento das mensalidades - assuntura e link de pagamento MaxPayments int64 `json:"maxPayments,omitempty"` //Número máximo de mensalidades a serem geradas para esta assinatura UpdatePendingPayments bool `json:"updatePendingPayments"` // true para atualizar mensalidades já existentes com o novo valor ou forma de pagamento Name string `json:"name,omitempty"` // Caso seja possível o pagamento via boleto bancário, define a quantidade de dias úteis que // o seu cliente poderá pagar o boleto após gerado DueDateLimitDays int64 `json:"dueDateLimitDays,omitempty"` ChargeType ChargeType `json:"chargeType,omitempty"` //Quantidade máxima de parcelas que seu cliente poderá parcelar o valor do link de pagamentos caso a //forma de cobrança selecionado seja Parcelamento. Caso não informado o valor padrão será de 1 parcela MaxInstallmentCount int64 `json:"maxInstallmentCount,omitempty"` Id string `json:"-"` }
Token
Ao realizar uma primeira transação para o cliente com cartão de crédito, a resposta do Asaas lhe devolverá dentro do objeto creditCard, o atributo creditCardToken.
Parcelamento ¶
Para criar uma cobrança parcelada, ao invés de enviar o parâmetro value, envie installmentCount e installmentValue, que representam o número de parcelas e o valor da cada parcela respectivamente.
func NewPayment ¶
func NewPayment() *Payment
func NewPaymentLink ¶
func NewPaymentLink(value float64, chargeType ChargeType, dueDateLimitDays int64) *Payment
func NewPaymentLinkWithBoleto ¶
func NewPaymentLinkWithBoleto(value float64, chargeType ChargeType, dueDateLimitDays int64) *Payment
func NewPaymentLinkWithCard ¶
func NewPaymentLinkWithCard(value float64, chargeType ChargeType) *Payment
func NewPaymentWithBoleto ¶
func NewPaymentWithCard ¶
func NewPaymentWithPix ¶
func NewSubscription ¶
func NewSubscription() *Payment
func NewSubscriptionWithCard ¶
func (*Payment) SetDueDate ¶
func (*Payment) SetEndDate ¶
type PaymentInCash ¶
type PaymentInCash struct { Id string `valid:"Required"` PaymentDate string `json:"paymentDate" valid:"Required"` NotifyCustomer bool `json:"notifyCustomer"` Value float64 `json:"value" valid:"Required"` // Valor da cobrança }
func NewPaymentInCash ¶
func NewPaymentInCash(id string, date time.Time, value float64) *PaymentInCash
func (*PaymentInCash) SetPaymentDate ¶
func (this *PaymentInCash) SetPaymentDate(date time.Time)
type PaymentResults ¶
type PaymentResults struct { Object string `json:"object"` HasMore bool `json:"hasMore"` TotalCount int64 `json:"totalCount"` Limit int64 `json:"limit"` Offset int64 `json:"offset"` Data []*Response `json:"data"` }
func (*PaymentResults) Count ¶
func (this *PaymentResults) Count() int
func (*PaymentResults) First ¶
func (this *PaymentResults) First() *Response
func (*PaymentResults) HasData ¶
func (this *PaymentResults) HasData() bool
func (*PaymentResults) Last ¶
func (this *PaymentResults) Last() *Response
type PaymentType ¶
type PaymentType int64
const ( PaymentDefault PaymentType = iota + 1 PaymentSubscription PaymentLink )
type PersonType ¶
type PersonType string
const ( FISICA PersonType = "FISICA" JURIDICA PersonType = "JURIDICA" )
type Response ¶
type Response struct { ReturnedId interface{} `json:"id"` Id string // "pay_4440248962351893", PaymentLink string `json:"paymentLink"` // Identificador único do link de pagamentos ao qual a cobrança pertence StatusText string `json:"status"` // "PENDING", Status api.AsaasStatus InvoiceUrl string `json:"invoiceUrl"` // URL da fatura, BankSlipUrl string `json:"bankSlipUrl"` // URL para download do boleto SubscriptionId string `json:"subscription"` // Identificador único da assinatura (quando cobrança recorrente) Object string `json:"object"` // "payment", DateCreated string `json:"dateCreated"` // "2021-07-21", Customer string `json:"customer"` // "cus_000004699156", Value float64 `json:"value"` // 10, NetValue float64 `json:"netValue"` // Valor líquido da cobrança após desconto da tarifa do Asaas OriginalValue float64 `json:"originalValue,omitempty"` // Valor original da cobrança (preenchido quando paga com juros e multa) InterestValue float64 `json:"interestValue,omitempty"` // Valor calculado de juros e multa que deve ser pago após o vencimento da cobrança Description string `json:"description"` // "", BillingType BillingType `json:"billingType"` // "BOLETO", DueDate string `json:"dueDate"` // Data de vencimento da cobrança OriginalDueDate string `json:"originalDueDate"` // "2023-07-07", PaymentDate string `json:"paymentDate"` // Data de liquidação da cobrança no Asaas ClientPaymentDate string `json:"clientPaymentDate"` // Data em que o cliente efetuou o pagamento do boleto InvoiceNumber string `json:"invoiceNumber"` // Número da fatura ExternalReference string `json:"externalReference"` // "4d8ccb10-6c6c-4cd3-8514-450434e4c323", Deleted bool `json:"deleted"` // false, Anticipated bool `json:"anticipated"` // Define se a cobrança foi antecipada ou está em processo de antecipação CreditDate string `json:"creditDate"` // null, EstimatedCreditDate string `json:"estimatedCreditDate"` // null, LastInvoiceViewedDate string `json:"lastInvoiceViewedDate"` // null, LastBankSlipViewedDate string `json:"lastBankSlipViewedDate"` // null, ConfirmedDate string `json:"confirmedDate"` // Data de confirmação da cobrança (Somente para cartão de crédito) Discount *Discount `json:"discount"` Fine *Fine `json:"fine"` Interest *Interest `json:"interest"` PostalService bool `json:"postalService"` // false Installment string `json:"installment"` // Identificador único do parcelamento (quando cobrança parcelada) InstallmentCount int64 `json:"installmentCount"` Card *CardResponse `json:"creditCard"` CustomerResults *CustomerResults PaymentResults *PaymentResults FinancialTransactionResults *FinancialTransactionResults BankAccount *BankAccount `json:"bankAccount,omitempty"` TransferResults *TransferResults AccountResults *AccountResults AccountStatus *AccountStatus Webhook *WebhookObject WalletResults *WalletResults Documents *Documents DocumentResponse *DocumentResponse EncodedImage string `json:"encodedImage"` Payload string `json:"payload"` ExpirationDate string `json:"expirationDate"` // assinatura MaxPayments int64 `json:"maxPayments,omitempty"` SubscriptionCycle api.SubscriptionCycle `json:"cycle,omitempty"` NextDueDate string `json:"nextDueDate"` EndDate string `json:"endDate"` // link de pagamento Name string `json:"name"` ChargeType ChargeType `json:"chargeType"` Url string `json:"url"` Active bool `json:"active,omitempty"` MaxInstallmentCount int64 `json:"maxInstallmentCount,omitempty"` ViewCount int64 `json:"viewCount,omitempty"` DueDateLimitDays int64 `json:"dueDateLimitDays,omitempty"` TotalBalance float64 `json:"totalBalance,omitempty"` Request string Response string Errors []*ResponseError `json:"errors"` Message string Error bool }
func NewResponse ¶
func NewResponse() *Response
func (*Response) BuildStatus ¶
func (this *Response) BuildStatus()
func (*Response) ErrorsCount ¶
func (*Response) ErrorsToMap ¶
func (*Response) FirstError ¶
func (*Response) GetPayZenSOAPStatus ¶
func (this *Response) GetPayZenSOAPStatus() api.TransactionStatus
func (*Response) GetPaymentType ¶
func (this *Response) GetPaymentType() api.PaymentType
type ResponseError ¶
type ResultProcessor ¶
type Split ¶
type Split struct { WalletId string `json:"walletId" valid:"Required"` // Identificador da carteira (retornado no momento da criação da conta) FixedValue float64 `json:"fixedValue"` // Valor fixo a ser transferido para a conta quando a cobrança for recebida PercentualValue float64 `json:"percentualValue"` }
type TokenRequest ¶
type TokenRequest struct { CreditCardCcv string `json:"creditCardCcv" valid:"Required"` CreditCardHolderName string `json:"creditCardHolderName" valid:"Required"` CreditCardExpiryMonth string `json:"creditCardExpiryMonth" valid:"Required"` CreditCardNumber string `json:"creditCardNumber" valid:"Required"` CreditCardExpiryYear string `json:"creditCardExpiryYear" valid:"Required"` Customer string `json:"customer" valid:"Required"` }
func NewTokenRequest ¶
func NewTokenRequest(customer string) *TokenRequest
type Transfer ¶
type Transfer struct { Value float64 `json:"value" valid:"Required"` BankAccount *BankAccount `json:"bankAccount" valid:"Required"` }
func NewTransfer ¶
func NewTransfer(bankAccount *BankAccount, value float64) *Transfer
type TransferEvent ¶
type TransferEvent struct { Event string `json:"event"` Transfer *TransferEventData `json:"transfer"` }
type TransferEventData ¶
type TransferEventData struct { Object string `json:"object"` Id string `json:"id"` DateCreated string `json:"dateCreated"` Status string `json:"status"` EffectiveDate string `json:"effectiveDate"` EndToEndIdentifier string `json:"endToEndIdentifier"` Type string `json:"type"` Value int64 `json:"value"` NetValue int64 `json:"netValue"` TransferFee int64 `json:"transferFee"` ScheduleDate string `json:"scheduleDate"` Authorized bool `json:"authorized"` FailReason string `json:"failReason"` TransactionReceiptUrl string `json:"transactionReceiptUrl"` OperationType string `json:"operationType"` Description string `json:"description"` BankAccount *BankAccount `json:"bankAccount"` }
type TransferResult ¶
type TransferResult struct { Id string `json:"id"` // "777eb7c8-b1a2-4356-8fd8-a1b0644b5282", Object string `json:"object"` // "transfer", DateCreated string `json:"dateCreated"` // "2019-05-02", Status api.TransferStatus `json:"status"` // "PENDING", EffectiveDate string `json:"effectiveDate"` // null, Type string `json:"type"` // "BANK_ACCOUNT", Value float64 `json:"value"` // 1000, NetValue float64 `json:"netValue"` // 1000, TransferFee float64 `json:"transferFee"` // 0, // Taxa de transferência ScheduleDate string `json:"scheduleDate"` // "2019-05-02", Authorized bool `json:"authorized"` // true, BankAccount *BankAccount `json:"bankAccount"` // TransactionReceiptUrl string `json:"transactionReceiptUrl"` // null }
type TransferResults ¶
type TransferResults struct { Object string `json:"object"` HasMore bool `json:"hasMore"` TotalCount int64 `json:"totalCount"` Limit int64 `json:"limit"` Offset int64 `json:"offset"` Data []*TransferResult `json:"data"` }
func (*TransferResults) Count ¶
func (this *TransferResults) Count() int
func (*TransferResults) First ¶
func (this *TransferResults) First() *TransferResult
func (*TransferResults) HasData ¶
func (this *TransferResults) HasData() bool
func (*TransferResults) Last ¶
func (this *TransferResults) Last() *TransferResult
type WalletResults ¶
type WalletResults struct { Object string `json:"object"` HasMore bool `json:"hasMore"` TotalCount int64 `json:"totalCount"` Limit int64 `json:"limit"` Offset int64 `json:"offset"` Data []*Wallet `json:"data"` }
func (*WalletResults) Count ¶
func (this *WalletResults) Count() int
func (*WalletResults) First ¶
func (this *WalletResults) First() *Wallet
func (*WalletResults) HasData ¶
func (this *WalletResults) HasData() bool
func (*WalletResults) Last ¶
func (this *WalletResults) Last() *Wallet
type Webhook ¶
type Webhook struct { Debug bool EntityValidator *validator.EntityValidator ValidationErrors map[string]string HasValidationError bool }
func NewDefaultWebhook ¶
func NewDefaultWebhook() *Webhook
func NewWebhook ¶
type WebhookData ¶
type WebhookData struct { Event api.PaymentEvent `json:"event" valid:"Required"` Response *Response `json:"payment" valid:"Required"` Raw string `json:"raw" valid:"Required"` }
func NewWebhookData ¶
func NewWebhookData() *WebhookData
type WebhookObject ¶
type WebhookObject struct { Url string `json:"url" valid:"Required"` Email string `json:"email" valid:"Required"` Interrupted bool `json:"interrupted" valid:"Required"` Enabled bool `json:"enabled" valid:"Required"` ApiVersion int64 `json:"apiVersion" valid:"Required"` AuthToken string `json:"authToken" valid:"Required"` Type WebhookType `json:"type" valid:"Required"` }
func NewWebhookObject ¶
func NewWebhookObject() *WebhookObject
type WebhookType ¶
type WebhookType string
const ( WebhookPayment WebhookType = "PAYMENT" WebhookInvoice WebhookType = "INVOICE" WebhookTransfer WebhookType = "TRANSFER" WebhookBill WebhookType = "BILL" WebhookAnticipation WebhookType = "RECEIVABLE_ANTICIPATION" WebhookMobilePhoneRecharge WebhookType = "MOBILE_PHONE_RECHARGE" WebhookAccountStatus WebhookType = "ACCOUNT_STATUS" )