From a2d71e4a2d38275b5643c8ee2f88895ea56c3b1d Mon Sep 17 00:00:00 2001 From: huangjuajun <102564160@qq.com> Date: Tue, 31 May 2022 14:24:08 +0800 Subject: [PATCH] =?UTF-8?q?add=20Reverse:for=20v1.2.3=20=E8=87=AA=E6=9C=89?= =?UTF-8?q?=E6=94=AF=E4=BB=98=E5=AE=9D=E6=94=AF=E4=BB=98=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pay/pay_by_own.go | 64 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 63 insertions(+), 1 deletion(-) diff --git a/pay/pay_by_own.go b/pay/pay_by_own.go index c1719a6..d909cb8 100644 --- a/pay/pay_by_own.go +++ b/pay/pay_by_own.go @@ -14,7 +14,6 @@ import ( //自有支付 支付宝 func Alipay(args map[string]string) (string, error) { - var paySet = &md.PayData{ PayAppCertSn: args["pay_app_cert_sn"], PayAlipayRootCertSn: args["pay_alipay_root_cert_sn"], @@ -45,6 +44,69 @@ func Alipay(args map[string]string) (string, error) { } return zhios_pay_utils.AnyToString(param), nil } +func AlipayApp(args map[string]string) (string, error) { + var paySet = &md.PayData{ + PayAppCertSn: args["pay_app_cert_sn"], + PayAlipayRootCertSn: args["pay_alipay_root_cert_sn"], + PayAlipayrsaPublicKey: args["pay_alipayrsa_public_key"], + PayAliUseType: args["pay_ali_use_type"], + WxAppletFilepathUrl: args["wx_applet_filepath_url"], + } + if args["private_key"] == "" || args["app_id"] == "" { + return "", errors.New("请在后台正确配置支付宝") + } + param, err := local_alipay.TradeAppPay(args["app_id"], args["private_key"], args["subject"], args["ord_id"], args["amount"], args["notify_url"], args["rsa"], args["pkcs"], paySet) + if err != nil { + fmt.Println("支付宝错误日志") + fmt.Println(param) + fmt.Println(err) + return "", errors.New("支付宝订单创建失败") + } + return zhios_pay_utils.AnyToString(param), nil +} + +func AlipayWap(args map[string]string) (string, error) { + + var paySet = &md.PayData{ + PayAppCertSn: args["pay_app_cert_sn"], + PayAlipayRootCertSn: args["pay_alipay_root_cert_sn"], + PayAlipayrsaPublicKey: args["pay_alipayrsa_public_key"], + PayAliUseType: args["pay_ali_use_type"], + WxAppletFilepathUrl: args["wx_applet_filepath_url"], + } + if args["private_key"] == "" || args["app_id"] == "" { + return "", errors.New("请在后台正确配置支付宝") + } + param, err := local_alipay.TradeWapPay(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) + fmt.Println(err) + return "", errors.New("支付宝订单创建失败") + } + return zhios_pay_utils.AnyToString(param), nil +} + +func AlipayApplet(args map[string]string) (string, error) { + var paySet = &md.PayData{ + PayAppCertSn: args["pay_app_cert_sn"], + PayAlipayRootCertSn: args["pay_alipay_root_cert_sn"], + PayAlipayrsaPublicKey: args["pay_alipayrsa_public_key"], + PayAliUseType: args["pay_ali_use_type"], + WxAppletFilepathUrl: args["wx_applet_filepath_url"], + } + if args["private_key"] == "" || args["app_id"] == "" { + return "", errors.New("请在后台正确配置支付宝") + } + param, err := local_alipay.TradeCreate(args["app_id"], args["private_key"], args["subject"], args["ord_id"], args["amount"], args["notify_url"], args["rsa"], args["pkcs"], paySet) + if err != nil { + fmt.Println("支付宝错误日志") + fmt.Println(param) + fmt.Println(err) + return "", errors.New("支付宝订单创建失败") + } + return zhios_pay_utils.AnyToString(param), nil +} //自有支付 微信支付