cielo

package module
v0.0.0-...-3265fa8 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2016 License: MIT Imports: 4 Imported by: 0

README

go-cielo

Golang package to communicate with Cielo 3.0 API

Documentation

Overview

Package cielo is used to communicate with Cielo API

Index

Constants

View Source
const (
	// MonthlyInterval configures recurrent payment interval to Montly
	MonthlyInterval = recurrentInterval("Monthly")
	// BimonthlyInterval configures recurrent payment interval to Bimonthly
	BimonthlyInterval = recurrentInterval("Bimonthly")
	// QuarterlyInterval configures recurrent payment interval to Quarterly
	QuarterlyInterval = recurrentInterval("Quarterly")
	// SemiAnnualInterval configures recurrent payment interval to SemiAnnual
	SemiAnnualInterval = recurrentInterval("SemiAnnual")
	// AnnualInterval configures recurrent payment interval to Annual
	AnnualInterval = recurrentInterval("Annual")

	// BradescoProvider is the Bradesco payment provider
	BradescoProvider = paymentProvider("Bradesco")
	// BancoDoBrasilProvider is the Banco do Brasil payment provider
	BancoDoBrasilProvider = paymentProvider("BancoDoBrasil")
	// SimuladoProvider is the Simulated payment provider
	SimuladoProvider = paymentProvider("Simulado")

	// CreditCardPayment is used to set payment method to Credit Card
	CreditCardPayment = paymentType("CreditCard")
	// DebitCardPayment is used to set payment method to Debit Card
	DebitCardPayment = paymentType("DebitCard")
	// ElectronicTransferPayment is used to set payment method to Electronic Transfer
	ElectronicTransferPayment = paymentType("ElectronicTransfer")
	// BoletoPayment is used to set payment method to Boleto
	BoletoPayment = paymentType("Boleto")

	// CurrencyBRL set current to Brazilian Real
	CurrencyBRL = currency("BRL")
	// CurrencyUSD set current to USA Dollar
	CurrencyUSD = currency("USD")
	// CurrencyMXN set current to Mexican Peso
	CurrencyMXN = currency("MXN")
	// CurrencyCOP set current to Colombian Peso
	CurrencyCOP = currency("COP")
	// CurrencyCLP set current to Chilean Peso
	CurrencyCLP = currency("CLP")
	// CurrencyARS set current to Argentine Peso
	CurrencyARS = currency("ARS")
	// CurrencyPEN set current to Peruvian Sol
	CurrencyPEN = currency("PEN")
	// CurrencyEUR set current to Euro
	CurrencyEUR = currency("EUR")
	// CurrencyPYN set current to PYN
	CurrencyPYN = currency("PYN")
	// CurrencyUYU set current to Uruguayan Peso
	CurrencyUYU = currency("UYU")
	// CurrencyVEB set current to Venezuelan Bolivar
	CurrencyVEB = currency("VEB")
	// CurrencyVEF set current to Venezuelan Bolivar
	CurrencyVEF = currency("VEF")
	// CurrencyGBP set current to British Pound
	CurrencyGBP = currency("GBP")
)

Variables

View Source
var (
	// ProductionEnvironment sets the environment to production
	ProductionEnvironment = environment{
		APIURL:      "https://api.cieloecommerce.cielo.com.br/",
		APIQueryURL: "https://apiquery.cieloecommerce.cielo.com.br/",
	}
	// SandboxEnvironment sets the environment to sandbox
	SandboxEnvironment = environment{
		APIURL:      "https://apisandbox.cieloecommerce.cielo.com.br/",
		APIQueryURL: "https://apiquerysandbox.cieloecommerce.cielo.com.br/",
	}
)

Functions

This section is empty.

Types

type Address

type Address struct {
	Street     string `json:",omitempty"`
	Number     string `json:",omitempty"`
	Complement string `json:",omitempty"`
	ZipCode    string `json:",omitempty"`
	City       string `json:",omitempty"`
	State      string `json:",omitempty"`
	Country    string `json:",omitempty"`
}

Address is used to set customer address

type CreditCard

type CreditCard struct {
	CardNumber     string `json:",omitempty"`
	Holder         string `json:",omitempty"`
	ExpirationDate string `json:",omitempty"`
	SecurityCode   string `json:",omitempty"`
	SaveCard       bool   `json:",omitempty"`
	Brand          string `json:",omitempty"`
	CardToken      string `json:",omitempty"`
}

CreditCard holds credit card informations

type Customer

type Customer struct {
	Name            string   `json:",omitempty"`
	Email           string   `json:",omitempty"`
	BirthDate       string   `json:",omitempty"`
	Identity        string   `json:",omitempty"`
	IdentityType    string   `json:",omitempty"`
	Address         *Address `json:",omitempty"`
	DeliveryAddress *Address `json:",omitempty"`
}

Customer handle information about buyer

type Ecommerce

type Ecommerce interface {
	CreateSale(sale Sale) (Sale, error)
}

Ecommerce is the interface used to communicate with Cielo v3 API

func NewEcommerce

func NewEcommerce(m Merchant, env environment) Ecommerce

NewEcommerce create a Cielo v3 API client

type Merchant

type Merchant struct {
	ID, Key string
}

Merchant identification on Cielo

type Payment

type Payment struct {
	ServiceTaxAmount    uint32            `json:",omitempty"`
	Installments        uint32            `json:",omitempty"`
	Interest            interface{}       `json:",omitempty"`
	Capture             bool              `json:",omitempty"`
	Authenticate        bool              `json:",omitempty"`
	Recurrent           bool              `json:",omitempty"`
	RecurrentPayment    *RecurrentPayment `json:",omitempty"`
	CreditCard          *CreditCard       `json:",omitempty"`
	Tid                 string            `json:",omitempty"`
	ProofOfSale         string            `json:",omitempty"`
	AuthorizationCode   string            `json:",omitempty"`
	SoftDescriptor      string            `json:",omitempty"`
	ReturnURL           string            `json:",omitempty"`
	Provider            paymentProvider   `json:",omitempty"`
	PaymentID           string            `json:",omitempty"`
	Type                paymentType       `json:",omitempty"`
	Amount              uint32            `json:",omitempty"`
	ReceiveDate         string            `json:",omitempty"`
	CapturedAmount      uint32            `json:",omitempty"`
	CapturedDate        string            `json:",omitempty"`
	Currency            currency          `json:",omitempty"`
	Country             string            `json:",omitempty"`
	ReturnCode          string            `json:",omitempty"`
	ReturnMessage       string            `json:",omitempty"`
	Status              uint32            `json:",omitempty"`
	Links               []interface{}     `json:",omitempty"`
	ExtraDataCollection []interface{}     `json:",omitempty"`
	ExpirationDate      string            `json:",omitempty"`
	URL                 string            `json:",omitempty"`
	Number              string            `json:",omitempty"`
	BarCodeNumber       string            `json:",omitempty"`
	DigitableLine       string            `json:",omitempty"`
	Address             string            `json:",omitempty"`
}

Payment represents a payment on Cielo

type RecurrentPayment

type RecurrentPayment struct {
	AuthorizeNow bool              `json:",omitempty"`
	EndDate      string            `json:",omitempty"`
	Interval     recurrentInterval `json:",omitempty"`
}

RecurrentPayment is used to configure recurrent payments

type Sale

type Sale struct {
	MerchantOrderID string    `json:",omitempty"`
	Customer        *Customer `json:",omitempty"`
	Payment         *Payment  `json:",omitempty"`
}

Sale is used to create a sale request

Jump to

Keyboard shortcuts

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