Documentation ¶
Index ¶
- Variables
- func CheckIp(ip string) bool
- func HandleRequestWithParams(hr *HandlerRequest) error
- func Init(secret string, public string)
- func SetDefaultBackUrl(backurl string)
- func SetDefaultCurrency(currency string) error
- func SetDefaultHideMenu(defaulthidemenu bool)
- func SetDefaultLocale(locale string) error
- func SetDefaultPayBaseUrl(defaultpaybaseurl string)
- func SetDefaultPaymentMethod(paymentmethod string) error
- type DefaultValues
- type HandlerRequest
- type OptionalParams
- type Params
- func (params *Params) Form() (URL string, err error)
- func (params *Params) GetSignature() string
- func (params *Params) SetAccount(account string) error
- func (params *Params) SetBackUrl(backurl string) error
- func (params *Params) SetCashItems(items string) error
- func (params *Params) SetCurrency(currency string) error
- func (params *Params) SetCustomerEmail(email string) error
- func (params *Params) SetCustomerPhone(phone string) error
- func (params *Params) SetDesc(desc string)
- func (params *Params) SetHideMenu(hidemenu bool) error
- func (params *Params) SetLocale(locale string) error
- func (params *Params) SetOperator(operator string) error
- func (params *Params) SetPaymentMethod(paymentmethod string) error
- func (params *Params) SetSum(sum int) error
- type RequiredParams
Constants ¶
This section is empty.
Variables ¶
var PublicKey string
var SecretKey string
Functions ¶
func HandleRequestWithParams ¶
func HandleRequestWithParams(hr *HandlerRequest) error
Function to handle Unitpay request. Accept unitpay.HandleRequest.
Returns nil error if its ok. Alternatively you can pass http.Request in HandleRequest function
func SetDefaultBackUrl ¶
func SetDefaultBackUrl(backurl string)
Functions to change some of default values for form
func SetDefaultCurrency ¶
Functions to change some of default values for form
func SetDefaultHideMenu ¶
func SetDefaultHideMenu(defaulthidemenu bool)
Functions to change some of default values for form
func SetDefaultLocale ¶
Functions to change some of default values for form
func SetDefaultPayBaseUrl ¶
func SetDefaultPayBaseUrl(defaultpaybaseurl string)
Functions to change some of default values for form
func SetDefaultPaymentMethod ¶
Functions to change some of default values for form
Types ¶
type DefaultValues ¶
type DefaultValues struct {
// contains filtered or unexported fields
}
Form
Type of default values for form
type HandlerRequest ¶
type HandlerRequest struct { Method string `json:"method"` UnitpayId int `json:"unitpayId"` ProjectId int `json:"projectId"` Account string `json:"account"` PayerSum int `json:"payerSum"` PayerCurrency string `json:"payerCurrency"` Profit int `json:"profit"` Phone int `json:"phone"` PaymentType string `json:"paymentType"` OrderSum int `json:"orderSum"` OrderCurrency string `json:"orderCurrency"` Operator string `json:"operator"` Date string `json:"date"` ErrorMessage string `json:"errorMessage"` Test int `json:"test"` DS3 int `json:"3ds"` SubscriptionId int `json:"subscriptionId"` Signature string `json:"signature"` ParamsSlice []string `json:"params_slice"` }
Handler Request
All Request values from UnitpayDocs
func GetParamsFromRequest ¶
func GetParamsFromRequest(r *http.Request) *HandlerRequest
Function to get values from Request
You can access this function from outside of package to operate params manually
func HandleRequest ¶
func HandleRequest(r *http.Request) (*HandlerRequest, error)
Function to handle Unitpay request. Accept http.Request.
Returns Params of request and nil error if its ok. Returns nil Params and error if there are errors. Alternatively you can get params by yourself and handle it with HandleRequestWithParams function
type OptionalParams ¶
type OptionalParams struct { Currency string `json:"currency"` Locale string `json:"locale"` BackUrl string `json:"backUrl"` PaymentMethod string `json:"payment_method"` Operator string `json:"operator"` HideMenu string `json:"hide_menu"` CustomerEmail string `json:"customer_email"` CustomerPhone string `json:"customer_phone"` CashItems string `json:"cash_items"` }
Other simple payment form Params (non-required). Used in func Form
type Params ¶
type Params struct { RequiredParams OptionalParams }
Params options summary
func NewEmptyParams ¶
func NewEmptyParams() *Params
return new params object with empty required params and default optional params
func (*Params) GetSignature ¶
func to get signature of given params
func (*Params) SetAccount ¶
Group of functions to set Form params values
func (*Params) SetBackUrl ¶
Group of functions to set Form params values
func (*Params) SetCashItems ¶
func (*Params) SetCurrency ¶
Group of functions to set Form params values
func (*Params) SetCustomerEmail ¶
func (*Params) SetCustomerPhone ¶
func (*Params) SetHideMenu ¶
Group of functions to set Form params values
func (*Params) SetOperator ¶
func (*Params) SetPaymentMethod ¶
Group of functions to set Form params values