unitpay

package
v0.0.0-...-4290a6a Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckHandlerRequest

func CheckHandlerRequest(r *http.Request, keys url.Values, secret string) (valid bool, method string)

Check response from UnitPay

func Form

func Form(formParams Params, secret string, public string) (URL string)

Get pay form URL

func GetErrorHandlerResponse

func GetErrorHandlerResponse(message string) []byte

func GetSuccessHandlerResponse

func GetSuccessHandlerResponse(message string) []byte

Types

type ApiError

type ApiError struct {
	Message string `json:"message"`
	Code    int    `json:"code"`
}

type ApiResponse

type ApiResponse struct {
	Result ApiResult `json:"result"`
	Error  ApiError  `json:"error"`
}

Structs to decode API response

func API

func API(method string, params map[string]string, secret string, public string) (res ApiResponse, error string)

Get API response

type ApiResult

type ApiResult struct {
	Message     string `json:"message"`
	PaymentId   int    `json:"paymentId"`
	ReceiptUrl  string `json:"ReceiptUrl"`
	StatusUrl   string `json:"StatusUrl"`
	Type        string `json:"type"`
	RedirectUrl string `json:"redirectUrl"`
}

type ErrorResponse

type ErrorResponse struct {
	Error Message `json:"error"`
}

type Message

type Message struct {
	Message string `json:"message"`
}

type Params

type Params struct {
	Account          string
	Desc             string
	Sum              string
	AdditionalParams map[string]string // non-vital params ex. currency or backUrl
}

Params for Form

type SuccessfulResponse

type SuccessfulResponse struct {
	Result Message `json:"result"`
}

Jump to

Keyboard shortcuts

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