v5

package
v0.0.0-...-e91eab7 Latest Latest
Warning

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

Go to latest
Published: May 20, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BRL            Currency = "BRL"
	DateLayout              = "2006-01-02"
	DateTimeLayout          = "2006-01-02T15:04:05"
)
View Source
const (
	BrasilCode = "BR"
)
View Source
const (
	PAGARME_URL = "https://api.pagar.me/core/v5"
)

Variables

This section is empty.

Functions

func ParseWebhookObject

func ParseWebhookObject(body []byte, entity interface{}) error

Types

type Account

type Account struct {
	Id   string `json:"id"`
	Name string `json:"name"`
}

type AdditionalInformation

type AdditionalInformation struct {
	Name  string `json:"name" valid:"Required"`
	Value string `json:"value" valid:"Required"`
}

type Address

type Address struct {
	Id        string `json:"id,omitempty"`
	Country   string `json:"country" valid:"Required;MaxSize(2)"`
	State     string `json:"state" valid:"Required;MaxSize(2)"`
	City      string `json:"city" valid:"Required;MaxSize(64)"`
	ZipCode   string `json:"zip_code" valid:"Required;MaxSize(8)"`
	Line1     string `json:"line_1" valid:"Required"`
	Line2     string `json:"line_2" valid:""`
	CreatedAt string `json:"created_at,omitempty"`
	UpdatedAt string `json:"updated_at,omitempty"`
}

func NewAddress

func NewAddress() *Address

type AntifraudResponse

type AntifraudResponse struct {
	Status       string `json:"status"`
	Score        string `json:"score"`
	ProviderName string `json:"provider_name"`
}

type Authentication

type Authentication struct {
	SecretKey string
	PublicKey string
}

func NewAuthentication

func NewAuthentication(secretKey string, publicKey string) *Authentication

func (*Authentication) Basic

func (this *Authentication) Basic() string

type Balance

type Balance struct {
	Currency           string `json:"currency"`
	AvailableAmount    int64  `json:"available_amount"`
	WaitingFundsAmount int64  `json:"waiting_funds_amount"`
	TransferredAmount  int64  `json:"transferred_amount"`
}

type BalanceOperation

type BalanceOperation struct {
	Id             string `json:"id"`
	Status         string `json:"status"`
	BalanceAmount  int64  `json:"balance_amount"`
	Type           string `json:"type"`
	Amount         int64  `json:"amount"`
	Fee            int64  `json:"fee"`
	CreatedAt      string `json:"created_at"`
	MovementObject string `json:"movement_object"`
}

type BalanceOperationPtr

type BalanceOperationPtr = *BalanceOperation

type BalanceOperations

type BalanceOperations = []BalanceOperationPtr

type BalancePtr

type BalancePtr = *Balance

type BalanceQuery

type BalanceQuery struct {
	Status       ChargeStatus `jsonp:"status,omitempty"`
	CreatedSince time.Time    `jsonp:"created_since,date,omitempty"`
	CreatedUntil time.Time    `jsonp:"created_until,date,omitempty"`
	RecipientId  string       `jsonp:"recipient_id"`
	Page         int          `jsonp:"page,omitempty"`
	Size         int          `jsonp:"size,omitempty"`
}

func NewBalanceQuery

func NewBalanceQuery() *BalanceQuery

func (*BalanceQuery) UrlQuery

func (this *BalanceQuery) UrlQuery() string

type BankAccount

type BankAccount struct {
	HolderName        string          `json:"holder_name" valid:"Required;MaxSize(30)"`
	Bank              string          `json:"bank" valid:"Required;MaxSize(3)"`
	BranchNumber      string          `json:"branch_number" valid:"Required;MaxSize(4)"`
	BranchCheckDigit  string          `json:"branch_check_digit" valid:"Required;MaxSize(1)"`
	AccountNumber     string          `json:"account_number" valid:"Required;MaxSize(13)"`
	AccountCheckDigit string          `json:"account_check_digit" valid:"Required;MaxSize(2)"`
	HolderType        CustomerType    `json:"holder_type" valid:"Required"`
	HolderDocument    string          `json:"holder_document" valid:"Required"`
	Type              BankAccountType `json:"type" valid:"Required"`
}

type BankAccountType

type BankAccountType string
const (
	Checking BankAccountType = "checking" // corrente
	Savings  BankAccountType = "savings"  // poupança
)

type BankCode

type BankCode string
const (
	BancoBrasil BankCode = "001"
	Santander   BankCode = "033"
	Bradesco    BankCode = "237"
	Itau        BankCode = "341"
	Citibank    BankCode = "745"
	Caixa       BankCode = "104"
)

type BillingAddress

type BillingAddress struct {
	Country string `json:"country" valid:"Required;MaxSize(2)"`
	State   string `json:"state" valid:"Required;MaxSize(2)"`
	City    string `json:"city" valid:"Required;MaxSize(64)"`
	ZipCode string `json:"zip_code" valid:"Required;MaxSize(8)"`
	Line1   string `json:"line_1" valid:"Required"`
	Line2   string `json:"line_2" valid:""`
}

type BillingType

type BillingType string
const (
	PrePaid  BillingType = "prepaid"
	PostPaid BillingType = "postpaid"
	ExactDay BillingType = "exact_day"
)

type Boleto

type Boleto struct {
	Bank           BankCode   `json:"bank,omitempty" valid:""`
	Instructions   string     `json:"instructions" valid:"MaxSize(256)"`
	DueAt          string     `json:"due_at"`
	NossoNumero    string     `json:"nosso_numero,omitempty"`
	Type           BoletoType `json:"type,omitempty"`
	DocumentNumber string     `json:"document_number,omitempty" valid:"MaxSize(16)"` // Identificador do boleto
	Interest       *Interest  `json:"interest,omitempty"`
	Fine           *Fine      `json:"fine,omitempty"`
}

func NewBoleto

func NewBoleto() *Boleto

type BoletoType

type BoletoType string
const (
	DM  BoletoType = "DM"
	BDP BoletoType = "BDP"
)

type CancelPendingInvoices

type CancelPendingInvoices bool
const (
	CancelPendingInvoicesYes CancelPendingInvoices = true
	CancelPendingInvoicesNo  CancelPendingInvoices = false
)

type Card

type Card struct {
	Number         string `json:"number,omitempty" valid:""`
	HolderName     string `json:"holder_name,omitempty" valid:""`
	HolderDocument string `json:"holder_document,omitempty" valid:""`
	ExpMonth       int64  `json:"exp_month,omitempty" valid:""` // Value between 1 and 12 (included)
	ExpYear        int64  `json:"exp_year,omitempty" valid:""`  // Formatos yy ou yyyy. Ex: 23 ou 2023
	Cvv            string `json:"cvv,omitempty" valid:""`
	Brand          string `json:"brand,omitempty" valid:""`
	Label          string `json:"label,omitempty" valid:""`
	CardId         string `json:"card_id,omitempty"`
	//CardToken        string          `json:"card_token,omitempty"`
	BillingAddressId string          `json:"billing_address_id,omitempty"`
	BillingAddress   *BillingAddress `json:"billing_address,omitempty"`

	Id             string            `json:"id,omitempty"`
	FirstSixDigits string            `json:"first_six_digits,omitempty"`
	LastFourDigits string            `json:"last_four_digits,omitempty"`
	Status         Status            `json:"status,omitempty"`
	PrivateLabel   bool              `json:"private_label,omitempty"`
	Type           CardType          `json:"type,omitempty"`
	CreatedAt      string            `json:"created_at,omitempty"`
	UpdatedAt      string            `json:"updated_at,omitempty"`
	DeletedAt      string            `json:"deleted_at,omitempty"`
	Customer       *Customer         `json:"customer,omitempty"`
	Metadata       map[string]string `json:"metadata,omitempty"`
}

func NewCard

func NewCard() *Card

type CardId

type CardId string

type CardPtr

type CardPtr = *Card

type CardType

type CardType string
const (
	CardTypeCredit  CardType = "credit"
	CardTypeVoucher CardType = "voucher"
)

type Cards

type Cards = []CardPtr

type Charge

type Charge struct {
	Id              string           `json:"id"`
	Code            string           `json:"code"`
	GatewayId       string           `json:"gateway_id"`
	Amount          int64            `json:"amount"`
	PaidAmount      int64            `json:"paid_amount"`
	Status          ChargeStatus     `json:"status"`
	Currency        Currency         `json:"currency"`
	PaymentMethod   PaymentMethod    `json:"payment_method"`
	DueAt           string           `json:"due_at"`
	PaidAt          string           `json:"paid_at"`
	CreatedAt       string           `json:"created_at"`
	UpdatedAt       string           `json:"updated_at"`
	Invoice         *Invoice         `json:"invoice"`
	Customer        *Customer        `json:"customer"`
	LastTransaction *LastTransaction `json:"last_transaction"`
}

func (*Charge) ToPaymentStatus

func (this *Charge) ToPaymentStatus() api.PaymentStatus

type ChargePaymentConfirm

type ChargePaymentConfirm struct {
	ChargeCode  string `json:"charge_code"`
	Description string `json:"description"`
	Amount      int64  `json:"amount"`
}

type ChargePtr

type ChargePtr = *Charge

type ChargeQuery

type ChargeQuery struct {
	Code          string        `jsonp:"code,omitempty"`
	Status        ChargeStatus  `jsonp:"status,omitempty"`
	PaymentMethod PaymentMethod `jsonp:"payment_method,omitempty"`
	CustomerId    string        `jsonp:"customer_id,omitempty"`
	OrderId       string        `jsonp:"order_id,omitempty"`
	CreatedSince  time.Time     `jsonp:"created_since,date,omitempty"`
	CreatedUntil  time.Time     `jsonp:"created_until,date,omitempty"`
	Page          int           `jsonp:"page,omitempty"`
	Size          int           `jsonp:"size,omitempty"`
}

func NewChargeQuery

func NewChargeQuery() *ChargeQuery

func (*ChargeQuery) UrlQuery

func (this *ChargeQuery) UrlQuery() string

type ChargeStatus

type ChargeStatus string
const (
	ChargePending    ChargeStatus = "pending"
	ChargePaid       ChargeStatus = "paid"
	ChargeCanceled   ChargeStatus = "canceled"
	ChargeProcessing ChargeStatus = "processing"
	ChargeFailed     ChargeStatus = "failed"
	ChargeOverpaid   ChargeStatus = "overpaid"
	ChargeUnderpaid  ChargeStatus = "underpaid"
)

type ChargeUpdate

type ChargeUpdate struct {
	UpdateSubscription bool   `json:"update_subscription,omitempty"`
	CardId             string `json:"card_id,omitempty"`
	CardToken          string `json:"card_token,omitempty"`
	Card               *Card  `json:"card,omitempty"`
}

type Charges

type Charges = []ChargePtr

type Checkout

type Checkout struct {
}

type Content

type Content[T any] struct {
	Paging *Paging `json:"paging"`
	Data   T       `json:"data"`
}

type CreditCard

type CreditCard struct {
	OperationType       OperationType `json:"operation_type" valid:"Required"`
	Installments        int64         `json:"installments"`
	StatementDescriptor string        `json:"statement_descriptor" valid:"Required;MaxSize(13)"`
	Card                *Card         `json:"card,omitempty"`
	CardId              string        `json:"card_id,omitempty"`
	CardToken           string        `json:"card_token,omitempty"`
}

func NewCreditCard

func NewCreditCard() *CreditCard

type Currency

type Currency string

type Customer

type Customer struct {
	Id           string            `json:"id,omitempty"`
	Name         string            `json:"name" valid:"Required;MaxSize(64)"`
	Type         CustomerType      `json:"type" valid:"Required"`
	Email        string            `json:"email" valid:"Required;Email"`
	Code         string            `json:"code" valid:"MaxSize(52)"` // código na plataforma
	Document     string            `json:"document" valid:"MaxSize(50)"`
	DocumentType DocumentType      `json:"document_type"`
	Gender       Gender            `json:"gender"`
	Delinquent   bool              `json:"delinquent"`
	Address      *Address          `json:"address"`
	Phones       *Phones           `json:"phones"`
	Birthdate    string            `json:"birthdate"`
	Metadata     map[string]string `json:"metadata"`
	CreatedAt    string            `json:"created_at,omitempty"`
	UpdatedAt    string            `json:"updated_at,omitempty"`
}

func NewCustomer

func NewCustomer() *Customer

type CustomerPtr

type CustomerPtr = *Customer

type CustomerQuery

type CustomerQuery struct {
	Name     string `jsonp:"name,omitempty"`
	Document string `jsonp:"document,omitempty"`
	Email    string `jsonp:"email,omitempty"`
	Code     string `jsonp:"code,omitempty"`
	Gender   Gender `jsonp:"gender,omitempty"`
	Page     int    `jsonp:"page,omitempty"`
	Size     int    `jsonp:"size,omitempty"`
}

func NewCustomerQuery

func NewCustomerQuery() *CustomerQuery

func (*CustomerQuery) UrlQuery

func (this *CustomerQuery) UrlQuery() string

func (*CustomerQuery) WithDocument

func (this *CustomerQuery) WithDocument(doc string) *CustomerQuery

type CustomerType

type CustomerType string
const (
	Individual CustomerType = "individual"
	Company    CustomerType = "company"
)

type Customers

type Customers = []CustomerPtr

type Cycle

type Cycle struct {
	Id        string `json:"id"`
	BillingAt string `json:"billing_at"`
	Cycle     int64  `json:"cycle"`
	StartAt   string `json:"start_at"`
	EndAt     string `json:"end_at"`
	Duration  int64  `json:"duration"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
	Status    string `json:"status"`
}

type CycleCount

type CycleCount int64

Quantidade de vezes para obrar na recorrência

type Discount

type Discount struct {
	Value         int64         `json":"value"`
	Cycles        int64         `json":"cycles"`
	IncrementType OperationType `json:"increment_type,omitempty"`
}

type DocumentType

type DocumentType string
const (
	CPF      DocumentType = "CPF"
	CNPJ     DocumentType = "CNPJ"
	PASSPORT DocumentType = "PASSPORT"
)

type ErrorResponse

type ErrorResponse struct {
	Message    string              `json:"message"`
	Errors     map[string][]string `json:"errors"`
	StatusCode int64
}

func NewErrorResponse

func NewErrorResponse(msg string) *ErrorResponse

func NewErrorResponseWithErrors

func NewErrorResponseWithErrors(msg string, errors map[string][]string) *ErrorResponse

func (*ErrorResponse) Error

func (this *ErrorResponse) Error() string

func (*ErrorResponse) String

func (this *ErrorResponse) String() string

func (*ErrorResponse) ToMapOfString

func (this *ErrorResponse) ToMapOfString() map[string]string

type Fine

type Fine struct {
	Days   int64         `json:"days" valid:"Required"`
	Type   OperationType `json:"type" valid:"Required"`
	Amount int64         `json:"amount" valid:"Required"` // Valor em porcentagem ou em centavos da taxa de juros que será cobrada ao mês.
}

type GatewayResponse

type GatewayResponse struct {
	Code   string              `json:"code"`
	Errors []map[string]string `json:"errors"`
}

type Gender

type Gender string
const (
	Male   Gender = "male"
	Female Gender = "female"
)

type Increment

type Increment struct {
	Value         int64         `json":"value"`
	Cycles        int64         `json":"cycles"`
	IncrementType OperationType `json:"increment_type,omitempty"`
}

type Interest

type Interest struct {
	Days   int64         `json:"days" valid:"Required"`
	Type   OperationType `json:"type" valid:"Required"`
	Amount int64         `json:"amount" valid:"Required"` // Valor em porcentagem ou em centavos da taxa de juros que será cobrada ao mês.
}

type Interval

type Interval string
const (
	Day   Interval = "day"
	Week  Interval = "week"
	Month Interval = "month"
	Year  Interval = "year"
)

type IntervalCount

type IntervalCount int64

/Ex .: monthly plan = interval_count (1) and interval month /quarterly plan = interval_count (3) and interval month /Semi-annual plan = interval_count (6) and interval month

type Invoice

type Invoice struct {
	Id              string         `json:"id,omitempty"`
	Url             string         `json:"url,omitempty"`
	Code            string         `json:"code,omitempty"`
	Amount          int64          `json:"amount"`
	PaymentMethod   PaymentMethod  `json:"payment_method"`
	Installments    int64          `json:"installments"`
	Status          InvoiceStatus  `json:"status"`
	BillingAt       string         `json:"billing_at"`
	DueAt           string         `json:"due_at"`
	SeenAt          string         `json:"seen_at"`
	CreatedAt       string         `json:"created_at"`
	CanceledAt      string         `json:"canceled_at"`
	TotalDiscounts  int64          `json:"total_discounts"`
	TotalIncrements int64          `json:"total_increments"`
	SubscriptionId  string         `json:"subscriptionId"`
	Items           []*InvoiceItem `json:"items"`
	Customer        *Customer      `json:"customer"`
	Subscription    *Subscription  `json:"subscription"`
	Cycle           *Cycle         `json:"cycle"`
	Charge          *Charge        `json:"charge"`
}

func (*Invoice) ToPaymentStatus

func (this *Invoice) ToPaymentStatus() api.PaymentStatus

type InvoiceItem

type InvoiceItem struct {
	Name        string `json:"name"`
	Amount      int64  `json:"amount"`
	Quantity    int64  `json:"quantity"`
	Description string `json:"description"`
}

The object invoice representa os documentos gerados automaticamente ao final de cada ciclo de uma assinatura, discriminando todos os valores referentes à assinatura, como itens e descontos, para realização da cobrança do assinante.

type InvoicePtr

type InvoicePtr = *Invoice

type InvoiceQuery

type InvoiceQuery struct {
	Status         InvoiceStatus `jsonp:"status,omitempty"`
	CustomerId     string        `jsonp:"customer_id,omitempty"`
	SubscriptionId string        `jsonp:"subscription_id,omitempty"`
	DueSince       time.Time     `jsonp:"due_since,date,omitempty"`
	DueUntil       time.Time     `jsonp:"due_until,date,omitempty"`
	CreatedSince   time.Time     `jsonp:"created_since,date,omitempty"`
	CreatedUntil   time.Time     `jsonp:"created_until,date,omitempty"`
	Page           int           `jsonp:"page,omitempty"`
	Size           int           `jsonp:"size,omitempty"`
}

func NewInvoiceQuery

func NewInvoiceQuery() *InvoiceQuery

func (*InvoiceQuery) UrlQuery

func (this *InvoiceQuery) UrlQuery() string

type InvoiceStatus

type InvoiceStatus string
const (
	InvoicePending   InvoiceStatus = "pending"
	InvoicePaid      InvoiceStatus = "paid"
	InvoiceCanceled  InvoiceStatus = "canceled"
	InvoiceScheduled InvoiceStatus = "scheduled"
	InvoiceFailed    InvoiceStatus = "failed"
)

type Invoices

type Invoices = []InvoicePtr

type LastTransaction

type LastTransaction struct {
	Id                  string              `json:"id"`
	TransactionType     string              `json:"transaction_type"`
	GatewayId           string              `json:"gateway_id"`
	Amount              int64               `json:"amount"`
	PaidAmount          int64               `json:"paid_amount"`
	Status              api.PagarmeV5Status `json:"status"`
	Success             bool                `json:"success"`
	Installments        int64               `json:"installments"`
	StatementDescriptor string              `json:"statement_descriptor"`
	AcquirerName        string              `json:"acquirer_name"`
	AcquirerTID         string              `json:"acquirer_tid"`
	AcquirerNSU         string              `json:"acquirer_nsu"`
	AcquirerAuthCode    string              `json:"acquirer_auth_code"`
	AcquirerMessage     string              `json:"acquirer_message"`
	AcquirerReturnCode  string              `json:"acquirer_return_code"`
	OperationType       string              `json:"operation_type"`
	Card                *Card               `json:"card"`
	FundingSource       string              `json:"funding_source"`
	CreatedAt           string              `json:"created_at"`
	UpdatedAt           string              `json:"updated_at"`
	DueAt               string              `json:"due_at"`
	GatewayResponse     *GatewayResponse    `json:"gateway_response"`
	AntifraudResponse   *AntifraudResponse  `json:"antifraud_response"`
	Metadata            map[string]string   `json:"metadata"`

	Url         string `json:"url,omitempty"`
	Pdf         string `json:"pdf,omitempty"`
	Line        string `json:"line,omitempty"`
	Barcode     string `json:"barcode,omitempty"`
	QrCode      string `json:"qr_code,omitempty"`
	QrCodeUrl   string `json:"qr_code_url,omitempty"`
	ExpiresAt   string `json:"expires_at,omitempty"`
	NossoNumero string `json:"nosso_numero,omitempty"`
}

func (*LastTransaction) GetPayZenSOAPStatus

func (this *LastTransaction) GetPayZenSOAPStatus() api.TransactionStatus

type LastTransactionPtr

type LastTransactionPtr = *LastTransaction

type MovementObject

type MovementObject struct {
	Fee               int64  `json:"fee"`
	AnticipationFee   int64  `json:"anticipation_fee"`
	FraudCoverageFee  int64  `json:"fraud_coverage_fee"`
	RecipientId       string `json:"recipient_id"`
	OriginatorModel   string `json:"originator_model"`
	OriginatorModelId string `json:"originator_model_id"`
	PaymentDate       string `json:"payment_date"`
	PaymentMethod     string `json:"payment_method"`
	Object            string `json:"object"`
	Id                string `json:"id"`
	Status            string `json:"status"`
	Amount            int64  `json:"amount"`
	CreatedAt         string `json:"created_at"`
	Type              string `json:"type"`
	GatewayId         string `json:"gateway_id"`
}

type OperationType

type OperationType string
const (
	Percentage OperationType = "percentage"
	Flat       OperationType = "flat"
)
const (
	AuthAndCapture OperationType = "auth_and_capture"
	AuthOnly       OperationType = "auth_only"
	PreAuth        OperationType = "pre_auth"
)

type Order

type Order struct {
	Code             string       `json:"code" valid:"Required;MaxSize(64)"`
	Customer         *Customer    `json:"customer"`
	CustomerId       string       `json:"customer_id,omitempty"`
	Items            []*OrderItem `json:"items"`
	Payments         []*Payment   `json:"payments"`
	Closed           bool         `json:"closed"` // Informa se o pedido será criado aberto ou fechado.
	Ip               string       `json:"ip" valid:"Required"`
	SessionId        string       `json:"session_id"`
	AntifraudEnabled bool         `json:"antifraud_enabled"`

	Id     string `json:"id,omitempty"`
	Amount int64  `json:"amount,omitempty"`

	Status    string            `json:"status,omitempty"`
	CreatedAt string            `json:"created_at,omitempty"`
	UpdatedAt string            `json:"updated_at,omitempty"`
	Charges   []*Charge         `json:"charges,omitempty"`
	Checkouts []*Checkout       `json:"checkouts,omitempty"`
	Metadata  map[string]string `json:"metadata,omitempty"`
}

func NewOrder

func NewOrder() *Order

func (*Order) AddItem

func (this *Order) AddItem() *OrderItem

func (*Order) AddPayment

func (this *Order) AddPayment(amount int64, method PaymentMethod) *Order

func (*Order) GetChargeId

func (this *Order) GetChargeId() string

func (*Order) GetLastCharge

func (this *Order) GetLastCharge() *optional.Optional[ChargePtr]

func (*Order) GetLastTransaction

func (this *Order) GetLastTransaction() *optional.Optional[LastTransactionPtr]

func (*Order) GetPayZenSOAPStatus

func (this *Order) GetPayZenSOAPStatus() api.TransactionStatus

func (*Order) GetPayment

func (this *Order) GetPayment() *Payment

func (*Order) GetStatus

func (this *Order) GetStatus() api.PagarmeV5Status

func (*Order) GetTranscationId

func (this *Order) GetTranscationId() string

func (*Order) HasCardIdOrToken

func (this *Order) HasCardIdOrToken() bool

func (*Order) IsCreditCard

func (this *Order) IsCreditCard() bool

func (*Order) WithBoleto

func (this *Order) WithBoleto(cb func(*Boleto)) *Order

func (*Order) WithCreditCard

func (this *Order) WithCreditCard(cb func(*CreditCard)) *Order

func (*Order) WithPix

func (this *Order) WithPix(cb func(*Pix)) *Order

type OrderItem

type OrderItem struct {
	Id          string `json:"id,omitempty"`
	Type        string `json:"type,omitempty"`
	Amount      int64  `json:"amount"`
	Description string `json:"description"`
	Quantity    int64  `json:"quantity"`
	Code        string `json:"code" valid:"Required"` // // código na plataforma
	Status      string `json:"status,omitempty"`
	CreatedAt   string `json:"created_at,omitempty"`
	UpdatedAt   string `json:"updated_at,omitempty"`
}

type OrderPtr

type OrderPtr = *Order

type OrderQuery

type OrderQuery struct {
	Code         string    `jsonp:"code,omitempty"`
	CustomerId   string    `jsonp:"customer_id,omitempty"`
	Status       Status    `jsonp:"status,omitempty"`
	CreatedSince time.Time `jsonp:"created_since,date,omitempty"`
	CreatedUntil time.Time `jsonp:"created_until,date,omitempty"`
	Page         int       `jsonp:"page,omitempty"`
	Size         int       `jsonp:"size,omitempty"`
}

func NewOrderQuery

func NewOrderQuery() *OrderQuery

func (*OrderQuery) UrlQuery

func (this *OrderQuery) UrlQuery() string

type Orders

type Orders = []OrderPtr

type Pagarme

type Pagarme struct {
	Auth                  *Authentication
	Lang                  string
	EntityValidator       *validator.EntityValidator
	EntityValidatorResult *validator.EntityValidatorResult
	ValidationErrors      map[string]string
	HasValidationError    bool
	Debug                 bool
	ServiceRefererName    ServiceRefererName
}

func NewPagarme

func NewPagarme(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *Pagarme

func (*Pagarme) DebugOn

func (this *Pagarme) DebugOn() *Pagarme

func (*Pagarme) Log

func (this *Pagarme) Log(message string, args ...interface{})

func (*Pagarme) SetDebug

func (this *Pagarme) SetDebug(debug bool)

func (*Pagarme) SetValidationError

func (this *Pagarme) SetValidationError(key string, value string)

type PagarmeApi

type PagarmeApi struct {
	Card               *PagarmeCard
	Customer           *PagarmeCustomer
	Order              *PagarmeOrder
	Plan               *PagarmePlan
	Subscription       *PagarmeSubscription
	Invoice            *PagarmeInvoice
	Charge             *PagarmeCharge
	Recipient          *PagarmeRecipient
	ServiceRefererName ServiceRefererName
}

func NewPagarmeApi

func NewPagarmeApi(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmeApi

func (*PagarmeApi) DebugOn

func (this *PagarmeApi) DebugOn()

type PagarmeCard

type PagarmeCard struct {
	Pagarme
}

func NewPagarmeCard

func NewPagarmeCard(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmeCard

func (*PagarmeCard) Create

func (this *PagarmeCard) Create(customerId string, card CardPtr) *either.Either[*ErrorResponse, SuccessCard]

func (*PagarmeCard) Delete

func (this *PagarmeCard) Delete(customerId string, cardId string) *either.Either[*ErrorResponse, SuccessBool]

func (*PagarmeCard) Get

func (this *PagarmeCard) Get(customerId string, cardId string) *either.Either[*ErrorResponse, SuccessCard]

func (*PagarmeCard) List

func (this *PagarmeCard) List(customerId string) *either.Either[*ErrorResponse, SuccessCards]

func (*PagarmeCard) Renew

func (this *PagarmeCard) Renew(customerId string, cardId string) *either.Either[*ErrorResponse, SuccessBool]

func (*PagarmeCard) Update

func (this *PagarmeCard) Update(customerId string, card CardPtr) *either.Either[*ErrorResponse, SuccessCard]

type PagarmeCharge

type PagarmeCharge struct {
	Pagarme
}

func NewPagarmeCharge

func NewPagarmeCharge(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmeCharge

func (*PagarmeCharge) Cancel

func (this *PagarmeCharge) Cancel(chargeId string) *either.Either[*ErrorResponse, SuccessCharge]

func (*PagarmeCharge) Capture

func (this *PagarmeCharge) Capture(id string, code string) *either.Either[*ErrorResponse, SuccessCharge]

func (*PagarmeCharge) ConfirmPayment

func (this *PagarmeCharge) ConfirmPayment(chargeId string, opts ...*ChargePaymentConfirm) *either.Either[*ErrorResponse, SuccessCharge]

func (*PagarmeCharge) Get

func (this *PagarmeCharge) Get(chargeId string) *either.Either[*ErrorResponse, SuccessCharge]

func (*PagarmeCharge) List

func (*PagarmeCharge) ListPending

func (this *PagarmeCharge) ListPending(orderId string, size int) *either.Either[*ErrorResponse, SuccessCharges]

func (*PagarmeCharge) Retry

func (this *PagarmeCharge) Retry(chargeId string) *either.Either[*ErrorResponse, SuccessCharge]

func (*PagarmeCharge) UpdateCard

func (this *PagarmeCharge) UpdateCard(chargeId string, updateData ChargeUpdate) *either.Either[*ErrorResponse, SuccessCharge]

func (*PagarmeCharge) UpdateDueDate

func (this *PagarmeCharge) UpdateDueDate(chargeId string, dueDate time.Time) *either.Either[*ErrorResponse, SuccessCharge]

type PagarmeCustomer

type PagarmeCustomer struct {
	Pagarme
}

func NewPagarmeCustomer

func NewPagarmeCustomer(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmeCustomer

func (*PagarmeCustomer) Create

func (*PagarmeCustomer) Get

func (*PagarmeCustomer) List

func (*PagarmeCustomer) Update

type PagarmeInvoice

type PagarmeInvoice struct {
	Pagarme
}

func NewPagarmeInvoice

func NewPagarmeInvoice(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmeInvoice

func (*PagarmeInvoice) Cancel

func (*PagarmeInvoice) Get

func (*PagarmeInvoice) List

type PagarmeOrder

type PagarmeOrder struct {
	Pagarme
}

func NewPagarmeOrder

func NewPagarmeOrder(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmeOrder

func (*PagarmeOrder) Create

func (this *PagarmeOrder) Create(order OrderPtr) *either.Either[*ErrorResponse, SuccessOrder]

func (*PagarmeOrder) Get

func (this *PagarmeOrder) Get(orderId string) *either.Either[*ErrorResponse, SuccessOrder]

func (*PagarmeOrder) List

type PagarmePlan

type PagarmePlan struct {
	Pagarme
}

func NewPagarmePlan

func NewPagarmePlan(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmePlan

func (*PagarmePlan) Create

func (this *PagarmePlan) Create(plan *Plan) *either.Either[*ErrorResponse, SuccessPlan]

func (*PagarmePlan) Delete

func (*PagarmePlan) Get

func (*PagarmePlan) List

func (*PagarmePlan) Update

func (this *PagarmePlan) Update(plan PlanPtr) *either.Either[*ErrorResponse, SuccessPlan]

type PagarmeRecipient

type PagarmeRecipient struct {
	Pagarme
}

func NewPagarmeRecipient

func NewPagarmeRecipient(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmeRecipient

func (*PagarmeRecipient) Balance

func (this *PagarmeRecipient) Balance(recipientId string) *either.Either[*ErrorResponse, SuccessBalance]

func (*PagarmeRecipient) BalanceOperations

func (this *PagarmeRecipient) BalanceOperations(recipientId string, query *BalanceQuery) *either.Either[*ErrorResponse, SuccessBalanceOperations]

func (*PagarmeRecipient) Create

func (*PagarmeRecipient) CreateTransfer

func (this *PagarmeRecipient) CreateTransfer(recipientId string, amount int64) *either.Either[*ErrorResponse, SuccessTransfer]

func (*PagarmeRecipient) GetTransfer

func (this *PagarmeRecipient) GetTransfer(recipientId string, transferId string) *either.Either[*ErrorResponse, SuccessTransfer]

func (*PagarmeRecipient) Gt

func (*PagarmeRecipient) List

func (*PagarmeRecipient) ListTransfers

func (this *PagarmeRecipient) ListTransfers(recipientId string, query *TransferQuery) *either.Either[*ErrorResponse, SuccessTransfers]

func (*PagarmeRecipient) Update

func (*PagarmeRecipient) UpdateBankAccount

func (this *PagarmeRecipient) UpdateBankAccount(id string, account BankAccount) *either.Either[*ErrorResponse, SuccessBool]

func (*PagarmeRecipient) UpdateTransferSettings

func (this *PagarmeRecipient) UpdateTransferSettings(id string, settings *TransferSettings) *either.Either[*ErrorResponse, SuccessBool]

type PagarmeSubscription

type PagarmeSubscription struct {
	Pagarme
}

func NewPagarmeSubscription

func NewPagarmeSubscription(lang string, auth *Authentication, serviceRefererName ServiceRefererName) *PagarmeSubscription

func (*PagarmeSubscription) Cancel

func (this *PagarmeSubscription) Cancel(id string, cancelPendingInvoices CancelPendingInvoices) *either.Either[*ErrorResponse, SuccessBool]

func (*PagarmeSubscription) Create

func (*PagarmeSubscription) Get

func (*PagarmeSubscription) List

func (*PagarmeSubscription) ListItems

func (*PagarmeSubscription) UpdateCard

func (*PagarmeSubscription) UpdateItem

func (this *PagarmeSubscription) UpdateItem(subscriptionId string, itemId string, item SubscriptionItemPtr) *either.Either[*ErrorResponse, SuccessSubscriptionItem]

func (*PagarmeSubscription) UpdatePaymentMethod

func (this *PagarmeSubscription) UpdatePaymentMethod(updateData *SubscriptionUpdate) *either.Either[*ErrorResponse, SuccessBool]

type Paging

type Paging struct {
	Total int `json:"total"`
}

type Payment

type Payment struct {
	PaymentMethod PaymentMethod `json:"payment_method"`
	CreditCard    *CreditCard   `json:"credit_card,omitempty"`
	Boleto        *Boleto       `json:"boleto,omitempty"`
	Pix           *Pix          `json:"pix,omitempty"`
	Amount        int64         `json:"amount" valid:"Required"`
}

func NewPayment

func NewPayment(amount int64, method PaymentMethod) *Payment

func (*Payment) HasCardIdOrToken

func (this *Payment) HasCardIdOrToken() bool

func (*Payment) IsCreditCard

func (this *Payment) IsCreditCard() bool

type PaymentMethod

type PaymentMethod string
const (
	MethodCreditCard PaymentMethod = "credit_card"
	MethodBoleto     PaymentMethod = "boleto"
	MethodPix        PaymentMethod = "pix"
)

type Phone

type Phone struct {
	CountryCode string `json:"country_code"`
	AreaCode    string `json:"area_code"`
	Number      string `json:"number"`
}

func NewPhone

func NewPhone(countryCode string, areaCode string, number string) *Phone

type Phones

type Phones struct {
	HomePhone   *Phone `json:"home_phone"`
	MobilePhone *Phone `json:"mobile_phone"`
}

type Pix

type Pix struct {
	ExpiresIn             int64                  `json:"expires_in,omitempty" ` //Data de expiração do Pix em segundos.
	ExpiresAt             string                 `json:"expires_at,omitempty"`  // Data de expiração do Pix [Formato: YYYY-MM-DDThh:mm:ss] UTC
	AdditionalInformation *AdditionalInformation `json:"additional_information,omitempty"`
}

func NewPix

func NewPix() *Pix

type Plan

type Plan struct {
	Id             string          `json:"id"`
	Name           string          `json:"name" valid:"Required;MaxSize(64)"`
	Description    string          `json:"description" valid:""`
	Shippable      bool            `json:"shippable"`
	PaymentMethods []PaymentMethod `json:"payment_methods"`
	// Opções de parcelamento disponíveis para assinaturas criadas a partir do plano.
	Installments        []int64  `json:"installments,omitempty"`
	MinimumPrice        int64    `json:"int64,omitempty"`
	StatementDescriptor string   `json:"statement_descriptor" valid:"MaxSize(13)"`
	Currency            Currency `json:"currency"`
	Interval            Interval `json:"interval"`
	/**
	Número de intervalos de acordo com a propriedade interval entre cada cobrança da assinatura.
	Ex.: plano mensal = interval_count (1) e interval (month)
	plano trimestral = interval_count (3) e interval (month)
	plano semestral = interval_count (6) e interval (month)
	*/
	IntervalCount   IntervalCount `json:"interval_count"`
	TrialPeriodDays int64         `json:"trial_period_days,omitempty"`
	BillingType     BillingType   `json:"billing_type" valid:"Required"`
	/**
	Dias disponíveis para cobrança das assinaturas criadas a partir do plano.
	Deve ser maior ou igual a 1 e menor ou igual a 28.
	Obrigatório, caso o billing_type seja igual a exact_day.
	*/
	BillingDays   []int64           `json:"billing_days,omitempty"`
	Items         []*PlanItem       `json:"items"`
	Metadata      map[string]string `json:"metadata,omitempty"`
	PricingScheme *PricingScheme    `json:"pricing_scheme,omitempty"`
	/**
	Quantidade para o pricing_scheme.
	Obrigatório quando o pricing_scheme.scheme_type for igual a unit.
	*/
	Quantity Quantity `json:"quantity"`
	Status   Status   `json:"status,omitempty"`
}

func NewPlan

func NewPlan(name string) *Plan

func (*Plan) AddPaymentMethod

func (this *Plan) AddPaymentMethod(methods ...PaymentMethod) *Plan

func (*Plan) AddPlanItem

func (this *Plan) AddPlanItem(items ...*PlanItem) *Plan

func (*Plan) GetAmount

func (this *Plan) GetAmount() int64

func (*Plan) GetIntervalRule

func (this *Plan) GetIntervalRule() api.SubscriptionCycle

func (*Plan) SetIntervalRule

func (this *Plan) SetIntervalRule(interval Interval, count IntervalCount) *Plan

func (*Plan) SetPricingScheme

func (this *Plan) SetPricingScheme(scheme *PricingScheme) *Plan

type PlanItem

type PlanItem struct {
	Id          string `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	// Quantidade de itens.
	Quantity Quantity `json:"quantity"`
	//Indicates how many times the item will be charged.
	/**
	Número de ciclos durante o qual o item será cobrado.
	Ex: Um item com cycles = 1 representa que um item será cobrado apenas uma vez.
	Caso não seja informado, o item será cobrado até que seja desativado.
	*/
	Cycles        CycleCount     `json:"cycles,omitempty"`
	Interval      Interval       `json:"interval,omitempty"`
	CreatedAt     string         `json:"created_at,omitempty"`
	UpdatedAt     string         `json:"updated_at,omitempty"`
	DeletedAt     string         `json:"deleted_at,omitempty"`
	PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
	Status        Status         `json:"status,omitempty"`
	Plan          *Plan          `json:"plan"`
}

func NewPlanItem

func NewPlanItem(name string, quantity Quantity, cycles CycleCount, price int64) *PlanItem

type PlanPtr

type PlanPtr = *Plan

type PlanQuery

type PlanQuery struct {
	Name         string    `jsonp:"name,omitempty"`
	Status       Status    `jsonp:"status,omitempty"`
	CreatedSince time.Time `jsonp:"created_since,date,omitempty"`
	CreatedUntil time.Time `jsonp:"created_until,date,omitempty"`
	Page         int       `jsonp:"page,omitempty"`
	Size         int       `jsonp:"size,omitempty"`
}

func NewPlanQuery

func NewPlanQuery() *PlanQuery

func (*PlanQuery) UrlQuery

func (this *PlanQuery) UrlQuery() string

type Plans

type Plans = []PlanPtr

type PricingScheme

type PricingScheme struct {
	Price        int64      `json:"price"`
	MininumPrice int64      `json:"mininum_price,omitempty"`
	SchemeType   SchemeType `json:"scheme_type,omitempty"`
}

func NewPricingScheme

func NewPricingScheme(price int64) *PricingScheme

type Quantity

type Quantity int64

type Recipient

type Recipient struct {
	Id                 string            `json:"id,omitempty"`
	Name               string            `json:"name" valid:"Required;MaxSize(128)"`
	Email              string            `json:"email" valid:"Required;MaxSize(64)"`
	Description        string            `json:"description" valid:"Required;MaxSize(256)"`
	Document           string            `json:"document" valid:"Required;MaxSize(16)"`
	Type               CustomerType      `json:"type" valid:"Required"`
	Code               string            `json:"code" valid:"Required"`
	TransferSettings   *TransferSettings `json:"transfer_settings" valid:"Required"`
	DefaultBankAccount BankAccount       `json:"default_bank_account" valid:"Required"`
	Metadata           map[string]string `json:"metadata"`
}

The object recipient represents a receiver, which will receive part of the sale made.

type RecipientPtr

type RecipientPtr = *Recipient

type RecipientUpdate

type RecipientUpdate struct {
	Email       string       `json:"email" valid:"Required;MaxSize(64)"`
	Description string       `json:"description" valid:"Required;MaxSize(256)"`
	Type        CustomerType `json:"type" valid:"Required"`
}

type Recipients

type Recipients = []RecipientPtr

type Response

type Response struct {
	Error *ErrorResponse

	Content interface{}

	RawResponse string
	RawRequest  string
	StatusCode  int
}

func NewResponse

func NewResponse() *Response

func (*Response) GetErrros

func (this *Response) GetErrros() map[string][]string

func (*Response) GetMessage

func (this *Response) GetMessage() string

func (*Response) HasError

func (this *Response) HasError() bool

func (*Response) HasErrors

func (this *Response) HasErrors() bool

type ResponseParser

type ResponseParser func(data []byte, response *Response) error

type SchemeType

type SchemeType string
const (
	Unit    SchemeType = "unit"
	Package SchemeType = "package"
	Volume  SchemeType = "volume"
	Tier    SchemeType = "tier"
)

type ServiceRefererName

type ServiceRefererName string

type Status

type Status string
const (
	Active   Status = "active"
	Deleted  Status = "deleted"
	Expired  Status = "expired"
	Inactive Status = "inactive"
	Canceled Status = "canceled"
)

type Subscription

type Subscription struct {
	Id                  string              `json:"id,omitempty"`
	Code                string              `json:"code,omitempty" valid:"MaxSize(52)"`
	PlanId              string              `json:"plan_id,omitempty"`
	Status              Status              `json:"status,omitempty"`
	PaymentMethod       PaymentMethod       `json:"payment_method" valid:"Required"`
	Currency            Currency            `json:"currency"`
	StartAt             string              `json:"start_at" valid:"Required"`
	Interval            Interval            `json:"interval" valid:"Required"`
	MinimumPrice        int64               `json:"minimum_price" valid:""`
	IntervalCount       IntervalCount       `json:"interval_count" valid:"Required"`
	BillingType         BillingType         `json:"billing_type" valid:"Required"`
	BillingDay          int64               `json:"billing_day,omitempty" valid:""`
	Installments        int64               `json:"installments" valid:""`
	StatementDescriptor string              `json:"statement_descriptor" valid:"Required;MaxSize(13)"`
	Customer            *Customer           `json:"customer,omitempty"`
	CustomerId          string              `json:"customer_id,omitempty"`
	Discounts           []*Discount         `json:"discounts,omitempty"`
	Increments          []*Increment        `json:"increments,omitempty"`
	Items               []*SubscriptionItem `json:"items"`
	Card                *Card               `json:"card"`
	CardId              string              `json:"card_id"`
	CardToken           string              `json:"card_token"`
	BoletoDueDays       int64               `json:"boleto_due_days"`
	Metadata            map[string]string   `json:"metadata"`
	Description         string              `json:"description"`
	PricingScheme       *PricingScheme      `json:"pricing_scheme,omitempty"`
	Quantity            Quantity            `json:"quantity"`
	Boleto              *Boleto             `json:"boleto,omitempty"`
}

func NewSubscription

func NewSubscription() *Subscription

func (*Subscription) AddItem

func (this *Subscription) AddItem(items ...*SubscriptionItem) *Subscription

func (*Subscription) HasCardIdOrToken

func (this *Subscription) HasCardIdOrToken() bool

func (*Subscription) SetIntervalRule

func (this *Subscription) SetIntervalRule(interval Interval, intervalCount IntervalCount) *Subscription

func (*Subscription) SetPricingScheme

func (this *Subscription) SetPricingScheme(scheme *PricingScheme) *Subscription

func (*Subscription) SetStartAt

func (this *Subscription) SetStartAt(date time.Time) *Subscription

func (*Subscription) WithCard

func (this *Subscription) WithCard(card CardPtr) *Subscription

func (*Subscription) WithCustomer

func (this *Subscription) WithCustomer(customer CustomerPtr) *Subscription

func (*Subscription) WithPlanId

func (this *Subscription) WithPlanId(planId string) *Subscription

type SubscriptionItem

type SubscriptionItem struct {
	Id            string         `json:"id,omitempty"`
	Description   string         `json:"description,omitempty"`
	Cycles        CycleCount     `json:"cycles,omitempty"`
	Quantity      Quantity       `json:"quantity"`
	Status        Status         `json:"status,omitempty"`
	CreatedAt     string         `json:"created_at,omitempty"`
	UpdatedAt     string         `json:"updated_at,omitempty"`
	DeletedAt     string         `json:"deleted_at,omitempty"`
	Discounts     []*Discount    `json:"discounts,omitempty"`
	Increments    []*Increment   `json:"increments,omitempty"`
	PricingScheme *PricingScheme `json:"pricing_scheme,omitempty"`
	Name          string         `json:"name"`
}

func NewSubscriptionItem

func NewSubscriptionItem(description string, quantity Quantity, cycles CycleCount) *SubscriptionItem

func (*SubscriptionItem) SetPricingScheme

func (this *SubscriptionItem) SetPricingScheme(scheme *PricingScheme) *SubscriptionItem

type SubscriptionItemPtr

type SubscriptionItemPtr = *SubscriptionItem

type SubscriptionItems

type SubscriptionItems = []SubscriptionItemPtr

type SubscriptionPtr

type SubscriptionPtr = *Subscription

type SubscriptionQuery

type SubscriptionQuery struct {
	Status           Status      `jsonp:"status,omitempty"`
	Code             string      `jsonp:"code,omitempty"`
	BillingType      BillingType `jsonp:"billing_type,omitempty"`
	CustomerId       string      `jsonp:"customer_id,omitempty"`
	PlanId           string      `jsonp:"plan_id,omitempty"`
	CardId           string      `jsonp:"card_id,omitempty"`
	NextBillingSince time.Time   `jsonp:"next_billing_since,date,omitempty"`
	NextBillingUntil time.Time   `jsonp:"next_billing_until,date,omitempty"`
	CreatedSince     time.Time   `jsonp:"created_since,date,omitempty"`
	CreatedUntil     time.Time   `jsonp:"created_until,date,omitempty"`
	Page             int         `jsonp:"page,omitempty"`
	Size             int         `jsonp:"size,omitempty"`
}

func NewSubscriptionQuery

func NewSubscriptionQuery() *SubscriptionQuery

func (*SubscriptionQuery) UrlQuery

func (this *SubscriptionQuery) UrlQuery() string

type SubscriptionUpdate

type SubscriptionUpdate struct {
	Id            string
	Card          *Card         `json:"card,omitempty"`
	CardId        string        `json:"card_id,omitempty"`
	CardToken     string        `json:"card_token,omitempty"`
	PaymentMethod PaymentMethod `json:"payment_method,omitempty"`
}

func NewSubscriptionUpdate

func NewSubscriptionUpdate(id string) *SubscriptionUpdate

type Subscriptions

type Subscriptions = []SubscriptionPtr

type Success

type Success[T any] struct {
	Data        T
	RawResponse string
	RawRequest  string
}

func NewSuccess

func NewSuccess[T any](response *Response) *Success[T]

func NewSuccessSlice

func NewSuccessSlice[T any](response *Response) *Success[T]

func NewSuccessWithValue

func NewSuccessWithValue[T any](response *Response, val T) *Success[T]

type SuccessBalance

type SuccessBalance = *Success[BalancePtr]

type SuccessBalanceOperations

type SuccessBalanceOperations = *Success[BalanceOperations]

type SuccessBool

type SuccessBool = *Success[bool]

type SuccessCard

type SuccessCard = *Success[CardPtr]

type SuccessCards

type SuccessCards = *Success[Cards]

type SuccessCharge

type SuccessCharge = *Success[ChargePtr]

type SuccessCharges

type SuccessCharges = *Success[Charges]

type SuccessCustomer

type SuccessCustomer = *Success[CustomerPtr]

type SuccessCustomers

type SuccessCustomers = *Success[Customers]

type SuccessInvoice

type SuccessInvoice = *Success[InvoicePtr]

type SuccessInvoices

type SuccessInvoices = *Success[Invoices]

type SuccessOrder

type SuccessOrder = *Success[OrderPtr]

type SuccessOrders

type SuccessOrders = *Success[Orders]

type SuccessPlan

type SuccessPlan = *Success[PlanPtr]

type SuccessPlans

type SuccessPlans = *Success[Plans]

type SuccessRecipient

type SuccessRecipient = *Success[RecipientPtr]

type SuccessRecipients

type SuccessRecipients = *Success[Recipients]

type SuccessSubscription

type SuccessSubscription = *Success[SubscriptionPtr]

type SuccessSubscriptionItem

type SuccessSubscriptionItem = *Success[SubscriptionItemPtr]

type SuccessSubscriptionItems

type SuccessSubscriptionItems = *Success[SubscriptionItems]

type SuccessSubscriptions

type SuccessSubscriptions = *Success[Subscriptions]

type SuccessTransfer

type SuccessTransfer = *Success[TransferPtr]

type SuccessTransfers

type SuccessTransfers = *Success[Transfers]

type Transfer

type Transfer struct {
	Id          string       `json:"id"`
	Amount      int64        `json:"amount"`
	Status      string       `json:"status"`
	CreatedAt   string       `json:"created_at"`
	UpdatedAt   string       `json:"updated_at"`
	BankAccount *BankAccount `json:"bank_account"`
	Recipient   *Recipient   `json:"recipient"`
}

type TransferInterval

type TransferInterval string
const (
	Daily   TransferInterval = "daily"
	Weekly  TransferInterval = "weekly"
	Monthly TransferInterval = "monthly"
)

type TransferPtr

type TransferPtr = *Transfer

type TransferQuery

type TransferQuery struct {
	Status       ChargeStatus `jsonp:"status,omitempty"`
	CreatedSince time.Time    `jsonp:"created_since,date,omitempty"`
	CreatedUntil time.Time    `jsonp:"created_until,date,omitempty"`
	Page         int          `jsonp:"page,omitempty"`
	Size         int          `jsonp:"size,omitempty"`
}

func NewTransferQuery

func NewTransferQuery() *TransferQuery

func (*TransferQuery) UrlQuery

func (this *TransferQuery) UrlQuery() string

type TransferSettings

type TransferSettings struct {
	TransferEnabled  bool             `json:"transfer_enabled"`
	TransferInterval TransferInterval `json:"transfer_interval"`
	TransferDay      int64            `json:"transfer_day,omitempty"`
}

type Transfers

type Transfers = []TransferPtr

type Webhook

type Webhook struct {
	JsonParser *support.JsonParser
	Debug      bool

	EntityValidator    *validator.EntityValidator
	ValidationErrors   map[string]string
	HasValidationError bool
}

func NewDefaultWebhook

func NewDefaultWebhook() *Webhook

func NewWebhook

func NewWebhook(lang string) *Webhook

func (*Webhook) Parse

func (this *Webhook) Parse(body []byte) (*WebhookData, error)

func (*Webhook) SetDebug

func (this *Webhook) SetDebug()

type WebhookData

type WebhookData struct {
	Id         string       `json:"id" valid:"Required"`
	Event      WebhookEvent `json:"event" valid:"Required"`
	Status     string       `json:"status" valid:""`
	Raw        string       `json:"raw" valid:"Required"`
	PayloadMap map[string]interface{}
}

func NewWebhookData

func NewWebhookData() *WebhookData

func (*WebhookData) IsCharge

func (this *WebhookData) IsCharge() bool

func (*WebhookData) IsOrder

func (this *WebhookData) IsOrder() bool

func (*WebhookData) IsSubscription

func (this *WebhookData) IsSubscription() bool

func (*WebhookData) IsSubscriptionItem

func (this *WebhookData) IsSubscriptionItem() bool

type WebhookEvent

type WebhookEvent string
const (
	EventCustomerCreated         WebhookEvent = "customer.created"          //	Occurs whenever a customer is created.
	EventCustomerUpdated         WebhookEvent = "customer.updated"          //	Occurs whenever a customer is updated.
	EventCardCreated             WebhookEvent = "card.created"              //	Occurs whenever a card is created.
	EventCardUpdated             WebhookEvent = "card.updated"              //	Occurs whenever a card is updated.
	EventCardDeleted             WebhookEvent = "card.deleted"              //	Occurs whenever a card is deleted.
	EventAddressCreated          WebhookEvent = "address.created"           //	Occurs whenever an address is created.
	EventAddressUpdated          WebhookEvent = "address.updated"           //	Occurs whenever an address is updated.
	EventAddressDeleted          WebhookEvent = "address.deleted"           //	Occurs whenever an address is deleted.
	EventCardExpired             WebhookEvent = "card.expired"              //	Occurs whenever a card expires by the expiration date.
	EventPlanCreated             WebhookEvent = "plan.created"              //	Occurs whenever a plan is created.
	EventPlanUpdated             WebhookEvent = "plan.updated"              //	Occurs whenever a plan is updated.
	EventPlanDeleted             WebhookEvent = "plan.deleted"              //	Occurs whenever a plan is deleted.
	EventPlanItemCreated         WebhookEvent = "plan_item.created"         //	Occurs whenever a plan item is created.
	EventPlanItemUpdated         WebhookEvent = "plan_item.updated"         //	Occurs whenever a plan item is updated.
	EventPlanItemDeleted         WebhookEvent = "plan_item.deleted"         //	Occurs whenever a plan item is deleted.
	EventSubscriptionCreated     WebhookEvent = "subscription.created"      //	Occurs whenever a subscription is created.
	EventSubscriptionCanceled    WebhookEvent = "subscription.canceled"     //	Occurs whenever the subscription is canceled.
	EventSubscriptionItemCreated WebhookEvent = "subscription_item.created" //	Occurs whenever a subscription item is created.
	EventSubscriptionItemUpdated WebhookEvent = "subscription_item.updated" //	Occurs whenever a subscription item is updated.
	EventSubscriptionItemDeleted WebhookEvent = "subscription_item.deleted" //	Occurs whenever a subscription item is deleted.
	EventDiscountCreated         WebhookEvent = "discount.created"          //	Occurs whenever a discount is created.
	EventDiscountDeleted         WebhookEvent = "discount.deleted"          //	Occurs whenever a discount is deleted.
	EventIncrementCreated        WebhookEvent = "increment.created"         //	Occurs whenever an increment is created.
	EventIncrementDeleted        WebhookEvent = "increment.deleted"         //	Occurs whenever an increment is deleted.
	EventOrderPaid               WebhookEvent = "order.paid"                //	Occurs whenever an order is paid.
	EventOrderPaymentFailed      WebhookEvent = "order.payment_failed"      //	Occurs whenever payment for an order fails.
	EventOrderCreated            WebhookEvent = "order.created"             //	Occurs whenever a order is created.
	EventOrderCanceled           WebhookEvent = "order.canceled"            //	Occurs whenever an order is canceled.
	EventOrderItemCreated        WebhookEvent = "order_item.created"        //	Occurs whenever an order item is created.
	EventOrderItemUpdated        WebhookEvent = "order_item.updated"        //	Occurs whenever an order item is updated.
	EventOrderItemDeleted        WebhookEvent = "order_item.deleted"        //	Occurs whenever an order item is deleted.
	EventOrderClosed             WebhookEvent = "order.closed"              //	Occurs whenever a request is closed.
	EventOrderUpdated            WebhookEvent = "order.updated"             //	Occurs whenever a order is updated.
	EventInvoiceCreated          WebhookEvent = "invoice.created"           //	Occurs whenever an invoice is created.
	EventInvoiceUpdated          WebhookEvent = "invoice.updated"           //	Occurs whenever an invoice is updated.
	EventInvoicePaid             WebhookEvent = "invoice.paid"              //	Occurs whenever an invoice is paid.
	EventInvoicePaymentFailed    WebhookEvent = "invoice.payment_failed"    //	Occurs when an invoice payment fails.
	EventInvoiceCanceled         WebhookEvent = "invoice.canceled"          //	Occurs whenever an invoice is canceled
	EventChargeCreated           WebhookEvent = "charge.created"            //	Occurs whenever a charge is created.
	EventChargeUpdated           WebhookEvent = "charge.updated"            //	Occurs when a charge is updated.
	EventChargePaid              WebhookEvent = "charge.paid"               //	Occurs whenever a charge is paid.
	EventChargePaymentFailed     WebhookEvent = "charge.payment_failed"     //	Occurs when a charge for a charge fails.
	EventChargeRefunded          WebhookEvent = "charge.refunded"           //	Occurs whenever a charge is reversed.
	EventChargePending           WebhookEvent = "charge.pending"            //	Occurs whenever a charge is pending.
	EventChargeProcessing        WebhookEvent = "charge.processing"         //	Occurs whenever a charge is still being processed.
	EventChargeUnderpaid         WebhookEvent = "charge.underpaid"          //	Occurs whenever a charge has been underpaid.
	EventChargeOverpaid          WebhookEvent = "charge.overpaid"           //	Occurs whenever a charge has been overpaid.
	EventChargePartialCanceled   WebhookEvent = "charge.partial_canceled"   //	Occurs when a charge has been partially canceled.
	EventChargeChargedback       WebhookEvent = "charge.chargedback"        //	Ocorre sempre que uma cobrança sofre chargeback.
	EventUsageCreated            WebhookEvent = "usage.created"             //	Occurs whenever the usage of an item in the period is created.
	EventUsageDeleted            WebhookEvent = "usage.deleted"             //	Occurs whenever the usage of an item in the period is deleted.
	EventRecipientCreated        WebhookEvent = "recipient.created"         //	Occurs whenever a recipient is created.
	EventRecipientDeleted        WebhookEvent = "recipient.deleted"         //	Occurs whenever a recipient is deleted.
	EventRecipientUpdated        WebhookEvent = "recipient.updated"         //	Occurs whenever a recipient is updated.
	EventBankAccountCreated      WebhookEvent = "bank_account.created"      //	Occurs whenever a bank account is created.
	EventBankAccountUpdated      WebhookEvent = "bank_account.updated"      //	Occurs whenever a bank account is updated.
	EventBankAccountDeleted      WebhookEvent = "bank_account.deleted"      //	Occurs whenever a bank account is deleted.
	EventSellerCreated           WebhookEvent = "seller.created"            //	Occurs whenever a salesperson is created.
	EventSellerUpdated           WebhookEvent = "seller.updated"            //	Occurs whenever a seller is edited.
	EventSellerDeleted           WebhookEvent = "seller.deleted"            //	Occurs whenever a seller is deleted.
	EventTransferPending         WebhookEvent = "transfer.pending"          //	Occurs whenever a transfer is pending.
	EventTransferCreated         WebhookEvent = "transfer.created"          //	Occurs whenever a transfer is created.
	EventTransferProcessing      WebhookEvent = "transfer.processing"       //	Occurs whenever a transfer is in process.
	EventTransferPaid            WebhookEvent = "transfer.paid"             //	It occurs whenever a transfer is paid.
	EventTransferCanceled        WebhookEvent = "transfer.canceled"         //	Occurs whenever a transfer is canceled.
	EventTransferFailed          WebhookEvent = "transfer.failed"           //	Occurs whenever a transfer fails.
	EventCheckoutCreated         WebhookEvent = "checkout.created"          //	Occurs when a checkout is created.
	EventCheckoutCanceled        WebhookEvent = "checkout.canceled"         //	Occurs when a checkout is canceled.
	EventCheckoutClosed          WebhookEvent = "checkout.closed"           //	Ocorre quando um checkout é fechado.
	EventChargeAntifraudApproved WebhookEvent = "charge.antifraud_approved" //	Occurs when an anti-fraud order is approved.
	EventChargeAntifraudReproved WebhookEvent = "charge.antifraud_reproved" //	It occurs when an anti-fraud order is disapproved.
	EventChargeAntifraudManual   WebhookEvent = "charge.antifraud_manual"   //	Occurs when an order in anti-fraud is marked for manual analysis.
	EventChargeAntifraudPending  WebhookEvent = "charge.antifraud_pending"  //	It occurs when an order is pending to be sent for analysis by the anti-fraud service.
)

type WebhookObject

type WebhookObject[T any] struct {
	Id        string       `json:"id"`
	Account   *Account     `json:"account"`
	Type      WebhookEvent `json:"type"`
	CreatedAt string       `json:"created_at"`
	Data      T            `json:"data"`
}

type WebhookStatus

type WebhookStatus string
const (
	WebhookPending WebhookStatus = "pending"
	WebhookSent    WebhookStatus = "sent"
	WebhookFailed  WebhookStatus = "failed"
)

Jump to

Keyboard shortcuts

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