allinpay

package module
v0.2.12 Latest Latest
Warning

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

Go to latest
Published: Apr 11, 2023 License: MIT Imports: 25 Imported by: 0

README

allinpay

Demo

package main

import (
	"log"
	
	"github.com/cnbattle/allinpay"
)

func main() {
	client := allinpay.NewAllInPayClient(allinpay.Config{
		AppID:        "xxx",
		AppSecretKey: "xxx",
		AppAccountID: "40000",
		PfxPath:      "./1581648210684.pfx",
		TLCert:       "./TLCert-test.cer",
		PfxPwd:       "123456",
		IsProd:       false,
		Debug:        true,
	})
	params := map[string]interface{}{}
	params["bizUserId"] = "golang-test-1"
	params["memberType"] = "3"
	params["source"] = "1"
	data, err := client.Request("allinpay.yunst.memberService.createMember", params)
	log.Println(data)
	log.Println(err)
}

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	RequestError       = errors.New("request result error")
	VerifyResultError  = errors.New("verify result error")
	SignError          = errors.New("sign error")
	GetPrivateKeyError = errors.New("get private key error")
	EncryptionSIError  = errors.New("encryption sensitive information error")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	Config
	ServiceUrl string
}

func NewAllInPayClient

func NewAllInPayClient(config Config) *Client

func (*Client) BindParams

func (s *Client) BindParams(method string, content map[string]interface{}) (map[string]string, error)

BindParams 构建参数

func (*Client) EncryptionSI

func (s *Client) EncryptionSI(information string) (string, error)

EncryptionSI RSA加密敏感信息

func (*Client) GetPrivateKey

func (s *Client) GetPrivateKey(privateKeyName, privatePassword string) (*rsa.PrivateKey, error)

GetPrivateKey 获取私钥

func (*Client) Request

func (s *Client) Request(method string, content map[string]interface{}) (data string, err error)

Request 统一请求验签处理

func (*Client) RequestOnly added in v0.2.10

func (s *Client) RequestOnly(method string, content map[string]interface{}) (data string, err error)

RequestOnly 仅请求处理

func (*Client) Sign

func (s *Client) Sign(params map[string]string) (string, error)

Sign 签名

func (*Client) VerifyResult

func (s *Client) VerifyResult(jsonStr, sign string) error

VerifyResult 验参

type Config

type Config struct {
	AppID        string
	AppSecretKey string
	AppAccountID string
	PfxPath      string
	TLCert       string
	PfxPwd       string
	IsProd       bool
	Version      string
	NotifyUrl    string
	Debug        bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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