diff --git a/app/http/controllers/front/payment_controller.go b/app/http/controllers/front/payment_controller.go index 3c27df8..1efcf63 100644 --- a/app/http/controllers/front/payment_controller.go +++ b/app/http/controllers/front/payment_controller.go @@ -189,3 +189,23 @@ func BrokerWechatUrl(c *gin.Context) { return } } + +//// 首页 +//func Ind/*ex(c *gin.Context) { +// c.HTML(200, "index.html", gin.H{}) +//} + +//// 获取微信授权链接 +//func GetWxAuthUrl(c *gin.Context) { +// req, _ := controllers.GetRequest(c).(*front.GetWxAuthUrlRequest) +// +// url, code := services.GetWxAuthUrl(*req) +// controllers.HandCodeRes(c, url, code) +//} +// +//// 通过code获取授权,openid +//func GetWxAuth(c *gin.Context) { +// //req, _ := controllers.GetRequest(c).(*front.GetWxAuthRequest) +// //openId, code := services.GetWxAuth(*req) +// //controllers.HandCodeRes(c, openId, code) +//}*/ diff --git a/app/http/entities/front/wechat.go b/app/http/entities/front/wechat.go new file mode 100644 index 0000000..3964c08 --- /dev/null +++ b/app/http/entities/front/wechat.go @@ -0,0 +1,11 @@ +package front + +type GetWxAuthUrlRequest struct { + PayChannelId string `json:"pay_channel_id" form:"pay_channel_id" validate:"required"` +} + +type GetWxAuthRequest struct { + Code string `json:"code" form:"code" ` + State string `json:"state" form:"state"` + PayChannelId string `json:"pay_channel_id" form:"pay_channel_id"` +} diff --git a/app/http/middlewares/server_recovery.go b/app/http/middlewares/server_recovery.go index 87d7129..6abdf0b 100644 --- a/app/http/middlewares/server_recovery.go +++ b/app/http/middlewares/server_recovery.go @@ -33,10 +33,10 @@ func ServerRecovery() gin.HandlerFunc { } c.JSON(500, gin.H{ - "code": 500, - "msg": "system error", - "request_uri": c.Request.URL.Path, - "data": make(map[string]string), + "code": 500, + "msg": "system error", + //"request_uri": c.Request.URL.Path, + //"data": make(map[string]string), }) } }() diff --git a/app/http/requestmapping/front.go b/app/http/requestmapping/front.go index d7c1d4e..d695597 100644 --- a/app/http/requestmapping/front.go +++ b/app/http/requestmapping/front.go @@ -18,4 +18,6 @@ var FrontRequestMapBeforeDecrypt = map[string]func() interface{}{ common.FRONT_V1 + "/pay/refund": func() interface{} { return new(front.RequestBody) }, common.FRONT_V1 + "/pay/query": func() interface{} { return new(front.RequestBody) }, common.FRONT_V1 + "/pay/close": func() interface{} { return new(front.CloseReqs) }, + //common.FRONT_V1 + "/wx/index": func() interface{} { return new(entities.PageRequest) }, + //common.FRONT_V1 + "/wx/getWxAuthUrl": func() interface{} { return new(front.GetWxAuthUrlRequest) }, } diff --git a/app/http/routes/route.go b/app/http/routes/route.go index 9b79b9a..a2d5b66 100644 --- a/app/http/routes/route.go +++ b/app/http/routes/route.go @@ -67,6 +67,15 @@ func RegisterRoute(router *gin.Engine) { v1.GET("/brokerWechatUrl", front.BrokerWechatUrl) } + // 微信获取授权相关 + router.LoadHTMLGlob("./front/templates/*") + //wx := v1.Group("/wx", middlewares.ValidateRequest()) + //{ + // wx.GET("/index", front.Index) // 获取页面 + // wx.POST("/getWxAuthUrl", front.GetWxAuthUrl) // 获取授权code + // wx.GET("/getWxAuth", front.GetWxAuth) // 获取openId + //} + router.GET("/swagger/*any", ginSwagger.WrapHandler(swaggerFiles.Handler)) } diff --git a/app/services/wecaht.go b/app/services/wecaht.go new file mode 100644 index 0000000..9f1ffe6 --- /dev/null +++ b/app/services/wecaht.go @@ -0,0 +1,80 @@ +package services + +import ( + "PaymentCenter/app/constants/common" + "PaymentCenter/app/http/entities/front" + "PaymentCenter/app/models/paychannelmodel" + "PaymentCenter/app/third/paymentService" + "PaymentCenter/config" + "encoding/json" + "net/url" + "strconv" +) + +// 获取授权链接 +func GetWxAuthUrl(param front.GetWxAuthUrlRequest) (targetUrl string, code int) { + var ( + // 重定向地址 + redirectUri = config.GetConf().PayService.Host + common.FRONT_V1 + "/wx/getOpenId" + ) + baseUrl := "https://open.weixin.qq.com/connect/oauth2/authorize" + + // 获取支付渠道的配置 + id, err := strconv.Atoi(param.PayChannelId) + if err != nil { + code = handErr(err) + return + } + payChannel := paychannelmodel.PayChannel{Id: int64(id)} + code = PayChannelGet(&payChannel) + if code != 200 { + return + } + //// 配置解析 + //wxConfig := paymentService.WxPay{} + //err = json.Unmarshal([]byte(payChannel.ExtJson), &wxConfig) + //if err != nil { + // code = handErr(err) + // return + //} + + appid := payChannel.AppId + redirectUri = url.QueryEscape(redirectUri) + responseType := "code" + scope := "snsapi_base" + + targetUrl = baseUrl + "?appid=" + appid + "&redirect_uri=" + redirectUri + "&response_type=" + responseType + "&scope=" + scope + "#wechat_redirect" + return +} + +// 通过code换取网页授权access_token +func GetWxAuth(param front.GetWxAuthRequest) (code int) { + + // 获取支付渠道的配置 + id, err := strconv.Atoi(param.PayChannelId) + if err != nil { + code = handErr(err) + return + } + payChannel := paychannelmodel.PayChannel{Id: int64(id)} + code = PayChannelGet(&payChannel) + if code != 200 { + return + } + + // 配置解析 + wxConfig := paymentService.WxPay{} + err = json.Unmarshal([]byte(payChannel.ExtJson), &wxConfig) + if err != nil { + code = handErr(err) + return + } + + //targetUrl := fmt.Sprintf("https://api.weixin.qq.com/sns/oauth2/access_token?appid=%s&secret=%s&code=%s&grant_type=authorization_code", + // payChannel.AppId, + // wxConfig.SerialNo, + // param.Code, + //) + + return +} diff --git a/app/third/paymentService/payment_service.go b/app/third/paymentService/payment_service.go index 93e0db3..f2d681a 100644 --- a/app/third/paymentService/payment_service.go +++ b/app/third/paymentService/payment_service.go @@ -14,13 +14,14 @@ import ( type PayOrderRequest struct { PayChannelId int64 `json:"pay_channel_id"` // 支付方式ID OrderId int64 `json:"order_id"` // 平台订单号 - ChannelType int `json:"channel_type"` // 支付方式 + ChannelType int `json:"channel_type"` // 支付渠道枚举,1微信JSAPI,2微信H5,3微信app,4微信Native,5微信小程序,6支付宝网页&移动应用,7支付宝小程序,8支付宝JSAPI Description string `json:"description"` // 商品描述 Amount int `json:"amount"` // 金额单位为分 PayerClientIp string `json:"payer_client_ip"` // 终端IP ReturnUrl string `json:"return_url"` // 支付成功后回调地址 - Wx WxPay `json:"wx"` - Ali AliPay `json:"ali"` + Wx WxPay `json:"wx"` // 微信支付参数 + Ali AliPay `json:"ali"` // 支付宝参数 + OpenId string `json:"open_id"` // 支付者信息。 openid } type WxPay struct { @@ -58,6 +59,10 @@ func PaymentService(c context.Context, payOrderRequest PayOrderRequest) PayOrder case payCommon.PAY_CHANNEL_ALIPAY_WEB: // 支付宝H5支付 info, err = ALiH5PayInfo(c, payOrderRequest) + case payCommon.PAY_CHANNEL_WECHAT_JSAPI: + // 微信JSAPI支付 + info, err = WxJsApiPayInfo(c, payOrderRequest) + default: payOrderResponse = PayOrderResponse{ Code: payCommon.PAY_NOT_FOUND_CODE, diff --git a/app/third/paymentService/payment_test.go b/app/third/paymentService/payment_test.go index 04ab37e..dd3f931 100644 --- a/app/third/paymentService/payment_test.go +++ b/app/third/paymentService/payment_test.go @@ -1,13 +1,17 @@ package paymentService import ( + "PaymentCenter/app/http/entities/backend" + "PaymentCenter/app/third/paymentService/payCommon" "PaymentCenter/config" "context" "crypto/md5" "encoding/hex" + "encoding/json" "encoding/pem" "errors" "fmt" + "github.com/bytedance/sonic" "github.com/go-pay/gopay" "github.com/qit-team/snow-core/kernel/server" "github.com/tjfoc/gmsm/x509" @@ -204,3 +208,263 @@ var allowSignatureAlgorithm = map[string]bool{ "SHA384-RSAPSS": true, "SHA512-RSAPSS": true, } + +func TestPaymentService(t *testing.T) { + c := context.Background() + //解析启动命令 + opts := config.GetOptions() + if opts.ShowVersion { + fmt.Printf("%s\ncommit %s\nbuilt on %s\n", server.Version, server.BuildCommit, server.BuildDate) + os.Exit(0) + } + + //加载配置 + opts.ConfFile = "../../../.env" + _, err := config.Load(opts.ConfFile) + if err != nil { + return + } + ////引导程序 + //err = bootstrap.Bootstrap(conf) + //if err != nil { + // return + //} + + data := `{"alipay_public_cert": "-----BEGIN CERTIFICATE-----\nMIIDszCCApugAwIBAgIQICQIBZUM3AD4AzStxXRIiTANBgkqhkiG9w0BAQsFADCBkTELMAkGA1UE\nBhMCQ04xGzAZBgNVBA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cSPDS6cdoMx2YECgYEAv+PxOsk3O0nxAD+VxKmUxtCZBnESz+ZlWblWbaOO02aSKT2E6bFMxbcLez5xiZUx+av7yb/RBRGQNbNeybHcL+KgfTywYAX7fEMGQjBrROlzQq29JWu+tVprnmG5108VWjbkQnEK95bTZKgQpiqbG3rSVnKHxhhQzqPr+KJnWP0CgYEAtkNdT7s40jvZUhfeAI8HQZmw7Og3QaK/AEQGkPRNwW1kAruAcEdl4lO2KnaQXj0I3TsHDWnTI3A+AFSHUE6JMhvWxmv6PRvXtfnMJDGcjZ9UoOJsoGIWC8QANYpkoq09a9dUfmJvmIzxICu0+u1eysME2U5w3JBqp1FQwHoVUF8CgYA+6Q43Rayz5WP7vtztIuPB4rWopP2T52cm6Vpqi4rRx/j3SFIBA721vHMpLqmuf5loz3e3BwoR7VYoJOxYl9UmZdhT9sekU5HFhXvRy2n/p8HABJHUaOSXNFPAEy4IZscLUp+3ILSFw47+mxMKR0Ge2r+G0/mremFTve4pD6VuSQKBgAMdY5rZOD9fhndAsSqRRy530e46ibc1cM4wW2xewHVtySfCzI8eqT8U7ygKnqz9ngkp2RUBmfohEO4wg597uByDHUiGz9/7edRCUJrNvj8tWeTl+bVD99x7nQVNOCsPit0s8OS4CfAxeG10UcN4CwasDokoLgWW8jupyBeB/ptBAoGAf/YJGqYGUogmL1otFf82BwglNfXHjdiFwqC1BLwlIuyOQDQE8nMPF6yKDv6xXY1Zm+zH5RBrIOcLRdF08jSUCfPV2yn2U2tWsC2MSq4n+y4pxqwsQgUXfqrabX3Zf1EEFf329ZhZHwrhDW3PshjEYuz8Yei8gK+44KBk0ZKJCVA="}` + + ali := backend.AliPayChannel{} + err = sonic.Unmarshal([]byte(data), &ali) + if err != nil { + fmt.Println(err) + return + } + + //"order_id": 3747002960422784848, "pay_channel": 2, "refund_amount": 500, "refund_order_id": 2017620703512514385, "refund_reason": "测试支付商品", + + request := PayOrderRequest{ + PayChannelId: 8935141660703064070, + OrderId: 37470029601111, + ChannelType: 6, + Description: "测试商品", + Amount: 100, + PayerClientIp: "192.168.110.235", + Ali: AliPay{ + AppId: "9021000139661858", + PrivateKey: "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCInowZf7/SgMxtVwU57DvS6Q1+3nke8GZ8Pb6gEwxntl+89cZNBi2wD/RDwFj0IxCH85rjaNeIztSmfdJMwPtlxo210lxQi1CWfXF+MoFAd+XZM+e/JWk4/3pCwlAI6BrlOEj026/pHudWw77ge9snibx+5FBugHCF/zymp8Mxu+N3pZbtlyo7sagU4OZsiwZmtqQwwnm1oxj6BhmE8aVlIxQWrs3MYhzDit2lETiPbidTBuQgLpLmlxss/PWPqBuni70Vhc82GrT0/2byGj9Ry0o9gD8DDHeyHhJNMJQU0PSFIFFLzwgXtNrkgSQzHyal6SHiZcf8Mw27pKdu6hXjAgMBAAECggEAbxoAdPwe0uFLXd/WsDQcsng0MWhat35o2cCctTDIdc8qLFDy4tCTdwqCalaSAHhDiUviOe2Y2fjZlkvcKe8Ggs3lkGdyC05ASyHYmfgYhIT8tpYvcJLL7z5T/tZmn9ehh6cuLXI6rColl7m4EHao0o6Aa/DgN/zbhRz8BcuIQXiKTTt9LEZSYtuuLk4BImrIwe7iIVgZ35VzW6Vp8EOhJW6PlQ+o0g1trph0lRTfY/3G+RCSOix2OV/meTMNeoOY2Jd957iaEUPWWlC+lGtnbFEHvw8DovOb1qCteeNutVxoDOpj4ndO1WItm43iIME6j2eIsQZBxI8NLpx2gzHZgQKBgQC/4/E6yTc7SfEAP5XEqZTG0JkGcRLP5mVZuVZto47TZpIpPYTpsUzFtwt7PnGJlTH5q/vJv9EFEZA1s17Jsdwv4qB9PLBgBft8QwZCMGtE6XNCrb0la761WmueYbnXTxVaNuRCcQr3ltNkqBCmKpsbetJWcofGGFDOo+v4omdY/QKBgQC2Q11PuzjSO9lSF94AjwdBmbDs6DdBor8ARAaQ9E3BbWQCu4BwR2XiU7YqdpBePQjdOwcNadMjcD4AVIdQTokyG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xntsKvZZj6vUTMb705gYgm\nVUMILwi/ZxKTQqBtkT/kQQ5y6nOZsj7XI5rYdz6qqOROrpvS/d7iypdHOMIM9Iz9DlL1mrCykbBi\nt25y+gTeXmuisHUwqaRpwtCGK4BayCqxRGbNipe6W73EK9lBrrzNtTr9NaysesT/v+l25JHCL9tG\nwpNr1oWFzk4IHVOg0ORiQ6SUgxZUTYcCAwEAAaMSMBAwDgYDVR0PAQH/BAQDAgTwMA0GCSqGSIb3\nDQEBCwUAA4IBAQBWThEoIaQoBX2YeRY/I8gu6TYnFXtyuCljANnXnM38ft+ikhE5mMNgKmJYLHvT\nyWWWgwHoSAWEuml7EGbE/2AK2h3k0MdfiWLzdmpPCRG/RJHk6UB1pMHPilI+c0MVu16OPpKbg5Vf\nLTv7dsAB40AzKsvyYw88/Ezi1osTXo6QQwda7uefvudirtb8FcQM9R66cJxl3kt1FXbpYwheIm/p\nj1mq64swCoIYu4NrsUYtn6CV542DTQMI5QdXkn+PzUUly8F6kDp+KpMNd0avfWNL5+O++z+F5Szy\n1CPta1D7EQ/eYmMP+mOQ35oifWIoFCpN6qQVBS/Hob1J/UUyg7BW\n-----END CERTIFICATE-----\n"), + }, + } + //// 支付 + //orderResult := PaymentService(c, request) + //t.Log(orderResult) + // + //// 查询订单 + //qreq := PayOrderQueryRequest{ + // OrderId: request.OrderId, + // PayChannel: 2, + // Wx: WxPay{}, + // Ali: request.Ali, + //} + //queryResult := PayOrderQuery(c, qreq) + //t.Log(queryResult) + + //// 退款 + //refund := OrderRefundRequest{ + // OrderId: 3747002960422784848, + // RefundOrderId: 2017620703512514385, + // RefundReason: "", + // RefundAmount: 500, + // PayChannel: 2, + // Wx: WxPay{}, + // Ali: request.Ali, + //} + //refundResult := OrderRefund(c, refund) + //t.Log(refundResult) + + // 关闭订单 + closeOrder := OrderCloseRequest{ + OrderId: request.OrderId, + PayChannel: 2, + Wx: WxPay{}, + Ali: request.Ali, + } + closeResutl := OrderClose(c, closeOrder) + t.Log(closeResutl) + +} + +func TestWechatPaymentService(t *testing.T) { + c := context.Background() + //解析启动命令 + opts := config.GetOptions() + if opts.ShowVersion { + fmt.Printf("%s\ncommit %s\nbuilt on %s\n", server.Version, server.BuildCommit, server.BuildDate) + os.Exit(0) + } + + //加载配置 + opts.ConfFile = "../../../.env" + _, err := config.Load(opts.ConfFile) + if err != nil { + return + } + ////引导程序 + //err = bootstrap.Bootstrap(conf) + //if err != nil { + // return + //} + + data := `{"api_v_3_key": "lsxdtvR2vOgGBu03u6wA0j9RnX5IP1Yq", "mch_id": "1647084265", "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7TG44IkSH7c/c\nFJ0+dTvcA9uYPdyIRFGRmtRBVEMP0S9q9MoVAuEeQ0/yxLmTmKb7/kAwShqNbwDU\niIm0y9b1jMpl1NM3lvEG5+LL1xMYKIRh2iOInoZSYpX46l5ME7FQwUq4GyoTg+5o\naIUKHXtzldzUR8/MXnpljYKL1oKb04vA627EMiUNm+Hajt4elhm3UXmOva1ohir7\nb69NEeleM4wjCxG+7ueuFIXlWqeAmXjYKb36C6xOeLbdlQeNg3BSEXmGFI5mDxM4\nlGf+zVWc5KcH9YVsq5D0UIziVHMUC91Za48fUgYjFb3Dho00IEjUqQwKuzCbZtkq\nD9mJ/0FRAgMBAAECggEAc4FO948qdClUZoTP9BSYNbarVdfQiLiZFRJGk4NDWB3J\nAEy10v9TlTYtt6laSIt7byv8qcsJVO9/s5IAWl7a0dNhfishlsafHYMjelHIlL1n\n5nCAOWCJtYTWuArQ3FnIn+SUD7Ww3RgfjoPmh7Zmy4FADim7HG2nTblXKKXBJhbg\nHI6X+7ltmZqMwG6Qb1Phq3WHPm4/Z0z+C3xs/2npikTMb8kY51GX54qJNamBO9G1\nY1pFsxwQ9Ep0V3BwX2Q+YJJFdBHeDVD0UvbO2GekArMgN48+OvkHBqajWFn1xOEB\n6Wp+j8qUue6fMcDFkq7ZY7hfEoBlZ+ZbCJNslYNiAQKBgQDzj/4q8+ChIWkLg5BZ\npaMaMV/goVrCH7HaF3DLxKTYKPWuRBpvW9xgx4tDDERhEZhDGgDoT+xSXdCTtYML\nWMBcvQnSn7JHSHa7CoAu/OwLMtKXSKtU3GO6nQeaifXL+Qi2U3JbIvwN34b7pzW0\n16a95qWVyXKlKM6dh0RKpit2lQKBgQDE3OtPgSiDMauZ+Cn9Sk1+aZ9jfizQZIUH\nkFGifsEgr/txTN2Gt4dIT+up0HSVpwfKLsHPS9wIJs38bivhWblchVEw5J1ZXPFQ\n27cs88B6LySw0dbsMRIceXQOhpm/118hr/QV0h4za99FP/1kGHGPrT4FsSw4FrNg\nBqF3hhUczQKBgBsspZ8FNrrDj4TJWQGniVsSxy+40Pd3sdAzbVJOzlWPvFmFH63t\nAdmKae9BHx/1ZpeV/yPsRuGptevFBKnvbQbr0Hy/dJSfcR/NPCAB+BQHx5c5dGQz\ncq0PeBm16sanMmGlTcz9SkIB/n11Wnii1ue5JCBiKXhj5SmOPgBWKeNBAoGARVZ2\nfwND7KmTAmEZEQCZuNuk6xsm16OAA4D+b9hrV4MEcgybvfZobLzRiXdFiOxS3xCG\n7OeQMULRrIZ1aCL9GaxPQ4RSM4Z77Hnm06tq8N4n8yuFop1J/sN8cB1Si/JkrG3X\n79OZFY16D18Rda7yWKOxQ7n6lCrStRDA0GNmjkUCgYEAnCd1PVJJ+VX7CXJ6gz7H\n0VXLAD+GUQzlnSzv6mgGWzn0acpVz9Q+o1qpxgNL/ehLTz+v3Nr7hexl77pUDVfJ\nS1zBopXaKx330eAJm4d0bKgKndHyfr7VJ6f5H/WezX7Q5jkm32D9/GPhJCfqBp3q\nWA/g+9g+fwkc78QKuQl7M68=\n-----END PRIVATE KEY-----\n", "serial_no": "318457037183AFED5B9A55C129007D9EFE737B18"}` + + wechat := backend.WechatPayChannel{} + err = json.Unmarshal([]byte(data), &wechat) + if err != nil { + fmt.Println(err) + return + } + + request := PayOrderRequest{ + PayChannelId: 6917529027641081867, + OrderId: 345812382113322, + ChannelType: 2, + Description: "测试退款商品", + Amount: 1, + PayerClientIp: "192.168.110.235", + //Wx: WxPay{ + // AppId: "wx0a9d03516e77308c", + // MchId: "1647084265", + // SerialNo: "318457037183AFED5B9A55C129007D9EFE737B18", + // ApiV3Key: "lsxdtvR2vOgGBu03u6wA0j9RnX5IP1Yq", + // //PrivateKey: "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7TG44IkSH7c/c\nFJ0+dTvcA9uYPdyIRFGRmtRBVEMP0S9q9MoVAuEeQ0/yxLmTmKb7/kAwShqNbwDU\niIm0y9b1jMpl1NM3lvEG5+LL1xMYKIRh2iOInoZSYpX46l5ME7FQwUq4GyoTg+5o\naIUKHXtzldzUR8/MXnpljYKL1oKb04vA627EMiUNm+Hajt4elhm3UXmOva1ohir7\nb69NEeleM4wjCxG+7ueuFIXlWqeAmXjYKb36C6xOeLbdlQeNg3BSEXmGFI5mDxM4\nlGf+zVWc5KcH9YVsq5D0UIziVHMUC91Za48fUgYjFb3Dho00IEjUqQwKuzCbZtkq\nD9mJ/0FRAgMBAAECggEAc4FO948qdClUZoTP9BSYNbarVdfQiLiZFRJGk4NDWB3J\nAEy10v9TlTYtt6laSIt7byv8qcsJVO9/s5IAWl7a0dNhfishlsafHYMjelHIlL1n\n5nCAOWCJtYTWuArQ3FnIn+SUD7Ww3RgfjoPmh7Zmy4FADim7HG2nTblXKKXBJhbg\nHI6X+7ltmZqMwG6Qb1Phq3WHPm4/Z0z+C3xs/2npikTMb8kY51GX54qJNamBO9G1\nY1pFsxwQ9Ep0V3BwX2Q+YJJFdBHeDVD0UvbO2GekArMgN48+OvkHBqajWFn1xOEB\n6Wp+j8qUue6fMcDFkq7ZY7hfEoBlZ+ZbCJNslYNiAQKBgQDzj/4q8+ChIWkLg5BZ\npaMaMV/goVrCH7HaF3DLxKTYKPWuRBpvW9xgx4tDDERhEZhDGgDoT+xSXdCTtYML\nWMBcvQnSn7JHSHa7CoAu/OwLMtKXSKtU3GO6nQeaifXL+Qi2U3JbIvwN34b7pzW0\n16a95qWVyXKlKM6dh0RKpit2lQKBgQDE3OtPgSiDMauZ+Cn9Sk1+aZ9jfizQZIUH\nkFGifsEgr/txTN2Gt4dIT+up0HSVpwfKLsHPS9wIJs38bivhWblchVEw5J1ZXPFQ\n27cs88B6LySw0dbsMRIceXQOhpm/118hr/QV0h4za99FP/1kGHGPrT4FsSw4FrNg\nBqF3hhUczQKBgBsspZ8FNrrDj4TJWQGniVsSxy+40Pd3sdAzbVJOzlWPvFmFH63t\nAdmKae9BHx/1ZpeV/yPsRuGptevFBKnvbQbr0Hy/dJSfcR/NPCAB+BQHx5c5dGQz\ncq0PeBm16sanMmGlTcz9SkIB/n11Wnii1ue5JCBiKXhj5SmOPgBWKeNBAoGARVZ2\nfwND7KmTAmEZEQCZuNuk6xsm16OAA4D+b9hrV4MEcgybvfZobLzRiXdFiOxS3xCG\n7OeQMULRrIZ1aCL9GaxPQ4RSM4Z77Hnm06tq8N4n8yuFop1J/sN8cB1Si/JkrG3X\n79OZFY16D18Rda7yWKOxQ7n6lCrStRDA0GNmjkUCgYEAnCd1PVJJ+VX7CXJ6gz7H\n0VXLAD+GUQzlnSzv6mgGWzn0acpVz9Q+o1qpxgNL/ehLTz+v3Nr7hexl77pUDVfJ\nS1zBopXaKx330eAJm4d0bKgKndHyfr7VJ6f5H/WezX7Q5jkm32D9/GPhJCfqBp3q\nWA/g+9g+fwkc78QKuQl7M68=\n-----END PRIVATE KEY-----\n", + //}, + Wx: WxPay{ + AppId: "wx0a9d03516e77308c", + MchId: wechat.MchId, + SerialNo: wechat.SerialNo, + ApiV3Key: wechat.ApiV3Key, + PrivateKey: wechat.PrivateKey, + }, + } + // 支付 + orderResult := PaymentService(c, request) + t.Log(orderResult) + + //// 查询订单 + //qreq := PayOrderQueryRequest{ + // OrderId: request.OrderId, + // PayChannel: 1, + // Wx: request.Wx, + // //Ali: request.Ali, + //} + //queryResult := PayOrderQuery(c, qreq) + //t.Log(queryResult) + + // 退款 + + //refundResult := OrderRefund(c, request) + + //// 关闭订单 + //closeOrder := OrderCloseRequest{ + // OrderId: request.OrderId, + // PayChannel: 2, + // Wx: WxPay{}, + // Ali: request.Ali, + //} + //closeResutl := OrderClose(c, closeOrder) + //t.Log(closeResutl) + +} + +// omFN66qdW0Z2b2H3zie-7ljxKTEI +// +// 微信 JSAPI 支付 +func TestWechatJSAPIPaymentService(t *testing.T) { + var err error + c := context.Background() + //解析启动命令 + opts := config.GetOptions() + if opts.ShowVersion { + fmt.Printf("%s\ncommit %s\nbuilt on %s\n", server.Version, server.BuildCommit, server.BuildDate) + os.Exit(0) + } + + //加载配置 + opts.ConfFile = "../../../.env" + _, err = config.Load(opts.ConfFile) + if err != nil { + return + } + ////引导程序 + //err = bootstrap.Bootstrap(conf) + //if err != nil { + // return + //} + + data := `{"api_v_3_key": "lsxdtvR2vOgGBu03u6wA0j9RnX5IP1Yq", "mch_id": "1647084265", "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7TG44IkSH7c/c\nFJ0+dTvcA9uYPdyIRFGRmtRBVEMP0S9q9MoVAuEeQ0/yxLmTmKb7/kAwShqNbwDU\niIm0y9b1jMpl1NM3lvEG5+LL1xMYKIRh2iOInoZSYpX46l5ME7FQwUq4GyoTg+5o\naIUKHXtzldzUR8/MXnpljYKL1oKb04vA627EMiUNm+Hajt4elhm3UXmOva1ohir7\nb69NEeleM4wjCxG+7ueuFIXlWqeAmXjYKb36C6xOeLbdlQeNg3BSEXmGFI5mDxM4\nlGf+zVWc5KcH9YVsq5D0UIziVHMUC91Za48fUgYjFb3Dho00IEjUqQwKuzCbZtkq\nD9mJ/0FRAgMBAAECggEAc4FO948qdClUZoTP9BSYNbarVdfQiLiZFRJGk4NDWB3J\nAEy10v9TlTYtt6laSIt7byv8q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Q+o1qpxgNL/ehLTz+v3Nr7hexl77pUDVfJ\nS1zBopXaKx330eAJm4d0bKgKndHyfr7VJ6f5H/WezX7Q5jkm32D9/GPhJCfqBp3q\nWA/g+9g+fwkc78QKuQl7M68=\n-----END PRIVATE KEY-----\n", "serial_no": "318457037183AFED5B9A55C129007D9EFE737B18"}` + data = `{"mch_id": "1647084265", "serial_no": "318457037183AFED5B9A55C129007D9EFE737B18", "api_v_3_key": "lsxdtvR2vOgGBu03u6wA0j9RnX5IP1Yq", "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7TG44IkSH7c/c\nFJ0+dTvcA9uYPdyIRFGRmtRBVEMP0S9q9MoVAuEeQ0/yxLmTmKb7/kAwShqNbwDU\niIm0y9b1jMpl1NM3lvEG5+LL1xMYKIRh2iOInoZSYpX46l5ME7FQwUq4GyoTg+5o\naIUKHXtzldzUR8/MXnpljYKL1oKb04vA627EMiUNm+Hajt4elhm3UXmOva1ohir7\nb69NEeleM4wjCxG+7ueuFIXlWqeAmXjYKb36C6xOeLbdlQeNg3BSEXmGFI5mDxM4\nlGf+zVWc5KcH9YVsq5D0UIziVHMUC91Za48fUgYjFb3Dho00IEjUqQwKuzCbZtkq\nD9mJ/0FRAgMBAAECggEAc4FO948qdClUZoTP9BSYNbarVdfQiLiZFRJGk4NDWB3J\nAEy10v9TlTYtt6laSIt7byv8qcsJVO9/s5IAWl7a0dNhfishlsafHYMjelHIlL1n\n5nCAOWCJtYTWuArQ3FnIn+SUD7Ww3RgfjoPmh7Zmy4FADim7HG2nTblXKKXBJhbg\nHI6X+7ltmZqMwG6Qb1Phq3WHPm4/Z0z+C3xs/2npikTMb8kY51GX54qJNamBO9G1\nY1pFsxwQ9Ep0V3BwX2Q+YJJFdBHeDVD0UvbO2GekArMgN48+OvkHBqajWFn1xOEB\n6Wp+j8qUue6fMcDFkq7ZY7hfEoBlZ+ZbCJNslYNiAQKBgQDzj/4q8+ChIWkLg5BZ\npaMaMV/goVrCH7HaF3DLxKTYKPWuRBpvW9xgx4tDDERhEZhDGgDoT+xSXdCTtYML\nWMBcvQnSn7JHSHa7CoAu/OwLMtKXSKtU3GO6nQeaifXL+Qi2U3JbIvwN34b7pzW0\n16a95qWVyXKlKM6dh0RKpit2lQKBgQDE3OtPgSiDMauZ+Cn9Sk1+aZ9jfizQZIUH\nkFGifsEgr/txTN2Gt4dIT+up0HSVpwfKLsHPS9wIJs38bivhWblchVEw5J1ZXPFQ\n27cs88B6LySw0dbsMRIceXQOhpm/118hr/QV0h4za99FP/1kGHGPrT4FsSw4FrNg\nBqF3hhUczQKBgBsspZ8FNrrDj4TJWQGniVsSxy+40Pd3sdAzbVJOzlWPvFmFH63t\nAdmKae9BHx/1ZpeV/yPsRuGptevFBKnvbQbr0Hy/dJSfcR/NPCAB+BQHx5c5dGQz\ncq0PeBm16sanMmGlTcz9SkIB/n11Wnii1ue5JCBiKXhj5SmOPgBWKeNBAoGARVZ2\nfwND7KmTAmEZEQCZuNuk6xsm16OAA4D+b9hrV4MEcgybvfZobLzRiXdFiOxS3xCG\n7OeQMULRrIZ1aCL9GaxPQ4RSM4Z77Hnm06tq8N4n8yuFop1J/sN8cB1Si/JkrG3X\n79OZFY16D18Rda7yWKOxQ7n6lCrStRDA0GNmjkUCgYEAnCd1PVJJ+VX7CXJ6gz7H\n0VXLAD+GUQzlnSzv6mgGWzn0acpVz9Q+o1qpxgNL/ehLTz+v3Nr7hexl77pUDVfJ\nS1zBopXaKx330eAJm4d0bKgKndHyfr7VJ6f5H/WezX7Q5jkm32D9/GPhJCfqBp3q\nWA/g+9g+fwkc78QKuQl7M68=\n-----END PRIVATE KEY-----\n"}` + + wechat := backend.WechatPayChannel{} + err = json.Unmarshal([]byte(data), &wechat) + if err != nil { + fmt.Println(err) + return + } + + request := PayOrderRequest{ + PayChannelId: 6917529027641081867, + OrderId: 345812382113322, + ChannelType: payCommon.PAY_CHANNEL_WECHAT_JSAPI, + Description: "测试退款商品", + Amount: 1, + PayerClientIp: "192.168.110.235", + //Wx: WxPay{ + // AppId: "wx0a9d03516e77308c", + // MchId: "1647084265", + // SerialNo: "318457037183AFED5B9A55C129007D9EFE737B18", + // ApiV3Key: "lsxdtvR2vOgGBu03u6wA0j9RnX5IP1Yq", + // //PrivateKey: "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQC7TG44IkSH7c/c\nFJ0+dTvcA9uYPdyIRFGRmtRBVEMP0S9q9MoVAuEeQ0/yxLmTmKb7/kAwShqNbwDU\niIm0y9b1jMpl1NM3lvEG5+LL1xMYKIRh2iOInoZSYpX46l5ME7FQwUq4GyoTg+5o\naIUKHXtzldzUR8/MXnpljYKL1oKb04vA627EMiUNm+Hajt4elhm3UXmOva1ohir7\nb69NEeleM4wjCxG+7ueuFIXlWqeAmXjYKb36C6xOeLbdlQeNg3BSEXmGFI5mDxM4\nlGf+zVWc5KcH9YVsq5D0UIziVHMUC91Za48fUgYjFb3Dho00IEjUqQwKuzCbZtkq\nD9mJ/0FRAgMBAAECggEAc4FO948qdClUZoTP9BSYNbarVdfQiLiZFRJGk4NDWB3J\nAEy10v9TlTYtt6laSIt7byv8qcsJVO9/s5IAWl7a0dNhfishlsafHYMjelHIlL1n\n5nCAOWCJtYTWuArQ3FnIn+SUD7Ww3RgfjoPmh7Zmy4FADim7HG2nTblXKKXBJhbg\nHI6X+7ltmZqMwG6Qb1Phq3WHPm4/Z0z+C3xs/2npikTMb8kY51GX54qJNamBO9G1\nY1pFsxwQ9Ep0V3BwX2Q+YJJFdBHeDVD0UvbO2GekArMgN48+OvkHBqajWFn1xOEB\n6Wp+j8qUue6fMcDFkq7ZY7hfEoBlZ+ZbCJNslYNiAQKBgQDzj/4q8+ChIWkLg5BZ\npaMaMV/goVrCH7HaF3DLxKTYKPWuRBpvW9xgx4tDDERhEZhDGgDoT+xSXdCTtYML\nWMBcvQnSn7JHSHa7CoAu/OwLMtKXSKtU3GO6nQeaifXL+Qi2U3JbIvwN34b7pzW0\n16a95qWVyXKlKM6dh0RKpit2lQKBgQDE3OtPgSiDMauZ+Cn9Sk1+aZ9jfizQZIUH\nkFGifsEgr/txTN2Gt4dIT+up0HSVpwfKLsHPS9wIJs38bivhWblchVEw5J1ZXPFQ\n27cs88B6LySw0dbsMRIceXQOhpm/118hr/QV0h4za99FP/1kGHGPrT4FsSw4FrNg\nBqF3hhUczQKBgBsspZ8FNrrDj4TJWQGniVsSxy+40Pd3sdAzbVJOzlWPvFmFH63t\nAdmKae9BHx/1ZpeV/yPsRuGptevFBKnvbQbr0Hy/dJSfcR/NPCAB+BQHx5c5dGQz\ncq0PeBm16sanMmGlTcz9SkIB/n11Wnii1ue5JCBiKXhj5SmOPgBWKeNBAoGARVZ2\nfwND7KmTAmEZEQCZuNuk6xsm16OAA4D+b9hrV4MEcgybvfZobLzRiXdFiOxS3xCG\n7OeQMULRrIZ1aCL9GaxPQ4RSM4Z77Hnm06tq8N4n8yuFop1J/sN8cB1Si/JkrG3X\n79OZFY16D18Rda7yWKOxQ7n6lCrStRDA0GNmjkUCgYEAnCd1PVJJ+VX7CXJ6gz7H\n0VXLAD+GUQzlnSzv6mgGWzn0acpVz9Q+o1qpxgNL/ehLTz+v3Nr7hexl77pUDVfJ\nS1zBopXaKx330eAJm4d0bKgKndHyfr7VJ6f5H/WezX7Q5jkm32D9/GPhJCfqBp3q\nWA/g+9g+fwkc78QKuQl7M68=\n-----END PRIVATE KEY-----\n", + //}, + Wx: WxPay{ + AppId: "wx0a9d03516e77308c", + MchId: wechat.MchId, + SerialNo: wechat.SerialNo, + ApiV3Key: wechat.ApiV3Key, + PrivateKey: wechat.PrivateKey, + }, + OpenId: "omFN66qdW0Z2b2H3zie-7ljxKTEI", + } + // 支付 + orderResult := PaymentService(c, request) + t.Log(orderResult) + + //// 查询订单 + //qreq := PayOrderQueryRequest{ + // OrderId: request.OrderId, + // PayChannel: 1, + // Wx: request.Wx, + // //Ali: request.Ali, + //} + //queryResult := PayOrderQuery(c, qreq) + //t.Log(queryResult) + + // 退款 + + //refundResult := OrderRefund(c, request) + + //// 关闭订单 + //closeOrder := OrderCloseRequest{ + // OrderId: request.OrderId, + // PayChannel: 2, + // Wx: WxPay{}, + // Ali: request.Ali, + //} + //closeResutl := OrderClose(c, closeOrder) + //t.Log(closeResutl) + +} diff --git a/app/third/paymentService/wechat_service.go b/app/third/paymentService/wechat_service.go index 7e7d1bb..e255ece 100644 --- a/app/third/paymentService/wechat_service.go +++ b/app/third/paymentService/wechat_service.go @@ -31,14 +31,14 @@ func InitClient(wxConfig WxPay) (*wechat.ClientV3, error) { wxConfig.ApiV3Key, wxConfig.PrivateKey, ) + if clientErr != nil { + return nil, clientErr + } // 启用自动同步返回验签,并定时更新微信平台API证书(开启自动验签时,无需单独设置微信平台API证书和序列号) clientErr = wxClient.AutoVerifySign() if wxClient == nil { return nil, errors.New("client not initialized") } - if clientErr != nil { - return nil, clientErr - } // 自定义配置http请求接收返回结果body大小,默认 10MB wxClient.SetBodySize(10) // 没有特殊需求,可忽略此配置 @@ -95,6 +95,49 @@ func WxH5PayInfo(c context.Context, payOrderRequest PayOrderRequest) (string, er return wxRsp.Response.H5Url, nil } +// 微信JSAPI支付 +func WxJsApiPayInfo(c context.Context, payOrderRequest PayOrderRequest) (string, error) { + // 初始化微信客户端 + wxClient, err := InitClient(payOrderRequest.Wx) + if err != nil { + return "", err + } + + expire := time.Now().Add(10 * time.Minute).Format(time.RFC3339) + // 初始化 BodyMap + envConfig := config.GetConf() + bm := make(gopay.BodyMap) + bm.Set("appid", payOrderRequest.Wx.AppId). + Set("mchid", payOrderRequest.Wx.MchId). + Set("description", payOrderRequest.Description). + Set("out_trade_no", strconv.FormatInt(payOrderRequest.OrderId, 10)). + Set("time_expire", expire). + Set("notify_url", fmt.Sprintf(envConfig.PayService.Host+payCommon.WX_NOTIFY_URL_TEST+"%d", payOrderRequest.PayChannelId)). + SetBodyMap("amount", func(bm gopay.BodyMap) { + bm.Set("total", payOrderRequest.Amount). + Set("currency", "CNY") + }). + SetBodyMap("payer", func(bm gopay.BodyMap) { + bm.Set("openid", payOrderRequest.OpenId) + }) + + wxRsp, err := wxClient.V3TransactionJsapi(c, bm) + if err != nil { + return "", err + } + if wxRsp.Code != wechat.Success || wxRsp.Response.PrepayId == "" { + //logger.Error(c, "WxJsApiPayInfo 发生错误", fmt.Sprintf("错误状态码:%d, 错误信息:%s", wxRsp.Code, wxRsp.Error)) + return "", errors.New(fmt.Sprintf("发起支付失败,失败状态码:%d, 失败原因:%s", wxRsp.Code, wxRsp.Error)) + } + //if payOrderRequest.ReturnUrl != "" { + // values := url.Values{} + // values.Set("redirect_url", payOrderRequest.ReturnUrl) + // encodedStr := values.Encode() + // //wxRsp.Response.H5Url = wxRsp.Response.H5Url + "&" + encodedStr + //} + return wxRsp.Response.PrepayId, nil +} + // WxPayCallBack 微信支付回调 func WxPayCallBack(notifyReq *wechat.V3NotifyReq, wxConfig WxPay) error { // 初始化微信客户端 diff --git a/app/utils/encrypt/rsa/rsa_test.go b/app/utils/encrypt/rsa/rsa_test.go index d6dae86..92567f6 100644 --- a/app/utils/encrypt/rsa/rsa_test.go +++ b/app/utils/encrypt/rsa/rsa_test.go @@ -8,9 +8,12 @@ import ( ) const ( - PRI = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCmjK6SPkrP03ssex5Dxn4KZeVm9rQoJMslru13GNgoGKJAq13xwUGl6lpGlhzM9IMzg0ldOO2a0SQPPjc0fLrDjIgHPfIT6H1hDGkZdPaF4D0OfiHGzlLwXq7FyyyGc2JXILsniMBXcCxNFhbW0jAaJyYrBJb3q84a5y5AtK3IC+eDV6Bj2J4HlQVGKgW9u2ic6Jxl23sacXY6iifi+KEuoXNCJrmYlgRWTaQovLmTCLkErkzxzG9DFRDWGoz25LthDPqcCSUmWEbJ+obwIGB4r2WCbFXvaeVBQORlyVRyNUvYMItj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0oMlkpC9gfPNKWA1DqiGH22MjRNzX2xz3WdE+bsC+MVWCWjq988PtEX/H+ahpbxKAMHHm4jWSjSLhjrnDCCbYUraG7++uiTzx/Qcef4bq9PAA64ckZLtTfywQdkzi5iWhTzggA6I1gEMKxsoJB+wljyTufmFj12/cHOSrl8wXoHJtODEwC70maH0e2SKT0ZSCFN3G7f7iLgQEDsAl9jZYrC1x9WK9kWtzm4V1ej2wn2MFa5DuE4AzLvBJDyKQN8PHI1lMuTn2QBFDtNyCb53y2qylU7azUn6yq1LNMwsjuPQIDAQAB" ) func TestRsaEncrypt(t *testing.T) { @@ -19,7 +22,9 @@ func TestRsaEncrypt(t *testing.T) { func TestRsaDecrypt(t *testing.T) { data := "pPnAPy7v2SY9Fu0LFcQH8UBA6VQ2FCfSg3nRZdMXS7mWjBwlacKHuFnh9UhobL7mxnmMyZPP100bpjCg2kvcfOpOp3ci85p+OYWINt4Fh3qgEOTG5FUyziaagGLm882t/I36KsDTVvbMZvC5sg4gZ9JQ5yAR+nuJfr0IxI0se/iD5luV1rms1kZHggd30iXdZtbkbX7xJ4xtnIiJmZU7kL+Xmvv1rDdPLxbol65QfnM1me1IHkXJapqSBnhEEmFQyBx31vp1ccNjkza8ZWbvTPCngc1k4kvlm6lKfwsG4hMuSdXUzveDm+Oo8StAKnyVoerJ202n7Vfx1XhehineQT0TPD7bO0HCEsDXXYEWwvcax8VdzYvHk7qSbH6e154qCr4LgDRSHKwAAExinTrzxx2rtSimieBLaEpDL2v5ch45HnhjRhWTRmM61W1g6sdHaVX1mQxaXvrT4v+h+f4TbIV4r4qeGJ6rXG+yKRoYseLzyGgystoOny9P0UH15W8rWPytV2eioWT7i3Cglg04BWP9mst67LQXeFH4CA6CkwVV2w9nCHrzxX2ouYSQELUEkTlIMry2AlkZubUnupGJLmLLUyZj7pM/6cLjyAgm02/gRc4wwf7JBBq/ipmKXpkhHXWLtQDWJEZTT+ug2v9EXy5dgPNPe8ZI0MILAeipjIc=" - privateKeyPEM := `-----BEGIN RSA PRIVATE KEY----- + data = "UaUJQUa2leqvgS5Brd0jjlMC4JFfQqavzk8VVSuHurBzC0l0Kz0EUY2nm8QRKB6ndCQZo4ktk/row+V1L/Zjn+3gBDhh4rNr0JNSvY/C+7AHpugvN+V8M0aEkFvZkaEaQiwjTExP8lz5w6Q/1O7Srb3KjnKs9wX97viyUbhUS4diGPCFnXLsWYnf6qSXvwNQwjgr3QykF45E2bN6VxsO/60OVZNN/yYgREe+IuuUyGvm+FlymnpMADGpDaViIOhqA77DNV4JkAsAv1Zjxtg+DFaeW9CcUOczw2yeQHXeEP/vzWfmcHXOZq17NKfSeiVotvLTUcT21UygD4oAUBPRmUTuqqa2095NCiNxxqFnRtHaWeY/dwp4ymNiHLFPh1HFwjVtvlazrEiLflsP0CI6zqn/bL8YhcV2VSSWx4g2YTTc3Xl56QeXa1PhdjSZg/apBRb/mEXTo1WNy/NQ5hVdNhtydB10WtA3YSr5vOEXSIbue4GJDYNNyMQTVBnfn3PTHl89/unlkFNI9AD60IfUCfhxOfg5Ddqa+8thTEBj4yOod/2dh6z2Dl7GZ7Ak0gWy1iFvFQm/6Y4p7dA44foAg9MwbV1wYbrdGauC5o7VRg0x6Sklzu/z5LeU4YUMruT0cd/Ov2kXkqiDyMn3GzdmIIWFadXISTbr7s1yU4uovn8=" + + privateKeyPEM := `-----BEGIN RSA PRIVATE KEY----- ` + PRI + ` -----END RSA PRIVATE KEY-----` res, err := Decrypt(privateKeyPEM, data) @@ -27,7 +32,7 @@ func TestRsaDecrypt(t *testing.T) { } func encrypt() string { - data := "{\"pay_channel_id\":8935141660703064070,\"out_trade_no\":\"refundOutTreadNo001\",\"amount\":1,\"desc\":\"退款\",\"ext_json\":\"\",\"app_id\":5476377146882523138,\"timestamp\":53612533412643,\"refund_out_trade_no\":\"asdadasdas\"}" + data := "{\"pay_channel_id\":1729382256910270476,\"out_trade_no\":\"zxp1234D56711tuikuan\",\"order_type\":1,\"amount\":1,\"desc\":\"测试支付宝退款商品zxp\",\"ext_json\":\"\",\"app_id\":8070450532247928844,\"timestamp\":1723096731}" pub := `-----BEGIN PUBLIC KEY----- ` + PUB + ` -----END PUBLIC KEY-----` diff --git a/app/utils/encrypt/sm2/sm2_test.go b/app/utils/encrypt/sm2/sm2_test.go index c445414..20744d3 100644 --- a/app/utils/encrypt/sm2/sm2_test.go +++ b/app/utils/encrypt/sm2/sm2_test.go @@ -1,6 +1,8 @@ package sm2 import ( + "encoding/base64" + "encoding/json" "fmt" "testing" ) @@ -38,7 +40,7 @@ func TestSM2Encrypt(t *testing.T) { } func TestSM2Decrypt(t *testing.T) { - en := "MDRkZDJkYzE1ZmIyZTdjMDRiNTlhZGM5OGM1NjBjM2RhZWVkMzhkMjljYjFkMmEyNjUzMmZlZDRkMWUxMjc5MjQxM2M5OTJiMTk5OWQ4MzgwOTdjYjhhMTU4ODA3OTNmZDNiM2FjZmE2NWNjNDAzZTgyODZjZjM5Y2NkMWU2NmJjY2EwNjU0N2NlNzM3N2M3YWViMmRmN2UzNGQ3YTIyMzI1NWJiMzU5NzljMDVlNjg2MTQzMGE4Y2VmNDZmMTU4YTYxNmI5ZjE2YTcwYzc0MTRhNmNmMWE2NWE5ZTE1YWM1ODBmODk1MWNiOWNhMzBlMDNhMjQzZmZjZWY4YjQzOWUzOGM5NmU0MGQyMTc5YjY5YThhNGQ3ZTQxMjZlMzA1MGZlNWIxZDI4Mzc0YjU3MmRiODBiMjFiMWY4NGYwNDBjYTE3NTRhN2FjMDk5Y2ZmZGI5MDM3NjIxYTE0ODAzNGIyOTU4NjA4ZDM4MzNlOGIwNDE4MWQ4NGUyMWU0OTNmZjYzNzNjMGQ4Y2M0ODVkYzM4NjZlYjZlOWZiYzVjZGFmMDExNWNiYWNiODA4Y2ZkYjczODlmZmJlZDliNmQzMDdiYTczY2EyOTVlOWNhM2RhZmNlNDk1YTZiNWI4NzFhYzdlN2U2ZTJmZWFlOGU3YTllOTFhYTE4ZGY4MzVkNWI2YjFkOGFkY2NhYW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pReVkySm1ORGMxTVdObFpHUTJOR05tTlRjPQ==" decrypt, err := SM2Decrypt(en, SELF_PUB, SELF_PRI) if err != nil { panic(err) @@ -47,10 +49,28 @@ func TestSM2Decrypt(t *testing.T) { } func encrypt() string { - data := "{\"order_no\":5476377146882523228,\"order_type\":1,\"out_tread_no\":\"asdadasdas\",\"amount\":1,\"desc\":\"abc\",\"status\":2,\"create_time\":\"2024-08-08 14:47:35\"}" + data := "{\"pay_channel_id\":1729382256910270476,\"out_trade_no\":\"zxp1234D56711tuikuan\",\"order_type\":1,\"amount\":1,\"desc\":\"测试支付宝退款商品zxp\",\"ext_json\":\"\",\"app_id\":1729382256910270475,\"timestamp\":1723096731}" + + //data := "{\"refund_out_trade_no\":\"zxp1234D56711tuikuan\",\"pay_channel_id\":1729382256910270476,\"out_trade_no\":\"4123412341234\",\"order_type\":2,\"amount\":1,\"desc\":\"测试支付宝退款商品zxp\",\"ext_json\":\"\",\"app_id\":1729382256910270475,\"timestamp\":1723096731}" en, err := SM2Encrypt(data, SELF_PUB) if err != nil { panic(err) } return en } + +func TestSm2Decode(t *testing.T) { + en := "TURRd1lUZGlZamt4T1RGbU9XWmhOR1pqTkRKa05HWmpORFkyTjJNd05qVmtNR1EwTTJNellUVmhPR1ZsTm1GbVpqZzFPRGMwTW1Oak5EQmtaRGszTkRrek5tRTVNREEwTkdFMFlXRXhaREl5T0RVME1ESmtObVk1TWpWaVpqYzNORGhoT1RObE0yVmtaVGc1T0dVellUZGlabU15WkRNNU1EQXpNR0ZsTm1Oa05XSTBPVEJpT1dFMU9XUTVObU15TURCaU9EVTNNR0UzWTJFNU9UYzVNalF3TnpFeVl6RTVZemd4TW1WbVpUQTNZbVV5WVRoaU1tRmtaak5tWkRjek1XVXdabVZrTlRnMVpUTXlNR0U0WldWaVlURXlNREExWWpnek1XRTBNVFk1WlRCa09ERXpaVGN6WWpJMFpEUmpOVFV5WlRRMU1HTmxNbVEwWlRkbU5tTTFaR1l5TUdZeU5XTXdNV1kwTVdFNU5EZGxaRFV3TnpjME9EWTFaVFJoWVRreU5HTm1ZVFU1WXpoa01USmxNREF3WTJOa01qRTVNell6T1RObFpXWXpNelEyTnpObU9HTTJaV00xTkdVd1ltRmhOVFZsWVRka09UQTFaRFZrTXpobVlqSTJabVEzWldFelptWmpNbU5tTldFd01tUmhOak5qTWpBeVl6azVaR0poT0RRMFpHTTJNbVJtTkdRM05Ea3dZems0TmprMk9UTmpNbVF3TnpFeE1qUmlaVFJpT1RrMk9UY3pNR0prTmpZNVpqYzFPRFJpWVRCbE5tTXdZV1JqTnpOak4yVmpaR1ExWmpJellUWmtaR1EwTVRCbE1qSTVZV1F5WW1GbFl6YzRPRGhsWXpjME5HTmlNekk0TnpRek1UZGhNak0xWVRWbFlUYzNNR1JsTVRZMU1tWmpOVEEzT1dVMllqSTNabUl5TVRNM09URmpPRFF4TXpsa09ETm1OelExWTJVNVlUTXlZams0TVRZd1pqUXdNV1k1TjJSbVpEazRZV1kxWXpZeE1USTRaREEzT0dRME5tVXlaQT09" + + content, _ := base64.StdEncoding.DecodeString(en) + + decrypt, err := SM2Decrypt(string(content), SELF_PUB, SELF_PRI) + if err != nil { + panic(err) + } + t.Log(decrypt) + + tempMap := make(map[string]interface{}) + json.Unmarshal([]byte(decrypt), &tempMap) + t.Log(tempMap) +} diff --git a/front/templates/index.html b/front/templates/index.html new file mode 100644 index 0000000..33c3b32 --- /dev/null +++ b/front/templates/index.html @@ -0,0 +1,52 @@ + + + + + + 微信授权登录 + + + + + + + diff --git a/go.mod b/go.mod index 8f8235e..c58f0d1 100644 --- a/go.mod +++ b/go.mod @@ -3,9 +3,7 @@ module PaymentCenter go 1.21 require ( - gitee.com/chengdu_blue_brothers/openapi-go-sdk v0.0.2 github.com/BurntSushi/toml v0.4.1 - github.com/Shopify/sarama v1.19.0 github.com/ZZMarquis/gm v1.3.2 github.com/ahmetb/go-linq/v3 v3.2.0 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible @@ -13,10 +11,12 @@ require ( github.com/forgoer/openssl v1.6.0 github.com/gin-gonic/gin v1.7.7 github.com/go-pay/gopay v1.5.103 + github.com/go-pay/util v0.0.2 github.com/go-playground/locales v0.14.0 github.com/go-playground/universal-translator v0.18.0 github.com/go-sql-driver/mysql v1.6.0 github.com/golang-jwt/jwt/v4 v4.5.0 + github.com/jinzhu/copier v0.4.0 github.com/nacos-group/nacos-sdk-go/v2 v2.2.5 github.com/nats-io/nats.go v1.9.1 github.com/openzipkin/zipkin-go v0.2.2 @@ -25,12 +25,12 @@ require ( github.com/qit-team/snow-core v0.1.28 github.com/qit-team/work v0.3.11 github.com/robfig/cron v1.2.0 - github.com/spf13/cobra v1.2.1 github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271 github.com/swaggo/gin-swagger v1.3.3 github.com/swaggo/swag v1.7.9 github.com/tjfoc/gmsm v1.4.1 github.com/valyala/fasthttp v1.31.0 + github.com/wechatpay-apiv3/wechatpay-go v0.2.20 google.golang.org/grpc v1.56.3 google.golang.org/protobuf v1.30.0 gopkg.in/go-playground/validator.v9 v9.31.0 @@ -55,13 +55,8 @@ require ( github.com/cespare/xxhash/v2 v2.2.0 // indirect github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect github.com/chenzhuoyu/iasm v0.9.1 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect - github.com/eapache/go-resiliency v1.1.0 // indirect - github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 // indirect - github.com/eapache/queue v1.1.0 // indirect github.com/emirpasic/gods v1.12.0 // indirect - github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-openapi/jsonpointer v0.19.5 // indirect github.com/go-openapi/jsonreference v0.19.6 // indirect @@ -69,7 +64,6 @@ require ( github.com/go-openapi/swag v0.19.15 // indirect github.com/go-pay/crypto v0.0.1 // indirect github.com/go-pay/errgroup v0.0.2 // indirect - github.com/go-pay/util v0.0.2 // indirect github.com/go-pay/xlog v0.0.3 // indirect github.com/go-pay/xtime v0.0.2 // indirect github.com/go-playground/validator/v10 v10.9.0 // indirect @@ -81,8 +75,6 @@ require ( github.com/google/uuid v1.3.0 // indirect github.com/hetiansu5/accesslog v1.0.0 // indirect github.com/hetiansu5/cores v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.0.0 // indirect - github.com/jinzhu/copier v0.4.0 // indirect github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect @@ -99,14 +91,11 @@ require ( github.com/nats-io/jwt v0.3.2 // indirect github.com/nats-io/nkeys v0.1.3 // indirect github.com/nats-io/nuid v1.0.1 // indirect - github.com/pierrec/lz4 v2.0.5+incompatible // indirect github.com/prometheus/client_model v0.2.0 // indirect github.com/prometheus/common v0.32.1 // indirect github.com/prometheus/procfs v0.7.3 // indirect - github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a // indirect github.com/rifflock/lfshook v0.0.0-20180920164130-b9218ef580f5 // indirect github.com/sirupsen/logrus v1.8.1 // indirect - github.com/spf13/pflag v1.0.5 // indirect github.com/syndtr/goleveldb v1.0.0 // indirect github.com/tidwall/gjson v1.12.1 // indirect github.com/tidwall/match v1.1.1 // indirect diff --git a/go.sum b/go.sum index ac6cc1d..f676eb0 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,6 @@ cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9 dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a h1:lSA0F4e9A2NcQSqGqTOXqu2aRi/XEQxDCBwM8yJtE6s= gitea.com/xorm/sqlfiddle v0.0.0-20180821085327-62ce714f951a/go.mod h1:EXuID2Zs0pAQhH8yz+DNjUbjppKQzKFAn28TMYPB6IU= -gitee.com/chengdu_blue_brothers/openapi-go-sdk v0.0.2 h1:f4Rj4jVshXYX7wl7aIrd7W9DbGfqxYrZ/c7ppoVL4a4= -gitee.com/chengdu_blue_brothers/openapi-go-sdk v0.0.2/go.mod h1:OEBHFTBQOvsJGzLyMZS8K98F8aZHWg+O8Stycuh94Dk= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.4.1 h1:GaI7EiDXDRfa8VshkTj7Fym7ha+y8/XxIgD2okUIjLw= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -53,14 +51,14 @@ github.com/PuerkitoBio/purell v1.1.1 h1:WEQqlqaGbrPkxLJWfBwQmfEAE1Z7ONdDLqrN38tN github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/Shopify/sarama v1.19.0 h1:9oksLxC6uxVPHPVYUmq6xhr1BOF/hHobWH2UzO67z1s= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= -github.com/Shopify/toxiproxy v2.1.4+incompatible h1:TKdv8HiTLgE5wdJuEML90aBgNWsokNbMijUGhmcoBJc= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= github.com/ZZMarquis/gm v1.3.2 h1:lFtpzg5zeeVMZ/gKi0gtYcKLBEo9XTqsZDHDz6s3Gow= github.com/ZZMarquis/gm v1.3.2/go.mod h1:wWbjZYgruQVd7Bb8UkSN8ujU931kx2XUW6nZLCiDE0Q= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= +github.com/agiledragon/gomonkey v2.0.2+incompatible h1:eXKi9/piiC3cjJD1658mEE2o3NjkJ5vDLgYjCQu0Xlw= +github.com/agiledragon/gomonkey v2.0.2+incompatible/go.mod h1:2NGfXu1a80LLr2cmWXGBDaHEjb1idR6+FVlX5T3D9hw= github.com/agiledragon/gomonkey/v2 v2.3.1 h1:k+UnUY0EMNYUFUAQVETGY9uUTxjMdnUkP0ARyJS1zzs= github.com/agiledragon/gomonkey/v2 v2.3.1/go.mod h1:ap1AmDzcVOAz1YpeJ3TCzIgstoaWLA6jbbgxfB4w2iY= github.com/ahmetb/go-linq/v3 v3.2.0 h1:BEuMfp+b59io8g5wYzNoFe9pWPalRklhlhbiU3hYZDE= @@ -161,11 +159,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= -github.com/eapache/go-resiliency v1.1.0 h1:1NtRmCAqadE2FN4ZcN6g90TP3uk8cg9rn9eNK2197aU= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= -github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21 h1:YEetp8/yCZMuEPMUDHG0CW/brkkEp8mzqk2+ODEitlw= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= -github.com/eapache/queue v1.1.0 h1:YOEu7KNc61ntiQlcEeUIoDTJ2o8mQznoNvUhiigpIqc= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= github.com/emirpasic/gods v1.12.0 h1:QAUIPSaCu4G+POclxeqb3F+WPpdKqFGlw36+yOzGlrg= @@ -188,7 +183,6 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1 h1:mZcQUHVQUQWoPXXtuf9yuEXKudkV2sx1E06UadKWpgI= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= -github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6 h1:6VSn3hB5U5GeA6kQw4TwWIWbOhtvR2hmbBJnTOtqTWc= github.com/fvbock/endless v0.0.0-20170109170031-447134032cb6/go.mod h1:YxOVT5+yHzKvwhsiSIWmbAYM3Dr9AEEbER2dVayfBkg= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/gzip v0.0.3 h1:etUaeesHhEORpZMp18zoOhepboiWnFtXrBZxszWUn4k= @@ -393,7 +387,6 @@ github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpO github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= github.com/jackc/chunkreader v1.0.0/go.mod h1:RT6O25fNZIuasFJRyZ4R/Y2BbhasbmZXF9QQ7T3kePo= @@ -609,7 +602,6 @@ github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtP github.com/pelletier/go-toml v1.9.3/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= -github.com/pierrec/lz4 v2.0.5+incompatible h1:2xWsjqPFWcplujydGg4WmhC/6fZqK42wMM8aXeqhl0I= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -655,7 +647,6 @@ github.com/qit-team/snow-core v0.1.28 h1:RrX7i6GLbcMMSVzAT1lXgS/S3M2b1OrAnsoPaRG github.com/qit-team/snow-core v0.1.28/go.mod h1:J9CNj6P2IRh72yVa7rut4T8ikq/4DjaisLqXZy40TNg= github.com/qit-team/work v0.3.11 h1:AAtLTCOJ01WMFcvviK9rDGhHzaHE3bvunMOnSZ/80k8= github.com/qit-team/work v0.3.11/go.mod h1:h5m1cZjn+BznChuAyMiR/+IUyWEmaMylPKRhq/AlxKw= -github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a h1:9ZKAASQSHhDYGoxY8uLVpewe1GDZ2vu2Tr/vTdVAkFQ= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk= github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo= @@ -703,11 +694,9 @@ github.com/sony/gobreaker v0.4.1/go.mod h1:ZKptC7FHNvhBz7dN2LGjPVBz2sZJmc0/PkyDJ github.com/spf13/afero v1.6.0/go.mod h1:Ai8FlHk4v/PARR026UzYexafAt9roJ7LcLMAmO6Z93I= github.com/spf13/cast v1.3.1/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.2.1 h1:+KmjbUw1hriSNMF55oPrkZcb27aECyrj8V2ytv7kWDw= github.com/spf13/cobra v1.2.1/go.mod h1:ExllRjgxM/piMAM+3tAZvg8fsklGAf3tPfi+i8t68Nk= github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -769,6 +758,8 @@ github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPU github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc= +github.com/wechatpay-apiv3/wechatpay-go v0.2.20 h1:gS8oFn1bHGnyapR2Zb4aqTV6l4kJWgbtqjCq6k1L9DQ= +github.com/wechatpay-apiv3/wechatpay-go v0.2.20/go.mod h1:A254AUBVB6R+EqQFo3yTgeh7HtyqRRtN2w9hQSOrd4Q= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=