adapayCore

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const Version = "1.3.0"

Variables

View Source
var GDefaultMerchSysConfig = MerchSysConfig{}
View Source
var GMultiMerchSysConfigs = map[string]MerchSysConfig{}

Functions

func DeepCopy

func DeepCopy(value interface{}) interface{}

func DeleteEmptyValue

func DeleteEmptyValue(src map[string]interface{}) map[string]interface{}

func DoGetReq

func DoGetReq(url string, params map[string]interface{}, msc *MerchSysConfig) (*http.Response, error)

func DoPostReq

func DoPostReq(url string, params map[string]interface{}, msc *MerchSysConfig) (*http.Response, error)

func DoUploadFile

func DoUploadFile(url string, params map[string]interface{}, fileParamName string, msc *MerchSysConfig) (*http.Response, error)

func FormatSignSrcText

func FormatSignSrcText(method string, paramMap map[string]interface{}) (string, error)

func Println

func Println(v ...interface{})

func RsaLongDecrypt

func RsaLongDecrypt(content string, msc *MerchSysConfig) (result string)

func RsaLongEncrypt

func RsaLongEncrypt(content string, msc *MerchSysConfig) (result string)

func RsaSign

func RsaSign(content string, msc *MerchSysConfig) (result string, err error)

func RsaSignVerify

func RsaSignVerify(signData string, originalData string, msc *MerchSysConfig) (err error)

func ToString

func ToString(v interface{}) string

Types

type ApiError

type ApiError struct {
	ErrorCode string `json:"error_code"`

	ErrorMsg string `json:"error_msg"`

	ErrorType string `json:"error_type"`

	Status string `json:"status"`

	InvalidParam string `json:"invalid_param"`
}

func FilterApiError

func FilterApiError(respBodyString string) (*ApiError, error)

func HandleResponse

func HandleResponse(resp *http.Response, msc *MerchSysConfig) (map[string]interface{}, *ApiError, error)

func RequestAdaPay

func RequestAdaPay(reqUrl string, requestMethod RequestMethod, reqParam map[string]interface{}, msc *MerchSysConfig) (map[string]interface{}, *ApiError, error)

func UploadAdaPay

func UploadAdaPay(reqUrl string, reqParam map[string]interface{}, fileParamName string, msc *MerchSysConfig) (map[string]interface{}, *ApiError, error)

type MerchSysConfig

type MerchSysConfig struct {
	ApiKeyLive string `json:"api_key_live"`

	ApiKeyTest string `json:"api_key_test"`

	RspPubKey string `json:"rsa_public_key"`

	RspPriKey string `json:"rsa_private_key"`
}

func GetMerchSysConfig

func GetMerchSysConfig(mscId string) MerchSysConfig

func ReadMerchConfig

func ReadMerchConfig(configPath string) (*MerchSysConfig, error)

func (*MerchSysConfig) IsEmpty

func (msc *MerchSysConfig) IsEmpty() bool

type RequestMethod

type RequestMethod string
const (
	POST   RequestMethod = "POST"
	GET    RequestMethod = "GET"
	UPLOAD RequestMethod = "UPLOAD"
)

Jump to

Keyboard shortcuts

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