responses

package
v0.0.0-...-9528e98 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2021 License: MIT Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Currency = map[string]string{
	"USD": "$",
}
View Source
var StringToState = map[string]State{
	"STARTED":   STARTED,
	"PAID":      PAID,
	"REFUNDED":  REFUNDED,
	"CANCELLED": CANCELLED,
	"ERRORED":   ERRORED,
}

Functions

This section is empty.

Types

type ApiKeys

type ApiKeys struct {
	Token         string    `json:"token"`
	ClientID      string    `json:"client_id"`
	PrivateApiKey string    `json:"pvt_api_key"`
	CreatedAt     time.Time `json:"created_at"`
	UpdatedAt     time.Time `json:"updated_at"`
}

type Auth

type Auth struct {
	ClientID  string    `json:"client_id"`
	Token     string    `json:"token"`
	Email     string    `json:"email"`
	CreatedAt time.Time `json:"created_at"`
	UpdatedAt time.Time `json:"updated_at"`
}

type Cart

type Cart struct {
	Token string `json:"token,omitempty"`

	RequestID string `json:"request_id,omitempty"`

	// Indicates the e-commerce platform or
	// personal website from where the customer
	// and order originates from. For example
	// Shopify, Wordpress, Magento, Custom.
	//
	// The value provided is trimmed and lowered
	Source string `json:"source,omitempty"`

	// This is the external order id or cart id to
	// be associated with this payment. Is useful
	// to reconcile payments with an external source
	// or CMS
	OrderReference string `json:"order_reference,omitempty"`

	// This is the URL to redirect the customer to after
	// they have completed the payment. This can be a
	// success page, order confirmation page or thank you
	// page.
	CompleteURL string `json:"complete_url,omitempty"`

	// This is the URL to redirect the customer to after
	// they cancel the payment or leave it abandoned. This
	// is usually the cart url so they can go back to your
	// site and complete the payment using a different
	// payment method
	CancelURL string `json:"cancel_url,omitempty"`
}

type Event

type Event struct {
	Token            string        `json:"token,omitempty"`
	ClientID         string        `json:"client_id"`
	Type             string        `json:"type,omitempty"`
	Status           string        `json:"status,omitempty"`
	Endpoint         string        `json:"endpoint,omitempty"`
	Data             *Notification `json:"data,omitempty"`
	DeliveryAttempts int           `json:"delivery_attempts,omitempty"`
	Resource         string        `json:"resource,omitempty"`
	ResourcePath     string        `json:"resource_path,omitempty"`
	NextAttemptAt    time.Time     `json:"next_attempt_at,omitempty"`
	CreatedAt        time.Time     `json:"created_at,omitempty"`
	UpdatedAt        time.Time     `json:"updated_at,omitempty"`
}

type Merchant

type Merchant struct {
	ClientID         string    `json:"client_id"`
	RegisteredName   string    `json:"registered_name"`
	WebsiteURL       string    `json:"website_url"`
	TwitterURL       string    `json:"twitter_url"`
	InstagramURL     string    `json:"instagram_url"`
	ProfileImgURL    string    `json:"profile_img_url"`
	BackgroundImgURL string    `json:"background_img_url"`
	ApiKeys          *ApiKeys  `json:"-"`
	CreatedAt        time.Time `json:"created_at"`
	UpdatedAt        time.Time `json:"updated_at"`
}

Merchant internal definition

type MerchantSlice

type MerchantSlice []*Merchant

MerchantSlice is a convenient collection

type Metadata

type Metadata struct {
	Limit  int   `json:"limit,omitempty"`
	Offset int   `json:"offset"`
	Count  int64 `json:"count,omitempty"`
}

type Notification

type Notification struct {
	Token        string          `json:"token,omitempty"`
	EventID      string          `json:"event_id,omitempty"`
	Notification json.RawMessage `json:"notification,omitempty"`
	Resource     string          `json:"resource,omitempty"`
	ResourcePath string          `json:"resource_path,omitempty"`
	CreatedAt    time.Time       `json:"created_at,omitempty"`
	UpdatedAt    time.Time       `json:"updated_at,omitempty"`
}

type Order

type Order struct {
	Token         string         `json:"token"`
	ClientID      string         `json:"merchant"`
	Address       string         `json:"address"`
	Reference     string         `json:"reference"`
	ChainID       types.ChainID  `json:"chain_id"`
	State         State          `json:"state"`
	Cart          *Cart          `json:"cart,omitempty"`
	PurchaseTotal *PurchaseTotal `json:"purchase_total,omitempty"`
	CreatedAt     time.Time      `json:"created_at"`
	UpdatedAt     time.Time      `json:"updated_at"`
}

type OrderSlice

type OrderSlice []*Order

type PasswordReset

type PasswordReset struct {
	Token              string    `json:"token"`
	ClientID           string    `json:"client_id"`
	Email              string    `json:"email"`
	ResetToken         string    `json:"-"`
	ResetTokenUsed     bool      `json:"-"`
	ResetTokenCreated  time.Time `json:"-"`
	ResetTokenValidity time.Time `json:"-"`
	CreatedAt          time.Time `json:"created_at"`
	UpdatedAt          time.Time `json:"updated_at"`
}

type PasswordResetSlice

type PasswordResetSlice []*PasswordReset

type Payment

type Payment struct {
	Token        string    `json:"payment_id"`
	RequestID    string    `json:"request_id"`
	ChainID      uint      `json:"chain_id"`
	State        string    `json:"state"`
	IsETH        bool      `json:"is_eth"`
	TxnHash      string    `json:"txn_hash"`
	From         string    `json:"from"`
	Amount       string    `json:"amount"`
	TokenAddress string    `json:"token_address"`
	Rate         string    `json:"rate"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type PaymentNotification

type PaymentNotification struct {
	Token          string `json:"token"`
	NotificationID string `json:"notification_id"`
	RequestID      string `json:"request_id"`
	PaymentID      string `json:"payment_id"`
	ChainID        uint   `json:"chain_id"`
	State          string `json:"state"`
	IsETH          bool   `json:"is_eth"`
	TxnHash        string `json:"txn_hash"`
	From           string `json:"from"`
	Amount         string `json:"amount"`
	TokenAddress   string `json:"token_address"`
	Rate           string `json:"rate"`
}

type PaymentSlice

type PaymentSlice []*Payment

type PriceMoney

type PriceMoney struct {

	// The amount of money, in the smallest denomination of the currency
	// indicated by currency. For example, when currency is USD,
	// amount is in cents. Monetary amounts can be positive or negative.
	// See the specific field description to determine the meaning
	// of the sign in a particular case.
	Amount int64 `json:"amount"`

	// The type of currency, in ISO 4217 format.
	// For example, the currency code for US dollars is USD.
	Currency string `json:"currency"`
}

Money fields can be signed or unsigned. Fields that do not explicitly define whether they are signed or unsigned are considered unsigned and can only hold positive amounts. For signed fields, the sign of the value indicates the purpose of the money transfer. See Working with Monetary Amounts for more information.

type PriceMoneySlice

type PriceMoneySlice []*PriceMoney

type PurchaseTotal

type PurchaseTotal struct {
	Token string `json:"token,omitempty"`

	RequestID string `json:"request_id,omitempty"`

	Discount *PriceMoney `json:"discount"`

	SubTotal *PriceMoney `json:"sub_total"`

	TaxTotal *PriceMoney `json:"tax_total"`

	GrandTotal *PriceMoney `json:"grand_total"`
}

type Refund

type Refund struct {
	Token        string    `json:"refund_id"`
	RequestID    string    `json:"request_id"`
	PaymentID    string    `json:"payment_id"`
	ChainID      uint      `json:"chain_id"`
	IsETH        bool      `json:"is_eth"`
	TxnHash      string    `json:"txn_hash"`
	From         string    `json:"from"`
	To           string    `json:"to"`
	Amount       string    `json:"amount"`
	TokenAddress string    `json:"token_address"`
	CreatedAt    time.Time `json:"created_at"`
	UpdatedAt    time.Time `json:"updated_at"`
}

type RefundNotification

type RefundNotification struct {
	Token          string `json:"token"`
	NotificationID string `json:"notification_id"`
	RequestID      string `json:"request_id"`
	PaymentID      string `json:"payment_id"`
	RefundID       string `json:"refund_id"`
	ChainID        uint   `json:"chain_id"`
	IsETH          bool   `json:"is_eth"`
	TxnHash        string `json:"txn_hash"`
	From           string `json:"from"`
	To             string `json:"to"`
	Amount         string `json:"amount"`
	TokenAddress   string `json:"token_address"`
}

type RefundSlice

type RefundSlice []*Refund

type Response

type Response struct {
	HTTPStatus int             `json:"-"`
	Data       json.RawMessage `json:"data,omitempty"`
	Metadata   *Metadata       `json:"metadata,omitempty"`
	Error      *errors.Error   `json:"error,omitempty"`
}

func (Response) DoesError

func (r Response) DoesError() bool

DoesError returns whether we do not have an error

func (Response) GetErrors

func (r Response) GetErrors() error

GetErrors returns the error

type State

type State string
const CANCELLED State = "CANCELLED"
const ERRORED State = "ERRORED"
const REFUNDED State = "REFUNDED"
const STARTED State = "STARTED"

type WrappedMerchant

type WrappedMerchant struct {
	ApiKey   *ApiKeys  `json:"api_key"`
	Merchant *Merchant `json:"merchant"`
}

type WrappedRequest

type WrappedRequest struct {
	Merchant *Merchant `json:"merchant"`
	Request  *Request  `json:"request"`
}

type WrappedRequestSlice

type WrappedRequestSlice []*WrappedRequest

Jump to

Keyboard shortcuts

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