checkout

package
v0.0.0-...-7e0fd1e Latest Latest
Warning

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

Go to latest
Published: May 5, 2019 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateHMAC

func GenerateHMAC(secret string, data string) (string, error)

GenerateHMAC generates HMAC SHA-256 hash

Types

type Address

type Address struct {
	StreetAddress string `json:"streetAddress"` // m
	PostalCode    string `json:"postalCode"`    // m
	City          string `json:"city"`          // m
	County        string `json:"county"`
	Country       string `json:"country"` // m
}

Address represents ...

type CallbackURL

type CallbackURL struct {
	Success string `json:"success"` // m
	Cancel  string `json:"cancel"`  // m
}

CallbackURL represents ...

type Client

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

Client represents an API client

func New

func New(merchantID, secretKey string) *Client

New creates ands returns a new client configured with the specified merchant account

func (*Client) CreatePayment

func (c *Client) CreatePayment(p *Payment) (*PaymentResponse, error)

CreatePayment performs a POST request ...

type Commission

type Commission struct {
	Merchant string `json:"merchant"` // m
	Amount   int    `json:"amount"`   // m
}

Commission represents ...

type Customer

type Customer struct {
	Email     string `json:"email"` // m
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
	Phone     string `json:"phone"`
	VatID     string `json:"vatId"`
}

Customer represents ...

type Item

type Item struct {
	UnitPrice     int         `json:"unitPrice"`     // m
	Units         int         `json:"units"`         // m
	VatPercentage int         `json:"vatPercentage"` // m
	ProductCode   string      `json:"productCode"`   // m
	DeliveryDate  string      `json:"deliveryDate"`  // m
	Description   string      `json:"description"`
	Category      string      `json:"category"`
	Stamp         string      `json:"stamp"`
	Reference     string      `json:"reference"`            // m for shop-in-shop
	Merchant      string      `json:"merchant,omitempty"`   // only for shop-in-shop
	Commission    *Commission `json:"commission,omitempty"` // only for shop-in-shop, pointer until omitempty works with structs
}

Item represents ...

type Parameter

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

Parameter represents ...

type Payment

type Payment struct {
	Stamp            string      `json:"stamp"`     // m
	Reference        string      `json:"reference"` // m
	Amount           int         `json:"amount"`    // m
	Currency         string      `json:"currency"`  // m, EUR
	Language         string      `json:"language"`  // m, FI/SV/EN
	Items            []Item      `json:"items"`     // m
	Customer         Customer    `json:"customer"`  // m
	DeliveryAddress  Address     `json:"deliveryAddress"`
	InvoicingAddress Address     `json:"invoicingAddress"`
	RedirectUrls     CallbackURL `json:"redirectUrls"` // m
	CallbackUrls     CallbackURL `json:"callbackUrls"`
}

Payment represents ...

func (*Payment) AddItem

func (p *Payment) AddItem(item Item)

AddItem ...

type PaymentResponse

type PaymentResponse struct {
	TransactionID string     `json:"transactionId"`
	Href          string     `json:"href"`
	Providers     []Provider `json:"providers"`
}

PaymentResponse represents ...

type Provider

type Provider struct {
	URL        string      `json:"url"`
	Icon       string      `json:"icon"`
	Svg        string      `json:"svg"`
	Name       string      `json:"name"`
	Group      string      `json:"group"`
	ID         string      `json:"id"`
	Parameters []Parameter `json:"parameters"`
}

Provider represents ...

Jump to

Keyboard shortcuts

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