superlink

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2020 License: MIT Imports: 5 Imported by: 2

README

A unnoficial SDK for the Cielo (brazilian card operator) Super Link API (API for creation of payment links).

Warning: Again, it is far from and official SDK. I can delete this repository at any moment.

The official documentation of the API can be found here: https://developercielo.github.io/manual/linkdepagamentos5

License

MIT

Documentation

Index

Constants

View Source
const (
	TypeAsset     = "Asset"
	TypeDigital   = "Digital"
	TypeService   = "Service"
	TypePayment   = "Payment"
	TypeRecurrent = "Recurrent"
)
View Source
const (
	ShippingTypeCorreios              = "Correios"
	ShippingFixedPrice                = "FixedAmount"
	ShippingFree                      = "Free"
	ShippingTypeWithoutShippingPickUp = "WithoutShippingPickUp"
	ShippingTypeWithoutShipping       = "WithoutShipping"
)
View Source
const (
	IntervalMonthly    = "Monthly"
	IntervalBimonthly  = "Bimonthly"
	IntervalQuarterly  = "Quarterly"
	IntervalSemiAnnual = "SemiAnnual"
	IntervalAnnual     = "Annual"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	AccessToken string
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseurl, clientid, clientsecret string) *Client
func (c *Client) CreateLink(link Link) (result LinkCreated, err error)
func (c *Client) DeleteLink(id string) error

func (*Client) SetDebug

func (c *Client) SetDebug(d bool) *Client
type Link struct {
	Name                    string `json:"name,omitempty"`
	Description             string `json:"description,omitempty"`
	ShowDescription         bool   `json:"showDescription,omitempty"`
	Price                   int    `json:"price,omitempty"`
	ExpirationDate          string `json:"expirationDate,omitempty"`
	Weight                  int    `json:"weight,omitempty"`
	SoftDescriptor          string `json:"softDescriptor,omitempty"`
	MaxNumberOfInstallments string `json:"maxNumberOfInstallments,omitempty"`
	Type                    string `json:"type,omitempty"`

	Shipping   Shipping   `json:"shipping,omitempty"`
	Recurrency Recurrency `json:"recurrent,omitempty"`

	// Non documented fields
	Quantity int    `json:"quantity,omitempty"`
	Sku      string `json:"sku,omitempty"`
}

type LinkCreated

type LinkCreated struct {
	Link
	ID       string `json:"id,omitempty"`
	ShortURL string `json:"shortUrl,omitempty"`
	Links    []struct {
		Method string `json:"method,omitempty"`
		Rel    string `json:"rel,omitempty"`
		HRef   string `json:"rel,omitempty"`
	} `json:"links,omitempty"`
}

type Recurrency

type Recurrency struct {
	Interval string `json:"interval,omitempty"`
	EndDate  string `json:"endDate,omitempty"`
}

type Shipping

type Shipping struct {
	Name          string `json:"name,omitempty"`
	Price         string `json:"price,omitempty"`
	OriginZipCode string `json:"originZipCode,omitempty"`
	Type          string `json:"type,omitempty"`
}

Jump to

Keyboard shortcuts

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