From 21c77bff927fdbd2ed4ff6216f16e2aeab3d98f3 Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Thu, 14 Sep 2023 13:44:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/local_alipay/api.go | 5 ++++- pay/pay_by_own.go | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/lib/local_alipay/api.go b/lib/local_alipay/api.go index c2d56c0..ed05a5c 100644 --- a/lib/local_alipay/api.go +++ b/lib/local_alipay/api.go @@ -65,7 +65,7 @@ func TradeAppPay(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS str } return payParam, nil } -func TradeAppPc(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS string, paySet *md.PayData) (string, error) { +func TradeAppPc(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS, pageUrl string, paySet *md.PayData) (string, error) { //初始化支付宝客户端 // appID 是在支付宝申请的APPID // priKey 是支付宝私钥 @@ -97,6 +97,9 @@ func TradeAppPc(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS stri if notiURL != "" { client.SetNotifyUrl(notiURL) } + if pageUrl != "" { + client.SetReturnUrl(pageUrl) + } //新支付宝支付 if paySet.PayAliUseType == "1" { client.SetAppCertSN(paySet.PayAppCertSn) diff --git a/pay/pay_by_own.go b/pay/pay_by_own.go index 4c871bb..b537b82 100644 --- a/pay/pay_by_own.go +++ b/pay/pay_by_own.go @@ -58,7 +58,7 @@ func AlipayPc(args map[string]string) (string, error) { if args["private_key"] == "" || args["app_id"] == "" { return "", errors.New("请在后台正确配置支付宝") } - param, err := local_alipay.TradeAppPc(args["app_id"], args["private_key"], args["subject"], args["ord_id"], args["amount"], args["notify_url"], args["rsa"], args["pkcs"], paySet) + param, err := local_alipay.TradeAppPc(args["app_id"], args["private_key"], args["subject"], args["ord_id"], args["amount"], args["notify_url"], args["rsa"], args["pkcs"], args["page_url"], paySet) if err != nil { fmt.Println("支付宝错误日志") fmt.Println(param) @@ -141,3 +141,8 @@ func WxAppRefund(params map[string]string) (*wechat.RefundResponse, gopay.BodyMa r, r1, err := local_wxpay.TradeAppRefund(client, params["subject"], params["transaction_id"], params["out_refund_no"], params["total_fee"], params["amount"], params["p12_str"], params["notify_url"]) return r, r1, err } +func WxAppRefundQuery(params map[string]string) (*wechat.QueryRefundResponse, gopay.BodyMap, error) { + client := local_wxpay.NewClient(params["pay_wx_appid"], params["pay_wx_mch_id"], params["pay_wx_api_key"], true) + r, r1, err := local_wxpay.TradeAppRefundQuery(client, params["transaction_id"]) + return r, r1, err +}