|
- package test
-
- import (
- fb "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/lib/fb_pay"
- zhios_pay_utils "code.fnuoos.com/go_rely_warehouse/zyos_go_pay.git/utils"
- "testing"
- "time"
- )
-
- func TestFBPayUnification(t *testing.T) {
- unification := fb.GetUnificationByVendorSn("2022120518415543840a")
- var ordCreat fb.OrderCreateParameters
- ordCreat.OrderCreateMustParameters.MerchantOrderSn = "202212061833-01"
- ordCreat.OrderCreateMustParameters.TotalAmount = 0.1
- ordCreat.OrderCreateMustParameters.PayType = "alipay"
- ordCreat.OrderCreateMustParameters.UserId = "userid"
- ordCreat.OrderCreateMustParameters.MerchantId = 1979251
- unification.Nonce = ordCreat.OrderCreateMustParameters.MerchantOrderSn + time.Now().Format("20060102150405")
- param := zhios_pay_utils.Struct2Map(ordCreat)
- for key, value := range param {
- if value == "" {
- delete(param, key)
- }
- }
- unification.SetBizContent(param)
- unification.SetSign("c5d47b9e515594313d80fb9903ece2d8")
- send, err := unification.Send(false)
- if err != nil {
- t.Error(err)
- }
- t.Logf("回调数据:%s\n", send)
- }
-
- func TestFBPayOrderQrcode(t *testing.T) {
- unification := fb.GetOrderQrcodeByVendorSn("2022120518415543840a")
- var orderQrcode fb.OrderQrcodeParameters
- orderQrcode.OrderQrcodeMustParameters.MerchantOrderSn = "20221208-02"
- orderQrcode.OrderQrcodeMustParameters.TotalAmount = 0.1
- orderQrcode.OrderQrcodeMustParameters.PayType = "alipay"
- orderQrcode.OrderQrcodeMustParameters.StoreId = 1331462
- unification.Nonce = orderQrcode.OrderQrcodeMustParameters.MerchantOrderSn + time.Now().Format("20060102150405")
- param := zhios_pay_utils.Struct2Map(orderQrcode)
- for key, value := range param {
- if value == "" {
- delete(param, key)
- }
- }
- unification.SetBizContent(param)
- unification.SetSign("c5d47b9e515594313d80fb9903ece2d8")
- send, err := unification.Send(false)
- if err != nil {
- t.Error(err)
- }
- t.Logf("回调数据:%s\n", send)
- }
-
- func TestFBPayOrderWxconfig(t *testing.T) {
- requestParameters := fb.GetRequestParametersByVendorSn("2022120518415543840a")
- requestParameters.Method = "fbpay.order.wxconfig"
- requestParameters.SignMethod = "md5"
- requestParameters.Nonce = time.Now().Format("20060102150405")
- param := make(map[string]interface{})
- param["merchant_id"] = 1979251
- param["store_id"] = 1331462
- param["sub_appid"] = "wx43207c79f84a14ca"
- param["account_type"] = "01"
- for key, value := range param {
- if value == "" {
- delete(param, key)
- }
- }
- requestParameters.SetBizContent(param)
- requestParameters.SetSign("c5d47b9e515594313d80fb9903ece2d8")
- send, err := requestParameters.Send(false)
- if err != nil {
- t.Error(err)
- }
- t.Logf("回调数据:%s\n", send)
- }
|