Jerry 7 лет назад
Родитель
Сommit
829b9e5914
2 измененных файлов с 6 добавлено и 3 удалено
  1. 1 1
      alipay_client_test.go
  2. 5 2
      alipay_server_api.go

+ 1 - 1
alipay_client_test.go

@@ -77,7 +77,7 @@ func TestAliPayClient_AliPayTradePagePay(t *testing.T) {
 	//请求参数
 	body := make(BodyMap)
 	body.Set("subject", "网站测试支付")
-	body.Set("out_trade_no", "GYWX201901301040355706100425")
+	body.Set("out_trade_no", "GYWX201901301040355706100426")
 	body.Set("quit_url", "https://www.igoogle.ink")
 	body.Set("total_amount", "88.88")
 	body.Set("product_code", "FAST_INSTANT_TRADE_PAY")

+ 5 - 2
alipay_server_api.go

@@ -9,6 +9,7 @@ import (
 	"bytes"
 	"encoding/json"
 	"fmt"
+	"log"
 	"net/http"
 )
 
@@ -44,9 +45,10 @@ func ParseAliPayNotifyResult(req *http.Request) (notifyRsp *AliPayNotifyRequest,
 	notifyRsp.GmtRefund = req.FormValue("gmt_refund")
 	notifyRsp.GmtClose = req.FormValue("gmt_close")
 	billList := req.FormValue("fund_bill_list")
+	log.Println("billList:", billList)
 	if billList != null {
 		bills := make([]FundBillListInfo, 0)
-		err = json.Unmarshal([]byte(billList), bills)
+		err = json.Unmarshal([]byte(billList), &bills)
 		if err != nil {
 			return nil, err
 		}
@@ -56,9 +58,10 @@ func ParseAliPayNotifyResult(req *http.Request) (notifyRsp *AliPayNotifyRequest,
 	}
 	notifyRsp.PassbackParams = req.FormValue("passback_params")
 	detailList := req.FormValue("voucher_detail_list")
+	log.Println("detailList:", detailList)
 	if detailList != null {
 		details := make([]VoucherDetailListInfo, 0)
-		err = json.Unmarshal([]byte(detailList), details)
+		err = json.Unmarshal([]byte(detailList), &details)
 		if err != nil {
 			return nil, err
 		}