models

package
v1.0.0-beta.3 Latest Latest
Warning

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

Go to latest
Published: Apr 18, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Billing

type Billing struct {
	// Customer billing address
	Address string `json:"address,omitempty"`

	// Customer billing country alpha-2 code (ISO 3166-1)
	Country string `json:"country,omitempty"`

	// Customer billing state alpha code (ISO 3166-2)
	State string `json:"state,omitempty"`

	// Customer billing city
	City string `json:"city,omitempty"`

	// Customer billing postal code
	Zip string `json:"zip,omitempty"`

	// Customer billing phone
	Phone string `json:"phone,omitempty"`
}

func NewBilling

func NewBilling() Billing

Initialize model

type Card

type Card struct {
	// Card number or PAN
	Number string `json:"number,omitempty"`

	// Card security code
	Cvv2 string `json:"cvv2,omitempty"`

	// Card expire month date (MM)
	Expire_month int `json:"expire_month,omitempty"`

	// Card expire year date (YYYY)
	Expire_year int `json:"expire_year,omitempty"`

	// Cardholder name
	Cardholder string `json:"cardholder,omitempty"`
}

func NewCard

func NewCard() Card

Initialize model

func (Card) GetExpireFormat

func (c Card) GetExpireFormat() string

Get expire ISO format (YYMM)

type Item

type Item struct {
	// Item identifier code or UPC/EAN
	Code string `json:"code,omitempty"`

	// Item product title
	Title string `json:"title,omitempty"`

	// Item per unit price
	Price float64 `json:"price,omitempty"`

	// Item quantity
	Qty int `json:"qty,omitempty"`

	// Item tax amount per unit
	Tax float64 `json:"tax,omitempty"`

	// Item total value
	Total float64 `json:"total,omitempty"`
}

func NewItem

func NewItem() Item

Initialize model

func (*Item) Totalize

func (i *Item) Totalize()

Totalize item price by quantity

type Order

type Order struct {
	// Order ID
	Id string `json:"id,omitempty"`

	// Order currency code alpha-3
	Currency string `json:"currency,omitempty"`

	// Order total amount
	Amount float64 `json:"amount,omitempty"`

	// Order total tax amount
	Tax_amount float64 `json:"tax_amount,omitempty"`

	// Order total shipping amount
	Shipping_amount float64 `json:"shipping_amount,omitempty"`

	// Order summary of items or products
	Content []Item `json:"content,omitempty"`

	// Order extra properties
	Extras map[string]string `json:"extras,omitempty"`

	// Order note or aditional instructions
	Note string `json:"note,omitempty"`

	// Order calback webhook URL
	Callback_url string `json:"callback_url,omitempty"`

	// Order customer name
	Customer_name string `json:"customer_name,omitempty"`

	// Order customer email
	Customer_email string `json:"customer_email,omitempty"`
}

func NewOrder

func NewOrder() Order

Initialize model

func (*Order) AddExtra

func (o *Order) AddExtra(key string, value interface{})

Add extra property to order

func (*Order) AddItem

func (o *Order) AddItem(item Item)

Add item to content list of products/items

func (*Order) Totalize

func (o *Order) Totalize()

Totalize order amounts and items

type Settings

type Settings struct {
	// Merchant API auth key
	Auth_key string `json:"auth_key,omitempty"`

	// Merchant API auth hash (MD5 of secret key)
	Auth_hash string `json:"auth_hash,omitempty"`

	// Merchant API platform auth user (SHA-512 of user email)
	Auth_user string `json:"auth_user,omitempty"`

	// Merchant API endpoint URL
	Endpoint string `json:"endpoint,omitempty"`

	// Merchant API environment
	Environment string `json:"environment,omitempty"`

	// Settings response messages language
	Lang string `json:"lang,omitempty"`

	// SDK identifier
	Sdk string `json:"sdk,omitempty"`
}

func NewSettings

func NewSettings() Settings

Initialize service

func (*Settings) GetAuthHash

func (s *Settings) GetAuthHash() string

Getter for Auth_hash

func (*Settings) GetAuthKey

func (s *Settings) GetAuthKey() string

Getter for Auth_key

func (*Settings) GetAuthUser

func (s *Settings) GetAuthUser() string

Getter for Auth_user

func (*Settings) GetEnvironment

func (s *Settings) GetEnvironment() string

Getter for Environment

func (*Settings) SetupCredentials

func (s *Settings) SetupCredentials(key, hash string)

Setup API credentials

func (*Settings) SetupEndpoint

func (s *Settings) SetupEndpoint(endpoint string)

Setup API endpoint URL

func (*Settings) SetupEnvironment

func (s *Settings) SetupEnvironment(env string)

Setup API environment

func (*Settings) SetupLanguage

func (s *Settings) SetupLanguage(lang string)

Setup response messages language

func (*Settings) SetupPlatformUser

func (s *Settings) SetupPlatformUser(hash string)

Setup API platform user

func (*Settings) SetupSandbox

func (s *Settings) SetupSandbox()

Setup defaults to Sandbox credentials

Jump to

Keyboard shortcuts

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