Jerry 7 anni fa
parent
commit
2a69359c39
2 ha cambiato i file con 7 aggiunte e 5 eliminazioni
  1. 1 3
      alipay_client_test.go
  2. 6 2
      alipay_server_api.go

+ 1 - 3
alipay_client_test.go

@@ -3,7 +3,6 @@ package gopay
 import (
 	"encoding/json"
 	"fmt"
-	"github.com/smartwalle/alipay"
 	"testing"
 )
 
@@ -78,7 +77,7 @@ func TestAliPayClient_AliPayTradePagePay(t *testing.T) {
 	//请求参数
 	body := make(BodyMap)
 	body.Set("subject", "网站测试支付")
-	body.Set("out_trade_no", "GYWX201901301040355706100433")
+	body.Set("out_trade_no", "GYWX201901301040355706100435")
 	body.Set("quit_url", "https://www.igoogle.ink")
 	body.Set("total_amount", "88.88")
 	body.Set("product_code", "FAST_INSTANT_TRADE_PAY")
@@ -143,5 +142,4 @@ func TestJsonToString(t *testing.T) {
 		return
 	}
 	fmt.Println("string:", string(bs))
-	alipay.AckNotification()
 }

+ 6 - 2
alipay_server_api.go

@@ -119,7 +119,7 @@ func VerifyAliPayResultSign(aliPayPublicKey string, notifyRsp *AliPayNotifyReque
 	body.Set("fund_bill_list", jsonToString(notifyRsp.FundBillList))
 	body.Set("passback_params", notifyRsp.PassbackParams)
 	body.Set("voucher_detail_list", jsonToString(notifyRsp.VoucherDetailList))
-
+	log.Println("body.get:", body.Get("voucher_detail_list"))
 	newBody := make(BodyMap)
 	for k, v := range body {
 		if v != null {
@@ -147,7 +147,11 @@ func jsonToString(v interface{}) (str string) {
 		return ""
 	}
 	//log.Println("string:", string(bs))
-	return string(bs)
+	s := string(bs)
+	if s == "null" {
+		return ""
+	}
+	return s
 }
 
 //格式化秘钥