litepay

package
v0.1.12 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackSpectrocoin

type CallbackSpectrocoin struct {
	MerchantID      int     `json:"merchantId" form:"merchantId"`
	ApiID           int     `json:"apiId" form:"apiId"`
	UserID          string  `json:"userId" form:"userId"`
	MerchantApiID   string  `json:"merchantApiId" form:"merchantApiId"`
	OrderID         string  `json:"orderId" form:"orderId"`
	PayCurrency     string  `json:"payCurrency" form:"payCurrency"`
	PayAmount       float64 `json:"payAmount" form:"payAmount"`
	ReceiveCurrency string  `json:"receiveCurrency" form:"receiveCurrency"`
	ReceiveAmount   float64 `json:"receiveAmount" form:"receiveAmount"`
	ReceivedAmount  int     `json:"receivedAmount" form:"receivedAmount"`
	Description     string  `json:"description" form:"description"`
	OrderRequestID  int     `json:"orderRequestId" form:"orderRequestId"`
	Status          int     `json:"status" form:"status"`
	Sign            string  `json:"sign" form:"sign"`
}

type Cart

type Cart struct {
	ID       string `json:"id"`
	Currency string `json:"currency"`
	Items    []Item `json:"items"`
}

type Cfg

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

func New

func New(callbackURL, successURL, cancelURL string) Cfg

func (Cfg) Paypal added in v0.1.7

func (c Cfg) Paypal(clientID, secretKey string) LitePay

func (Cfg) Spectrocoin

func (c Cfg) Spectrocoin(merchantID, projectID, privateKey string) LitePay

func (Cfg) Stripe

func (c Cfg) Stripe(apiToken string) LitePay

type Coin

type Coin struct {
	AmountTotal float64 `json:"amount_total"`
	Currency    string  `json:"currency"`
}

type Item

type Item struct {
	PriceData Price `json:"price"`
	Quantity  int   `json:"quantity"`
}

type LitePay

type LitePay interface {
	Pay(cart Cart) (*Payment, error)
	Checkout(payment *Payment, session string) (*Payment, error)
}

type Payment

type Payment struct {
	PaymentSystem PaymentSystem `json:"provider"`
	MerchantID    string        `json:"merchant_id"`
	CartID        string        `json:"cart_id"`
	AmountTotal   int           `json:"amount_total"`
	Currency      string        `json:"currency"`
	Status        Status        `json:"status"`
	URL           string        `json:"url,omitempty"`
	Coin          *Coin         `json:"coin,omitempty"`
}

func (Payment) Validate

func (v Payment) Validate() error

Validate is ...

type PaymentSystem

type PaymentSystem string
const (
	STRIPE      PaymentSystem = "stripe"
	PAYPAL      PaymentSystem = "paypal"
	SPECTROCOIN PaymentSystem = "spectrocoin"
)

type Price

type Price struct {
	UnitAmount int     `json:"init_amount"`
	Product    Product `json:"product"`
}

type Product

type Product struct {
	Name        string   `json:"name"`
	Description string   `json:"description,omitempty"`
	Images      []string `json:"images"`
}

type Status

type Status string
const (
	NEW       Status = "new"
	UNPAID    Status = "unpaid"
	CANCELED  Status = "canceled"
	FAILED    Status = "failed"
	PROCESSED Status = "processed"
	TEST      Status = "test"
)

func StatusPayment

func StatusPayment(system PaymentSystem, status string) Status

StatusPayment is ...

Jump to

Keyboard shortcuts

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