pagarme

package
v2.0.0-...-cde49a6 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const MaxItemsPerPage = 1000

Variables

View Source
var DefaultApiVersion = "2017-08-28"

Functions

func GetBoletoPdfUrl

func GetBoletoPdfUrl(boletoUrl string) string

Types

type Address

type Address struct {
	Object       string `json:"object,omitempty" form:"object,omitempty"`
	ID           int64  `json:"id,omitempty" form:"id,omitempty"`
	Street       string `json:"street" form:"street"`
	StreetNumber string `json:"street_number" form:"street_number"`
	// CEP. Para endereço brasileiro, deve conter uma numeração de 8 dígitos
	Zipcode string `json:"zipcode" form:"zipcode"`
	// Obrigatório. País. Duas letras minúsculas. Deve seguir o padão ISO 3166-1 alpha-2
	Country       CountryCode `json:"country" form:"country"`
	State         string      `json:"state" form:"state"`
	City          string      `json:"city" form:"city"`
	Neighborhood  string      `json:"neighborhood,omitempty" form:"neighborhood,omitempty"`
	Complementary string      `json:"complementary,omitempty" form:"complementary,omitempty"`
}

Address TBD

type Anticipation

type Anticipation struct {
	Object          string                `json:"object,omitempty"`
	ID              string                `json:"id,omitempty"`
	Status          AnticipationStatus    `json:"status,omitempty"`
	Amount          int                   `json:"amount,omitempty"`
	Fee             int                   `json:"fee,omitempty"`
	AnticipationFee int                   `json:"anticipation_fee,omitempty"`
	Type            AnticipationType      `json:"type,omitempty"`
	Timeframe       AnticipationTimeframe `json:"timeframe,omitempty"`
	PaymentDate     time.Time             `json:"payment_date,omitempty"`
	DateCreated     time.Time             `json:"date_created,omitempty"`
	DateUpdated     time.Time             `json:"date_updated,omitempty"`
}

type AnticipationSimulation

type AnticipationSimulation struct {
	Amount             int                   `json:"amount"`
	Fee                int                   `json:"fee"`
	FraudCoverageFee   int                   `json:"fraudCoverageFee"`
	AnticipationAmount int                   `json:"anticipationAmount"`
	AnticipationFee    int                   `json:"anticipationFee"`
	Timeframe          AnticipationTimeframe `json:"timeframe"`
	PaymentDate        time.Time             `json:"paymentDate"`
	StartIntervalDate  time.Time             `json:"startIntervalDate"`
	EndIntervalDate    time.Time             `json:"endIntervalDate"`
}

type AnticipationStatus

type AnticipationStatus string
const (
	AntStatusBuilding AnticipationStatus = "building"
	AntStatusPending  AnticipationStatus = "pending"
	AntStatusApproved AnticipationStatus = "approved"
	AntStatusRefused  AnticipationStatus = "refused"
	AntStatusCanceled AnticipationStatus = "canceled"
)

type AnticipationTimeframe

type AnticipationTimeframe string
const (
	AntTimeframeStart AnticipationTimeframe = "start"
	AntTimeframeEnd   AnticipationTimeframe = "end"
)

type AnticipationType

type AnticipationType string
const (
	AntTypeSpot AnticipationType = "spot"
)

type Balance

type Balance struct {
	Object       string       `json:"object"`
	WaitingFunds BalanceField `json:"waiting_funds"`
	Available    BalanceField `json:"available"`
	Transferred  BalanceField `json:"transferred"`
}

type BalanceField

type BalanceField struct {
	Amount int `json:"amount"`
}

type BalanceOperation

type BalanceOperation struct {
	Object           string                 `json:"object"`
	Id               int                    `json:"id"`
	Status           BalanceOperationStatus `json:"status"`
	BalanceAmount    int                    `json:"balance_amount"`
	BalanceOldAmount int                    `json:"balance_old_amount"`
	Type             BalanceOperationType   `json:"type"`
	Amount           int                    `json:"amount"`
	Fee              int                    `json:"fee"`
	DateCreated      time.Time              `json:"date_created"`
	MovementObject   interface{}            `json:"movement_object"`
}

type BalanceOperationStatus

type BalanceOperationStatus string
const (
	BalOpStatusWaitingFunds BalanceOperationStatus = "waiting_funds"
	BalOpStatusAvailable    BalanceOperationStatus = "available"
	BalOpStatusTransferred  BalanceOperationStatus = "transferred"
)

type BalanceOperationType

type BalanceOperationType string
const (
	BalOpTypePayable       BalanceOperationType = "payable"
	BalOpTypeRefund        BalanceOperationType = "refund"
	BalOpTypeAnticipation  BalanceOperationType = "anticipation"
	BalOpTypeTransfer      BalanceOperationType = "transfer"
	BalOpTypeFeeCollection BalanceOperationType = "fee_collection"
)

type BankAccount

type BankAccount struct {
	ID                 int32           `json:"id,omitempty"`
	BankAccountID      string          `json:"bank_account_id,omitempty"`
	BankCode           string          `json:"bank_code,omitempty"`
	Agencia            string          `json:"agencia,omitempty"`
	AgenciaDV          string          `json:"agencia_dv,omitempty"`
	Conta              string          `json:"conta,omitempty"`
	ContaDV            string          `json:"conta_dv,omitempty"`
	DocumentType       DocumentType    `json:"document_type,omitempty"`
	DocumentNumber     string          `json:"document_number,omitempty"`
	LegalName          string          `json:"legal_name,omitempty"`
	Type               BankAccountType `json:"type,omitempty"`
	ChargeTransferFees bool            `json:"charge_transfer_fees"`
	PixKey             string          `json:"pix_key,omitempty"`
	DateCreated        time.Time       `json:"date_created,omitempty"`
}

type BankAccountRecipient

type BankAccountRecipient struct {
	Object             string      `json:"object,omitempty"`
	ID                 int         `json:"id,omitempty"`
	BankCode           string      `json:"bank_code,omitempty"`
	Agencia            string      `json:"agencia,omitempty"`
	AgenciaDv          interface{} `json:"agencia_dv,omitempty"`
	Conta              string      `json:"conta,omitempty"`
	ContaDv            string      `json:"conta_dv,omitempty"`
	Type               string      `json:"type,omitempty"`
	DocumentType       string      `json:"document_type,omitempty"`
	DocumentNumber     string      `json:"document_number,omitempty"`
	LegalName          string      `json:"legal_name,omitempty"`
	ChargeTransferFees bool        `json:"charge_transfer_fees,omitempty"`
	DateCreated        time.Time   `json:"date_created,omitempty"`
}

BankAccountRecipient structure

type BankAccountType

type BankAccountType string
const (
	BnkAccContaCorrente         BankAccountType = "conta_corrente"
	BnkAccContaPoupanca         BankAccountType = "conta_poupanca"
	BnkAccContaCorrenteConjunta BankAccountType = "conta_corrente_conjunta"
	BnkAccContaPoupancaConjunta BankAccountType = "conta_poupanca_conjunta"
)

type Billing

type Billing struct {
	Address *Address `json:"address,omitempty" form:"address,omitempty"`
	Object  string   `json:"object,omitempty" form:"object,omitempty"`
	ID      int64    `json:"id,omitempty" form:"id,omitempty"`
	Name    string   `json:"name,omitempty" form:"name,omitempty"`
}

type BoletoRule

type BoletoRule string
const (
	RuleStrictExpirationDate BoletoRule = "strict_expiration_date"
	RuleNoStrict             BoletoRule = "no_strict"
)

type Card

type Card struct {
	Object         string    `json:"object,omitempty" form:"object,omitempty"`
	ID             string    `json:"id,omitempty" form:"id,omitempty"`
	DateCreated    time.Time `json:"date_created,omitempty" form:"date_created,omitempty"`
	DateUpdated    time.Time `json:"date_updated,omitempty" form:"date_updated,omitempty"`
	Brand          string    `json:"brand,omitempty" form:"brand,omitempty"`
	HolderName     string    `json:"holder_name,omitempty" form:"holder_name,omitempty"`
	FirstDigits    string    `json:"first_digits,omitempty" form:"first_digits,omitempty"`
	LastDigits     string    `json:"last_digits,omitempty" form:"last_digits,omitempty"`
	Country        string    `json:"country,omitempty" form:"country,omitempty"`
	Fingerprint    string    `json:"fingerprint,omitempty" form:"fingerprint,omitempty"`
	Valid          bool      `json:"valid,omitempty" form:"valid,omitempty"`
	ExpirationDate MMYY      `json:"expiration_date,omitempty" form:"expiration_date,omitempty"`
}

type CardHash

type CardHash struct {
	ID          int64      `json:"id,omitempty" form:"id,omitempty"`
	PublicKey   string     `json:"public_key,omitempty" form:"public_key,omitempty"`
	IP          string     `json:"ip,omitempty" form:"ip,omitempty"`
	DateCreated *time.Time `json:"date_created,omitempty" form:"date_created,omitempty"`
}

CardHash wraps the response from new card hash public key request

type CardHashData

type CardHashData struct {
	CardNumber         string `json:"card_number,omitempty" form:"card_number,omitempty"`
	CardHolderName     string `json:"card_holder_name,omitempty" form:"card_holder_name,omitempty"`
	CardExpirationDate MMYY   `json:"card_expiration_date,omitempty" form:"card_expiration_date,omitempty"`
	CardCvv            string `json:"card_cvv,omitempty" form:"card_cvv,omitempty"`
}

CardHashData contains the fields used to generate a card_hash

type Chargeback

type Chargeback struct {
	Object        string           `json:"object"`
	Id            string           `json:"id"`
	Installment   int              `json:"installment"`
	TransactionId int              `json:"transaction_id"`
	Amount        int              `json:"amount"`
	ReasonCode    string           `json:"reason_code"`
	CardBrand     string           `json:"card_brand"`
	DateCreated   time.Time        `json:"date_created"`
	DateUpdated   time.Time        `json:"date_updated"`
	AccrualDate   time.Time        `json:"accrual_date"`
	Status        ChargebackStatus `json:"status"`
	Cycle         int              `json:"cycle"`
}

type ChargebackStatus

type ChargebackStatus string
const (
	ChargebackStatusPresented   ChargebackStatus = "presented"
	ChargebackStatusRepresented ChargebackStatus = "represented"
)

type Config

type Config struct {
	Apikey        string
	Cryptokey     string
	SessionId     string // WARNING: testing purposes only
	Version       string
	Client        *http.Client
	Trace         bool
	SkipUnmarshal bool
	Logger        *zap.Logger

	HandleRateLimit  bool
	TimeoutRetry     time.Duration
	ExpBackOffParams *ExponentialBackoffParams
}

Config holds the config of pagarme

func Default

func Default(apikey, cryptokey string) *Config

Default configuration uses:

HTTP Client with 60 seconds timeout os.stdout for logging loglevel: error

func DefaultWithSession

func DefaultWithSession(sessionID string) *Config

DefaultWithSession configuration uses:

HTTP Client with 60 seconds timeout os.stdout for logging loglevel: error

func (*Config) Do

func (c *Config) Do(method, urlpart string, query url.Values, body io.Reader) (*http.Response, error)

type CountryCode

type CountryCode string
const (
	Brazil CountryCode = "br"
)

func (CountryCode) IsValid

func (cc CountryCode) IsValid() bool

type CreateAnticipation

type CreateAnticipation struct {
	PaymentDate       int64                 `json:"payment_date"`
	Timeframe         AnticipationTimeframe `json:"timeframe"`
	RequestedAmount   int                   `json:"requested_amount"`
	Build             bool                  `json:"build"`
	AutomaticTransfer bool                  `json:"automatic_transfer"`
}

type CreateRecipient

type CreateRecipient struct {
	TransferEnabled               bool                 `json:"transfer_enabled,omitempty"`
	TransferInterval              string               `json:"transfer_interval,omitempty"`
	TransferDay                   string               `json:"transfer_day,omitempty"`
	AutomaticAnticipationEnabled  bool                 `json:"automatic_anticipation_enabled,omitempty"`
	AnticipatableVolumePercentage int                  `json:"anticipatable_volume_percentage,omitempty"`
	BankAccID                     string               `json:"bank_account_id,omitempty"`
	BankAcc                       BankAccountRecipient `json:"bank_account,omitempty"`
	PostbackURL                   string               `json:"postback_url,omitempty"`
	RegisterInfo                  RegisterInformation  `json:"register_information,omitempty,omitempty"`
	Metadata                      interface{}          `json:"metadata,omitempty"`
}

CreateRecipient struct

type Customer

type Customer struct {
	Object       string       `json:"object,omitempty" form:"object,omitempty"`
	ID           int64        `json:"id,omitempty" form:"id,omitempty"`
	ExternalID   string       `json:"external_id,omitempty" form:"external_id,omitempty"`
	Type         CustomerType `json:"type" form:"type"`
	Name         string       `json:"name,omitempty" form:"name,omitempty"`
	Email        string       `json:"email,omitempty" form:"email,omitempty"`
	Country      CountryCode  `json:"country,omitempty" form:"country,omitempty"`
	Birthday     YYYYMMDD     `json:"birthday,omitempty" form:"birthday,omitempty"`
	Gender       string       `json:"gender,omitempty" form:"gender,omitempty"`
	Documents    []*Document  `json:"documents,omitempty" form:"documents,omitempty"`
	PhoneNumbers []string     `json:"phone_numbers,omitempty" form:"phone_numbers,omitempty"`
}

Customer TODO: godoc

type CustomerType

type CustomerType string
const (
	CustomerIndividual  CustomerType = "individual"
	CustomerCorporation CustomerType = "corporation"
)

type Document

type Document struct {
	Object string       `json:"object,omitempty" form:"object,omitempty"`
	ID     string       `json:"id,omitempty" form:"id,omitempty"`
	Type   DocumentType `json:"type,omitempty" form:"type,omitempty"`
	Number string       `json:"number,omitempty" form:"number,omitempty"`
}

Document TBD

type DocumentType

type DocumentType string
const (
	DocCPF      DocumentType = "cpf"
	DocCNPJ     DocumentType = "cnpj"
	DocPassport DocumentType = "passport"
	DocOther    DocumentType = "other"
)

type ExponentialBackoffParams

type ExponentialBackoffParams struct {
	MaxRetries   int
	IntervalBase time.Duration
}

type Float64String

type Float64String float64

func (*Float64String) MarshalJSON

func (n *Float64String) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Float64String) Scan

func (n *Float64String) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Float64String) UnmarshalJSON

func (n *Float64String) UnmarshalJSON(v []byte) error

UnmarshalJSON implements json.Unmarshaler

func (Float64String) Value

func (n Float64String) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Int64String

type Int64String int64

func (*Int64String) MarshalJSON

func (n *Int64String) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Int64String) Scan

func (n *Int64String) Scan(value interface{}) error

Scan implements the Scanner interface.

func (*Int64String) UnmarshalJSON

func (n *Int64String) UnmarshalJSON(v []byte) error

UnmarshalJSON implements json.Unmarshaler

func (Int64String) Value

func (n Int64String) Value() (driver.Value, error)

Value implements the driver Valuer interface.

type Item

type Item struct {
	ID        string `json:"id,omitempty" form:"id,omitempty"`
	Object    string `json:"object,omitempty" form:"object,omitempty"`
	Title     string `json:"title,omitempty" form:"title,omitempty"`
	UnitPrice int    `json:"unit_price,omitempty" form:"unit_price,omitempty"`
	Quantity  int    `json:"quantity,omitempty" form:"quantity,omitempty"`
	Category  string `json:"category,omitempty" form:"category,omitempty"`
	Tangible  bool   `json:"tangible,omitempty" form:"tangible,omitempty"`
	Venue     string `json:"venue,omitempty" form:"venue,omitempty"`
	Date      string `json:"date,omitempty" form:"date,omitempty"`
}

Item TODO: godoc

type Limit

type Limit struct {
	Amount          int `json:"amount,omitempty"`
	AnticipationFee int `json:"anticipation_fee,omitempty"`
	Fee             int `json:"fee,omitempty"`
}

type Limits

type Limits struct {
	Maximum Limit `json:"maximum,omitempty"`
	Minimum Limit `json:"minimum,omitempty"`
}

type LiquidationType

type LiquidationType string
const (
	LiqTypeInternal LiquidationType = "internal"
	LiqTypeExternal LiquidationType = "external"
)

type MMYY

type MMYY string

MMYY represents a two digit MM (month) and YY (last two digits of the year) combined

func (MMYY) Month

func (s MMYY) Month() time.Month

Month returns the month

func (MMYY) Year

func (s MMYY) Year(prefix ...string) int

Year returns the year

type ManagingPartners

type ManagingPartners struct {
	Type           string `json:"type,omitempty"`
	DocumentNumber string `json:"document_number,omitempty"`
	Email          string `json:"email,omitempty"`
	Name           string `json:"name,omitempty"`
}

ManagingPartners struct

type NCard

type NCard struct {
	CardHash       string `json:"card_hash,omitempty"`
	CardNumber     string `json:"card_number,omitempty"`
	HolderName     string `json:"card_holder_name,omitempty"`
	ExpirationDate string `json:"card_expiration_date,omitempty"`
	CVV            string `json:"card_cvv,omitempty"`
}

type NameValue

type NameValue struct {
	Name  string `json:"name"`
	Value string `json:"value"`
}

type Payable

type Payable struct {
	Object                   string        `json:"object"`
	ID                       int64         `json:"id"`
	Status                   PayableStatus `json:"status"`
	Amount                   int           `json:"amount"`
	Fee                      int           `json:"fee"`
	AnticipationFee          int           `json:"anticipation_fee"`
	FraudCoverageFee         int           `json:"fraud_coverage_fee"`
	Installment              int           `json:"installment"`
	TransactionID            int           `json:"transaction_id"`
	SplitRuleID              string        `json:"split_rule_id,omitempty"`
	BulkAnticipationID       string        `json:"bulk_anticipation_id,omitempty"`
	RecipientID              string        `json:"recipient_id,omitempty"`
	PaymentDate              time.Time     `json:"payment_date"`
	OriginalPaymentDate      time.Time     `json:"original_payment_date,omitempty"`
	Type                     PayableType   `json:"type"`
	PaymentMethod            PaymentMethod `json:"payment_method"`
	AccrualDate              time.Time     `json:"accrual_date,omitempty"`
	DateCreated              time.Time     `json:"date_created"`
	LiquidationArrangementID string        `json:"liquidation_arrangement_id,omitempty"`
}

Payable -> Objeto-resposta Recebível

Objeto contendo os dados de um recebível. O recebível (payable) é gerado automaticamente após uma transação ser paga. Para cada parcela de uma transação é gerado um recebível, que também pode ser dividido por recebedor (no caso de um split ter sido feito).

type PayableStatus

type PayableStatus string
const (
	PbsPaid         PayableStatus = "paid"
	PbsWaitingFunds PayableStatus = "waiting_funds"
)

type PayableType

type PayableType string
const (
	PtChargeback       PayableType = "chargeback"
	PtRefund           PayableType = "refund"
	PtChargebackRefund PayableType = "chargeback_refund"
	PtCredit           PayableType = "credit"
)

type PaymentMethod

type PaymentMethod string
const (
	PaymentCreditCard PaymentMethod = "credit_card"
	PaymentBoleto     PaymentMethod = "boleto"
	PaymentPix        PaymentMethod = "pix"
)

type Perror

type Perror struct {
	Message       string `json:"message,omitempty" form:"message,omitempty"`
	ParameterName string `json:"parameter_name,omitempty" form:"parameter_name,omitempty"`
	Type          string `json:"type,omitempty" form:"type,omitempty"`
}

type PhoneNumbers

type PhoneNumbers struct {
	Ddd    string `json:"ddd,omitempty"`
	Number string `json:"number,omitempty"`
	Type   string `json:"type,omitempty"`
}

PhoneNumbers struct

type PixData

type PixData struct {
	EndToEndId          string     `json:"end_to_end_id"`
	ExpirationDate      time.Time  `json:"expiration_date"`
	Payer               PixPayer   `json:"payer"`
	QrCode              string     `json:"qr_code"`
	RefundFailureDate   *time.Time `json:"refund_failure_date"`
	RefundFailureReason string     `json:"refund_failure_reason,omitempty"`
}

type PixPayer

type PixPayer struct {
	BankAccount  PixPayerBankAccount `json:"bank_account"`
	Name         string              `json:"name"`
	Document     string              `json:"document"`
	DocumentType string              `json:"document_type"`
}

type PixPayerBankAccount

type PixPayerBankAccount struct {
	AccountNumber string `json:"account_number"`
	BankName      string `json:"bank_name"`
	BranchCode    string `json:"branch_code"`
	Ispb          string `json:"ispb"`
}

type Querier

type Querier interface {
	Format() string
	PName() string
	PValue() string
}

type QueryBuilder

type QueryBuilder struct {
	// contains filtered or unexported fields
}

func (*QueryBuilder) Add

func (b *QueryBuilder) Add(q Querier)

Add a querier item

func (*QueryBuilder) Build

func (b *QueryBuilder) Build() string

Build the query

func (*QueryBuilder) Get

func (b *QueryBuilder) Get(name string) Querier

Get a querier item

func (*QueryBuilder) Set

func (b *QueryBuilder) Set(q Querier)

Set a querier item

func (*QueryBuilder) Values

func (b *QueryBuilder) Values() url.Values

type QueryInt

type QueryInt struct {
	Name string
	Op   QueryOp
	V    int
}

QueryInt is used on integer queries

func (*QueryInt) Format

func (qt *QueryInt) Format() string

Format to pagarme query

func (*QueryInt) PName

func (qt *QueryInt) PName() string

PName of the query param

func (*QueryInt) PValue

func (qt *QueryInt) PValue() string

type QueryOp

type QueryOp string

QueryOp is the operator of a query item

const (
	// QueryOpEquals =
	QueryOpEquals QueryOp = ""
	// QueryOpGreaterThan >
	QueryOpGreaterThan QueryOp = ">"
	// QueryOpLessThan <
	QueryOpLessThan QueryOp = "<"
	// QueryOpGreaterOrEqualThan >=
	QueryOpGreaterOrEqualThan QueryOp = ">="
	// QueryOpLessOrEqualThan <=
	QueryOpLessOrEqualThan QueryOp = "<="
)

type QueryString

type QueryString struct {
	Name string
	Op   QueryOp
	V    string
}

QueryString is used on string queries

func (*QueryString) Format

func (qt *QueryString) Format() string

Format to pagarme query

func (*QueryString) PName

func (qt *QueryString) PName() string

PName of the query param

func (*QueryString) PValue

func (qt *QueryString) PValue() string

PValue of the query param

type QueryTime

type QueryTime struct {
	Name string
	Op   QueryOp
	T    time.Time
}

QueryTime is used on datetime queries

func (*QueryTime) Format

func (qt *QueryTime) Format() string

Format to pagarme query

func (*QueryTime) PName

func (qt *QueryTime) PName() string

PName of the query param

func (*QueryTime) PValue

func (qt *QueryTime) PValue() string

PValue of the query param

type Recipient

type Recipient struct {
	Object                        string      `json:"object,omitempty"`
	ID                            string      `json:"id,omitempty"`
	TransferEnabled               bool        `json:"transfer_enabled,omitempty"`
	LastTransfer                  interface{} `json:"last_transfer,omitempty"`
	TransferInterval              string      `json:"transfer_interval,omitempty"`
	TransferDay                   int         `json:"transfer_day,omitempty"`
	AutomaticAnticipationEnabled  bool        `json:"automatic_anticipation_enabled,omitempty"`
	AnticipatableVolumePercentage int         `json:"anticipatable_volume_percentage,omitempty"`
	DateCreated                   time.Time   `json:"date_created,omitempty"`
	DateUpdated                   time.Time   `json:"date_updated,omitempty"`
	PostbackURL                   string      `json:"postback_url,omitempty"`
	Status                        string      `json:"status,omitempty"`
	StatusReason                  interface{} `json:"status_reason,omitempty"`
	Metadata                      interface{} `json:"metadata,omitempty"`
	Bank                          BankAccount `json:"bank_account,omitempty"`
}

Recipient structure to define recipient

type Refund

type Refund struct {
	Object               string         `json:"object"`
	Id                   string         `json:"id"`
	Amount               int            `json:"amount"`
	Fee                  int            `json:"fee"`
	FraudCoverageFee     int            `json:"fraud_coverage_fee"`
	Type                 string         `json:"type"`
	Status               RefundStatus   `json:"status"`
	ChargeFeeRecipientId string         `json:"charge_fee_recipient_id"`
	BankAccountId        int            `json:"bank_account_id"`
	TransactionId        int            `json:"transaction_id"`
	DateCreated          time.Time      `json:"date_created"`
	DateUpdated          time.Time      `json:"date_updated"`
	Metadata             map[string]any `json:"metadata"`
}

type RefundStatus

type RefundStatus string
const (
	RefundStatusRefunded      RefundStatus = "refunded"
	RefundStatusPendingRefund RefundStatus = "pending_refund"
)

type RegisterInformation

type RegisterInformation struct {
	Name           string             `json:"name,omitempty"`
	Type           string             `json:"type,omitempty"`
	DocumentNumber string             `json:"document_number,omitempty"`
	CompanyName    string             `json:"company_name,omitempty"`
	Email          string             `json:"email,omitempty"`
	SiteURL        string             `json:"site_url,omitempty"`
	PhoneNum       []PhoneNumbers     `json:"phone_numbers,omitempty"`
	ManagingPart   []ManagingPartners `json:"managing_partners,omitempty"`
}

RegisterInformation struct

type Response

type Response struct {
	HttpResponse *http.Response
	Code         ResponseCode `json:"code,omitempty" form:"code,omitempty"`
	Errors       []Perror     `json:"errors,omitempty" form:"errors,omitempty"`
	URL          string       `json:"url,omitempty" form:"url,omitempty"`
	Method       string       `json:"method,omitempty" form:"method,omitempty"`
}

func (*Response) String

func (r *Response) String() string

type ResponseCode

type ResponseCode int
const (
	// ResponseCodeOk 200 - Tudo ocorreu como deveria e sua requisição foi processada com sucesso.
	ResponseCodeOk ResponseCode = 200
	// ResponseCodeMissingParameter 400 - Algum parâmetro obrigatório não foi passado, ou os parâmetros passados não estão corretos.
	ResponseCodeMissingParameter ResponseCode = 400
	ResponseCodeAuthError        ResponseCode = 401
	ResponseCodeNotFound         ResponseCode = 404
	ResponseCodeInternalError    ResponseCode = 500
)

type Settlement

type Settlement struct {
	Id                       string            `json:"id"`
	Status                   SettlementStatus  `json:"status"`
	Amount                   string            `json:"amount"`
	Product                  SettlementProduct `json:"product"`
	CardBrand                string            `json:"card_brand,omitempty"`
	CompanyId                string            `json:"company_id"`
	PaymentDate              string            `json:"payment_date"`
	RecipientId              string            `json:"recipient_id"`
	DocumentType             string            `json:"document_type"`
	DocumentNumber           string            `json:"document_number"`
	ContractObligationId     string            `json:"contract_obligation_id,omitempty"`
	LiquidationArrangementId string            `json:"liquidation_arrangement_id"`
	LiquidationEngine        string            `json:"liquidation_engine,omitempty"`
	LiquidationType          LiquidationType   `json:"liquidation_type"`
	Ispb                     string            `json:"ispb"`
	TargetAccountIspb        string            `json:"target_account.ispb"`
}

type SettlementProduct

type SettlementProduct string
const (
	SettlProductBoleto SettlementProduct = "boleto"
	SettlProductCredit SettlementProduct = "credit"
)

type SettlementStatus

type SettlementStatus string
const (
	SettlStatusAwaitingResponse SettlementStatus = "awaiting_response"
	SettlStatusConfirmed        SettlementStatus = "confirmed"
	SettlStatusSuccess          SettlementStatus = "success"
)

type Shipping

type Shipping struct {
	Address      *Address `json:"address,omitempty" form:"address,omitempty"`
	Object       string   `json:"object,omitempty" form:"object,omitempty"`
	ID           int64    `json:"id,omitempty" form:"id,omitempty"`
	Name         string   `json:"name,omitempty" form:"name,omitempty"`
	Fee          int      `json:"fee" form:"fee"`
	DeliveryDate YYYYMMDD `json:"delivery_date,omitempty" form:"delivery_date,omitempty"`
	Expedited    bool     `json:"expedited,omitempty" form:"expedited,omitempty"`
}

type SplitRule

type SplitRule struct {
	Object              string        `json:"object,omitempty" form:"object,omitempty"`
	ID                  string        `json:"id,omitempty" form:"id,omitempty"`
	Liable              bool          `json:"liable" form:"liable"`
	ChargeProcessingFee bool          `json:"charge_processing_fee" form:"charge_processing_fee"`
	Percentage          Float64String `json:"percentage,omitempty" form:"percentage,omitempty"`
	Amount              Int64String   `json:"amount,omitempty" form:"amount,omitempty"`
	ChargeRemainder     bool          `json:"charge_remainder" form:"charge_remainder"`
	RecipientID         string        `json:"recipient_id" form:"recipient_id"`
	DateCreated         time.Time     `json:"date_created" form:"date_created"`
	DateUpdated         time.Time     `json:"date_updated" form:"date_updated"`
	BlockID             string        `json:"block_id" form:"block_id"`
}

SplitRule TBD

type TrStatus

type TrStatus string
const (
	TrProcessing     TrStatus = "processing"
	TrAuthorized     TrStatus = "authorized"
	TrPaid           TrStatus = "paid"
	TrRefunded       TrStatus = "refunded"
	TrWaitingPayment TrStatus = "waiting_payment"
	TrPendingRefund  TrStatus = "pending_refund"
	TrRefused        TrStatus = "refused"
)

type Transaction

type Transaction struct {
	ServiceRefererName   string                 `json:"service_referer_name" form:"service_referer_name"`
	Amount               int                    `json:"amount" form:"amount"`
	CardHash             string                 `json:"card_hash,omitempty" form:"card_hash,omitempty"`
	CardID               string                 `json:"card_id,omitempty" form:"card_id,omitempty"`
	CardHolderName       string                 `json:"card_holder_name,omitempty" form:"card_holder_name,omitempty"`
	CardExpirationDate   MMYY                   `json:"card_expiration_date,omitempty" form:"card_expiration_date,omitempty"`
	CardNumber           string                 `json:"card_number,omitempty" form:"card_number,omitempty"`
	CardCVV              string                 `json:"card_cvv,omitempty" form:"card_cvv,omitempty"`
	PaymentMethod        PaymentMethod          `json:"payment_method,omitempty" form:"payment_method,omitempty"`
	PostbackURL          string                 `json:"postback_url,omitempty" form:"postback_url,omitempty"`
	Async                bool                   `json:"async,omitempty" form:"async,omitempty"`
	Installments         int                    `json:"installments,omitempty" form:"installments,omitempty"`
	BoletoExpirationDate string                 `json:"boleto_expiration_date,omitempty" form:"boleto_expiration_date,omitempty"`
	SoftDescriptor       string                 `json:"soft_descriptor,omitempty" form:"soft_descriptor,omitempty"`
	Capture              string                 `json:"capture,omitempty" form:"capture,omitempty"`
	BoletoInstructions   string                 `json:"boleto_instructions,omitempty" form:"boleto_instructions,omitempty"`
	PixExpirationDate    string                 `json:"pix_expiration_date,omitempty" form:"pix_expiration_date,omitempty"`
	PixAdditionalFields  []NameValue            `json:"pix_additional_fields,omitempty" form:"pix_additional_fields,omitempty"`
	SplitRules           []*SplitRule           `json:"split_rules,omitempty" form:"split_rules,omitempty"`
	BoletoRules          []BoletoRule           `json:"boleto_rules,omitempty" form:"boleto_rules,omitempty"`
	Customer             *Customer              `json:"customer" form:"customer"`
	Billing              *Billing               `json:"billing" form:"billing"`
	Shipping             *Shipping              `json:"shipping" form:"shipping"`
	Items                []*Item                `json:"items,omitempty" form:"items,omitempty"`
	Metadata             map[string]interface{} `json:"metadata,omitempty" form:"metadata,omitempty"`
	Session              string                 `json:"session,omitempty" form:"session,omitempty"`
	LocalTime            *time.Time             `json:"local_time,omitempty" form:"local_time,omitempty"`
	ReferenceKey         string                 `json:"reference_key,omitempty" form:"reference_key,omitempty"`
	//
	// Data returned by pagar-me
	//
	Object               string         `json:"object,omitempty" form:"object,omitempty"`
	Status               TrStatus       `json:"status,omitempty" form:"status,omitempty"`
	RefuseReason         string         `json:"refuse_reason,omitempty" form:"refuse_reason,omitempty"`
	StatusReason         string         `json:"status_reason,omitempty" form:"status_reason,omitempty"`
	AcquirerResponseCode string         `json:"acquirer_response_code,omitempty" form:"acquirer_response_code,omitempty"`
	AcquirerName         string         `json:"acquirer_name,omitempty" form:"acquirer_name,omitempty"`
	AcquirerID           string         `json:"acquirer_id,omitempty" form:"acquirer_id,omitempty"`
	AuthorizationCode    string         `json:"authorization_code,omitempty" form:"authorization_code,omitempty"`
	TID                  int            `json:"tid,omitempty" form:"tid,omitempty"`
	NSU                  int            `json:"nsu,omitempty" form:"nsu,omitempty"`
	DateCreated          *time.Time     `json:"date_created,omitempty" form:"date_created,omitempty"`
	DateUpdated          *time.Time     `json:"date_updated,omitempty" form:"date_updated,omitempty"`
	AuthorizedAmount     int            `json:"authorized_amount,omitempty" form:"authorized_amount,omitempty"`
	PaidAmount           int            `json:"paid_amount,omitempty" form:"paid_amount,omitempty"`
	RefundedAmount       int            `json:"refunded_amount,omitempty" form:"refunded_amount,omitempty"`
	ID                   int64          `json:"id,omitempty" form:"id,omitempty"`
	Cost                 int            `json:"cost,omitempty" form:"cost,omitempty"`
	CardFirstDigits      string         `json:"card_first_digits,omitempty" form:"card_first_digits,omitempty"`
	CardLastDigits       string         `json:"card_last_digits,omitempty" form:"card_last_digits,omitempty"`
	CardBrand            string         `json:"card_brand,omitempty" form:"card_brand,omitempty"`
	Card                 *Card          `json:"card,omitempty" form:"card,omitempty"`
	CaptureMethod        string         `json:"capture_method,omitempty" form:"capture_method,omitempty"`
	CardPinMode          string         `json:"card_pin_mode,omitempty" form:"card_pin_mode,omitempty"`
	CardFundingSource    string         `json:"card_funding_source,omitempty" form:"card_funding_source,omitempty"`
	PixData              map[string]any `json:"pix_data,omitempty" form:"pix_data,omitempty"`
	PixQrCode            string         `json:"pix_qr_code,omitempty" form:"pix_qr_code,omitempty"`
	// card_magstripe_fallback
	AntifraudScore float64 `json:"antifraud_score,omitempty" form:"antifraud_score,omitempty"`
	BoletoURL      string  `json:"boleto_url,omitempty" form:"boleto_url,omitempty"`
	BoletoBarcode  string  `json:"boleto_barcode,omitempty" form:"boleto_barcode,omitempty"`
	Referer        string  `json:"referer,omitempty" form:"referer,omitempty"`
	IP             string  `json:"ip,omitempty" form:"ip,omitempty"`
	SubscriptionID string  `json:"subscription_id,omitempty" form:"subscription_id,omitempty"`
	// phone
	// address
	AntifraudMetadata map[string]interface{} `json:"antifraud_metadata,omitempty" form:"antifraud_metadata,omitempty"`
	// device
	// local_transaction_id
	// fraud_covered
	// order_id
	RiskLevel string `json:"risk_level,omitempty" form:"risk_level,omitempty"`
}

func (*Transaction) GetBoletoPdfUrl

func (t *Transaction) GetBoletoPdfUrl() string

func (*Transaction) GetPixData

func (t *Transaction) GetPixData() *PixData

type TransactionOperation

type TransactionOperation struct {
	Id                    string    `json:"id"`
	DateCreated           time.Time `json:"date_created"`
	DateUpdated           time.Time `json:"date_updated"`
	Status                string    `json:"status"`
	FailReason            string    `json:"fail_reason,omitempty"`
	Type                  string    `json:"type"`
	Rollbacked            bool      `json:"rollbacked"`
	Model                 string    `json:"model"`
	ModelId               string    `json:"model_id"`
	GroupId               string    `json:"group_id"`
	NextGroupId           string    `json:"next_group_id,omitempty"`
	RequestId             string    `json:"request_id"`
	StartedAt             int64     `json:"started_at"`
	EndedAt               int64     `json:"ended_at"`
	Processor             string    `json:"processor"`
	ProcessorResponseCode string    `json:"processor_response_code,omitempty"`
	Metadata              any       `json:"metadata"`
}

type Transfer

type Transfer struct {
	Object               string                 `json:"object,omitempty"`
	Id                   int                    `json:"id,omitempty"`
	Amount               int                    `json:"amount,omitempty"`
	Type                 TransferType           `json:"type,omitempty"`
	Status               TransferStatus         `json:"status,omitempty"`
	SourceType           string                 `json:"source_type,omitempty"`
	SourceId             string                 `json:"source_id,omitempty"`
	TargetType           string                 `json:"target_type,omitempty"`
	TargetId             string                 `json:"target_id,omitempty"`
	Fee                  int                    `json:"fee,omitempty"`
	FundingDate          time.Time              `json:"funding_date,omitempty"`
	FundingEstimatedDate time.Time              `json:"funding_estimated_date,omitempty"`
	TransactionId        int                    `json:"transaction_id,omitempty"`
	DateCreated          time.Time              `json:"date_created,omitempty"`
	DateUpdated          time.Time              `json:"date_updated,omitempty"`
	Metadata             map[string]interface{} `json:"metadata,omitempty"`
	BankAccount          BankAccount            `json:"bank_account"`
}

type TransferStatus

type TransferStatus string
const (
	TransferStatusPending     TransferStatus = "pending_transfer"
	TransferStatusTransferred TransferStatus = "transferred"
	TransferStatusFailed      TransferStatus = "failed"
	TransferStatusProcessing  TransferStatus = "processing"
	TransferStatusCanceled    TransferStatus = "canceled"
)

type TransferType

type TransferType string
const (
	TransferTypeTed            TransferType = "ted"
	TransferTypeDoc            TransferType = "doc"
	TransferTypeCreditoEmConta TransferType = "credito_em_conta"
)

type UnixMS

type UnixMS int64

func UnixMSFromTime

func UnixMSFromTime(t time.Time) UnixMS

type UpdateRecipient

type UpdateRecipient struct {
	TransferInterval               *string     `json:"transfer_interval,omitempty"`
	TransferDay                    *int        `json:"transfer_day,omitempty"`
	TransferEnabled                *bool       `json:"transfer_enabled,omitempty"`
	AnticipatableVolumePercentage  *int        `json:"anticipatable_volume_percentage,omitempty"`
	BankAccountId                  *string     `json:"bank_account_id,omitempty"`
	AutomaticAnticipationEnabled   *bool       `json:"automatic_anticipation_enabled,omitempty"`
	AutomaticAnticipationType      *string     `json:"automatic_anticipation_type,omitempty"`
	AutomaticAnticipationDays      *string     `json:"automatic_anticipation_days,omitempty"`
	AutomaticAnticipation1025Delay *string     `json:"automatic_anticipation_1025_delay,omitempty"`
	Metadata                       interface{} `json:"metadata,omitempty"`
}

UpdateRecipient struct

type YYYYMMDD

type YYYYMMDD string

func YYYYMMDDFromTime

func YYYYMMDDFromTime(t time.Time) YYYYMMDD

Jump to

Keyboard shortcuts

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