Documentation
¶
Index ¶
Constants ¶
View Source
const ( PAY_HOST = "https://pay.ir" PAYMENT_ENDPOINT = "/pg/send" VERIFY_ENDPOINT = "/pg/verify" )
View Source
const API_VERSION = "1"
Variables ¶
This section is empty.
Functions ¶
func DefaultCallback ¶
func DefaultCallback(actionFunc CallBackFunc) http.HandlerFunc
DefaultCallback is default callback for http server handler, example :
http.Handle("/callback", pay.DefaultCallback(callback)) http.ListenAndServe(":8080", nil)
Types ¶
type CallBackFunc ¶
CallBackFunc is a function for create call back action
type ErrorResponse ¶
type Pay ¶
type Pay struct {
// contains filtered or unexported fields
}
func (*Pay) CreateTransaction ¶
func (p *Pay) CreateTransaction(ctx context.Context, req *PaymentRequest) (*PaymentResponse, error)
CreateTransaction create new transaction and return status and token
func (*Pay) VerifyTransaction ¶
func (p *Pay) VerifyTransaction(ctx context.Context, req *VerifyRequest) (*VerifyResponse, error)
VerifyTransaction payment transaction via token
type PaymentRequest ¶
type PaymentRequest struct { Amount uint `json:"amount" validate:"required,min=10000"` Redirect string `json:"redirect" validate:"required,url"` Mobile string `json:"mobile,omitempty" validate:"omitempty,min=11"` FactorNumber string `json:"factorNumber,omitempty"` Description string `json:"description,omitempty" validate:"omitempty,max=255"` ValidCardNumber string `json:"validCardNumber,omitempty" validate:"omitempty,max=16"` }
type PaymentResponse ¶
type Request ¶
type Request struct { API string `json:"api"` *PaymentRequest *VerifyRequest }
type VerifyRequest ¶
type VerifyRequest struct {
Token string `json:"token" validate:"required"`
}
type VerifyResponse ¶
Click to show internal directories.
Click to hide internal directories.