Merge branch 'dev-lwl/yop' into test

This commit is contained in:
lwl0608 2024-05-27 19:37:58 +08:00
commit ad7dd3b052
4 changed files with 17 additions and 2 deletions

View File

@ -39,6 +39,7 @@ const (
const (
CallBackPayTypeAlipay = "alipay"
CallBackPayTypeWxpay = "wxpay"
CallBackPayTypeYeepay = "yeepay"
)
const (

View File

@ -24,7 +24,7 @@ func YeepayCallback(ctx *gin.Context) {
err = service.DefaultService.PayCallback(ctx, &vasproto.PayCallbackParamIn{
OrderId: notify.OrderId,
OutOrderId: notify.UniqueOrderNo,
CallbackPayType: vasproto.CallBackPayTypeWxpay,
CallbackPayType: vasproto.CallBackPayTypeYeepay,
})
if err != nil {
logger.Error("YeepayCallback fail, notify: %v, err: %v", util.ToJson(notify), err)

View File

@ -93,7 +93,7 @@ func (c *YeepayClient) ParseNotify(req *http.Request) (*YeepayNotify, error) {
return nil, err
}
notify := new(YeepayNotify)
err = json.Unmarshal([]byte(util.ToJson(content)), notify)
err = json.Unmarshal([]byte(content), notify)
if err != nil {
logger.Error("Yeepay unmarshal fail, form: %v, content: %v, err: %v", req.Form.Encode(), util.ToJson(content), err)
return nil, err

View File

@ -2,6 +2,7 @@ package yeepaycli
import (
"context"
"encoding/json"
"fmt"
"service/app/mix/conf"
"service/bizcommon/util"
@ -47,3 +48,16 @@ func TestInit(t *testing.T) {
t.Log(err)
t.Log(util.ToJson(resp))
}
func TestYeepayClient_ParseNotify(t *testing.T) {
s := "{\"channelOrderId\":\"362024052722001417931448328101\",\"orderId\":\"1795054273042591744\",\"bankOrderId\":\"705784025745240527\",\"paySuccessDate\":\"2024-05-27 19:27:51\",\"channel\":\"ALIPAY\",\"payWay\":\"USER_SCAN\",\"uniqueOrderNo\":\"1013202405270000011947326367\",\"merchantName\":\"揽星网络\",\"orderAmount\":\"1.00\",\"payAmount\":\"1.00\",\"payerInfo\":\"{\\\"bankCardNo\\\":\\\"\\\",\\\"bankId\\\":\\\"ALIPAY\\\",\\\"buyerLogonId\\\":\\\"132****6120\\\",\\\"cardType\\\":\\\"DEBIT\\\",\\\"mobilePhoneNo\\\":\\\"\\\",\\\"userID\\\":\\\"2088422859817936\\\"}\",\"realPayAmount\":\"1.00\",\"parentMerchantNo\":\"10090316660\",\"tradeType\":\"REALTIME\",\"merchantNo\":\"10090326142\",\"status\":\"SUCCESS\"}"
var paymentInfo YeepayNotify
err := json.Unmarshal([]byte(s), &paymentInfo)
if err != nil {
fmt.Println("Error:", err)
return
}
fmt.Println("Payment Info:", paymentInfo)
}