omidpay

package module
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Sep 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	MissingParams error = errors.New("missing_parameters")
	MissingRefNum error = errors.New("missing_ref_num")
)

Functions

This section is empty.

Types

type Callback

type Callback struct {
	MID               string  `json:"MID"`
	State             string  `json:"State"`
	ResNum            string  `json:"ResNum"`
	RefNum            *string `json:"RefNum"`
	Language          string  `json:"language"`
	Token             string  `json:"token"`
	TraceNo           *string `json:"traceNo"`
	CustomerRefNum    *string `json:"CustomerRefNum"`
	RedirectUrl       *string `json:"redirectUrl"`
	CardHashPan       *string `json:"CardHashPan"`
	CardMaskPan       *string `json:"CardMaskPan"`
	TransactionAmount *int64  `json:"transactionAmount"`
	UserID            *string `json:"userId"`
	EmailAddress      *string `json:"emailAddress"`
	MobileNo          *string `json:"mobileNo"`
}

type Client

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

func NewClient

func NewClient(terminalID, terminalPassword string) *Client

func NewClientWithHttpProxy

func NewClientWithHttpProxy(terminalID, terminalPassword string, proxyURL string) (*Client, error)

func NewClientWithReverseProxy

func NewClientWithReverseProxy(proxyURL string, terminalID, terminalPassword string) *Client

func (*Client) GeneratePaymentToken

func (c *Client) GeneratePaymentToken(invoiceID string, amount float64, redirectURL string) (*TokenResponse, error)

func (*Client) HttpCallback

func (c *Client) HttpCallback(
	callback func(c *Callback, r *http.Request, w http.ResponseWriter),
	onError func(err error, r *http.Request, w http.ResponseWriter),
) func(w http.ResponseWriter, r *http.Request)

func (*Client) VerifyPayment

func (c *Client) VerifyPayment(token string, refNum string) (*VerifyResponse, error)

type TokenResponse

type TokenResponse struct {
	Result         string `json:"Result"`
	ExpirationDate int64  `json:"ExpirationDate"`
	Token          string `json:"Token"`
	ChannelID      string `json:"ChannelId"`
	UserID         string `json:"UserId"`
	ResultCode     int    `json:"ResultCode"`
}

func (*TokenResponse) HttpWriteSampleRedirectForm

func (t *TokenResponse) HttpWriteSampleRedirectForm(rw io.Writer) error

type VerifyResponse

type VerifyResponse struct {
	Result     string `json:"Result"`
	Amount     int64  `json:"Amount"`
	RefNum     string `json:"RefNum"`
	HashedPan  string `json:"HashedPan"`
	ResultCode int    `json:"ResultCode"`
}

Jump to

Keyboard shortcuts

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