|
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- package test
-
- import (
- luso "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/lib/luso_bank"
- zhios_pay_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils"
- "crypto"
- "log"
- "testing"
- )
-
- func TestLusoPay(t *testing.T) {
- var (
- payParam luso.PayParam
- dataParam luso.DataParam
- )
- req := map[string]string{
- "mchtOrderId": "202211041102",
- "payScene ": "AS_MWEB",
- "mdseDesc ": "澳门世寶-自營購物",
- "transAmount ": "100",
- "transCur ": "MOP",
- "subMchtNm ": luso.MchtStoreNm,
- "notifyUrl ": "http://inapi.izhyin.cn:80/pay/boc/callback",
- "extMsg ": zhios_pay_utils.SerializeStr(map[string]string{
- "mid": "123456",
- "ord_type": "mall_goods",
- }),
- }
- dataParam.Head.MchtNo = luso.MerchantId
- dataParam.ReqBody = req
- client := payParam.SetData(dataParam)
- err := client.SetSign(luso.PrivateKeyStr)
- if err != nil {
- t.Error(err)
- }
- resp, err := client.PayParam.Send(false, false, "create")
- if err != nil {
- t.Error(err)
- }
- t.Logf("回調信息:%s", resp)
- }
-
- func TestRsa2Rsa2PriSign(t *testing.T) {
- //原内容
- str := "eyJoZWFkIjp7Im1jaHRObyI6IjMwMDExIiwicmVxVGltZSI6IjIwMjIxMTA5MTUwNjQ1IiwibXNnSWQiOiI1MjE0NTAxNjY3OTc3NjA1MzgyMDIyMTEwOTE1MDY0NSIsImF0dGFjaCI6IiIsImNlcnRJZCI6IjAxIiwidmVyc2lvbiI6IjEuMC4wIn0sInJlcUJvZHkiOnsiZXh0TXNnICI6IntcIm1pZFwiOlwiMTIzNDU2XCIsXCJvcmRfdHlwZVwiOlwibWFsbF9nb29kc1wifSIsIm1jaHRPcmRlcklkIjoiNTIxNDUwMTY2Nzk3NzYwNTM4IiwibWRzZURlc2MgIjoi5LiW5a+25ZWG5Z+OLeiHqueHn+izvOeJqSIsIm5vdGlmeVVybCAiOiJodHRwOi8vaW5hcGkuaXpoeWluLmNuOjgwL3BheS9sdXNvL2NhbGxiYWNrIiwicGF5U2NlbmUgIjoiQVNfTVdFQiIsInN1Yk1jaHRObSAiOiLkuJblr7bllYbln44iLCJ0cmFuc0Ftb3VudCAiOiIxMDAuMDAiLCJ0cmFuc0N1ciAiOiJNT1AifX0="
- //生成签名
- sig, _ := zhios_pay_utils.GetSignV2(luso.PrivateKeyStr, str, crypto.SHA1)
- log.Println(sig)
- //验证原内容与签名是否一致
- res := zhios_pay_utils.Rsa2PubCheckSign(str, sig, luso.PUBLICKEY, crypto.SHA1)
- log.Println(res)
- }
|