From 87ece44a9a4ee2a03b06db0408624a174aa83a7b Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Mon, 5 Feb 2024 01:15:29 +0800 Subject: [PATCH] wechat --- etc/mix/mix-local.yaml | 6 -- etc/mix/mix-prod.yaml | 34 ++++++++-- etc/mix/wxpaycert/apiclient_cert.p12 | Bin 0 -> 2774 bytes etc/mix/wxpaycert/apiclient_cert.pem | 25 ++++++++ library/configcenter/configcenter.go | 2 + library/payclients/wxpaycli/client.go | 14 ++-- library/payclients/wxpaycli/client_test.go | 71 +++++++++++++++++++++ 7 files changed, 136 insertions(+), 16 deletions(-) create mode 100644 etc/mix/wxpaycert/apiclient_cert.p12 create mode 100644 etc/mix/wxpaycert/apiclient_cert.pem create mode 100644 library/payclients/wxpaycli/client_test.go diff --git a/etc/mix/mix-local.yaml b/etc/mix/mix-local.yaml index 19029583..36bcec73 100644 --- a/etc/mix/mix-local.yaml +++ b/etc/mix/mix-local.yaml @@ -47,12 +47,6 @@ alipay: appid: "2021004115647165" private_key: "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCeA8ADj0arLzUK5B3R5bqbOkXm8TBe0dI6XpefxnHeNyksEFhQuWTFtQA550lGj/VMyNQC0R+gL6VK/5SdgonzxMx8bC+/1lIWrl3Q8F+JLsAUcNh6C+WzDw7m5YSrG9361f3+i/gPVC4GRTzx91qLdk1ySGZv/GpSVv49k9qtD83gRCbxJq5FY1QA83Wb5xkJoMwl+SlKvFLNxIIzPQh9DvDF+32FTsVQgm3sX1lsArTA4yp7Y4SG3A8mkOanidYX1KiUawMBWaDgZi1CMpQ+Zbb3w0C0txCeZ8ek5JeUw2EYHJ0awMnFE6+vPDm1LNJ0DodkvszGbmLvXQS2eMfVAgMBAAECggEABj1nq7xQshnfIlr3wn4r7E1UzVXg7x2iC6QIoMqZXIkZGyBaHHX1wMjxBVhY0GyG501W8fWIJi87e8az+7RX9kRjPtaW3CB+hV7FXabgXu51r1j1c3xcycFieU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VRCoLeK+JawP43VLJ+g=" -wxpay: - mchid: "" - appid: "" - - - apollo: app_id: "wishpal_live_service" cluster: "dev" diff --git a/etc/mix/mix-prod.yaml b/etc/mix/mix-prod.yaml index 1c7f5066..17aafbce 100644 --- a/etc/mix/mix-prod.yaml +++ b/etc/mix/mix-prod.yaml @@ -45,11 +45,37 @@ alipay: wxpay: mchid: "1665016206" - appid: "xxxx" + appid: "wxb1acd21d9c4942cc" + serial_no: "51D8E75620B9569F10FF5363022F3C9D2152DF50" apiv3_key: "UoaswgnuKYwIadqxCVag1IZlq5n9USvt" - private_key: "MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDgxWmqIZVZEVdO/XNOzc66UkyYAS6/LzTAWP6WW/wIfilaDSDAe99jUspFKl1YmubJkDJ5Y2WaHcOyirgfYX3GHMrr1x7vtqON6eQPiGShlf9HlOQCdi1zmUrBeMWj5Tcll+ldyazYaqR4yG6ahhj1BnsqZ+W6Sa9xtTfMtTUrBvJuHm4dWAQR62A2Teetk9YN9cxiOwL7BXaJo5hYaumNobz7pIz6XHqBgEhBH6Qv8ka746NOR1UFSvMeqHWv+uyBzUthdIKFLCREgQmFToXs7oJsuF2nshZKnMPta3Xvi8wbPbAZc4b4KwLLv9SxBKiRhztagF8KqYn1k4RB8mFDAgMBAAECggEAFfMxXmvpKcmHvS8DE68FgSyITk/PQNxbSm1mb0iMVEf9wc2GZUWziv+KwTZh50U5RHXQeAo84dAGTGk/kdDzd2VYa6+WVdKAJluw6dNoAF+ljlf77EGeLqvJoRsqMdcwi3tKTt5jAr9nUGRCaNSvmz4GyR1cUdTgTTplOJh5mLnmGGZQPVR87pex00QCTtQ7dggG/vg8QM+XbBeSAkWByeUDsrCo4pKbsY+kxKGCkhV03hxgHz2v7QZ8kanbgVPZzB76tOxRf9ghUQ5TFPc9kjgtQmn5ViqzMTXdotFXlE/un82BreEK03E9kWE3Uvt9jf21oJkQGQsRqTNYd8uIAQKBgQDyNOIIOnO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ADBlkIJqZzA7wSt8iNGwcNCuhNON75AoGBAOGA +GXIj24RwM1Agr8UenHZix6HFsnh7YdazjT11RU7gYoTcnkUBvP5vpzaV10puX7D+ +JvOJrTjmK3k5xJkIPaWq/rEBu6yZ45DwHEV9I81h3BSErX852nswVGznprzXq1tI +KoE5BoLfwMqU90nkqsVT9mgbb2W5ZINrsI/uK0RjAoGBAL+9L8iJx6/M4yQosTrQ +IL6SOxPU3HlfkqZzObiQ8vs7VdIpGhB1EMc9UEKe8RcnpTUeLsVeNHdiDZzRHtJ3 +RxZS/AsjJtYAZ2f/maJhgQsh6JN1AceDhMhx1iTsjr/ockyUZuXKiCr5Q43tzrMJ +tMrOrkquEUSn+XDIomat7Bnw +-----END PRIVATE KEY-----" apollo: app_id: "wishpal_live_service" cluster: "dev" diff --git a/etc/mix/wxpaycert/apiclient_cert.p12 b/etc/mix/wxpaycert/apiclient_cert.p12 new file mode 100644 index 0000000000000000000000000000000000000000..3536f260df0fe685c8a9bc60fe9f3678f6f74523 GIT binary patch literal 2774 zcmY+^c{~(~76w4TBI_vSo--G?XP- zD#8rrM%P?rsj)^raiQfRs0{6!MZS+3??8wbzq4dFpKG-PYX1*IU(^ z)$a2d@y;F?UAF;q#E}x@lvhv|5b7w$JMQogd~3~Sk7qtUap^ZNaHY2>&o(ap>=bB3 zkH19QB&MW#Sf#&o>$+NuSMNnX%(5yU*Z*~3%o`G-HMy%Nmm*6v^8b^Vteu%Q6>waU zw37L9JWDL}^f4ji)qt(IwG6ab5z`-4ux0AMA76^BXxjS88kZ^jmO`Cv5bdpEop{N# z7pcS-ZFuMD7(aKB)52H2m|uTY&19QfB<3zQfb5GmEwKz&gLH(SXp1X)H{sJT+8zX; z_x*$Q^(b#8pKAVd(;=|E!_rzdm6WWRFYnfDO7}_R+>ehsz8A~qM>P|4G-ik{QtXpg zpFx8+N$3&-D%j3ywN8)ZLn69{`e=QnTi{gR zt8x9|{JjoBv2PcaijFQnl0VH-)1A+DR)s$o@i^M`ye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X5NPrJi9(ozd%ETxKW}xS11OOqP44j67=&k|duE&`w^pc3> R$FbEw7RO2Kcq>(T>R&LLETI4Z literal 0 HcmV?d00001 diff --git a/etc/mix/wxpaycert/apiclient_cert.pem b/etc/mix/wxpaycert/apiclient_cert.pem new file mode 100644 index 00000000..4fe4e212 --- /dev/null +++ b/etc/mix/wxpaycert/apiclient_cert.pem @@ -0,0 +1,25 @@ +-----BEGIN CERTIFICATE----- +MIIEKDCCAxCgAwIBAgIUUdjnViC5Vp8Q/1NjAi88nSFS31AwDQYJKoZIhvcNAQEL +BQAwXjELMAkGA1UEBhMCQ04xEzARBgNVBAoTClRlbnBheS5jb20xHTAbBgNVBAsT +FFRlbnBheS5jb20gQ0EgQ2VudGVyMRswGQYDVQQDExJUZW5wYXkuY29tIFJvb3Qg +Q0EwHhcNMjQwMTMwMDIxMDEyWhcNMjkwMTI4MDIxMDEyWjCBgTETMBEGA1UEAwwK +MTY2NTAxNjIwNjEbMBkGA1UECgwS5b6u5L+h5ZWG5oi357O757ufMS0wKwYDVQQL +DCTmiJDpg73lv4PmhI/liLDkuobnp5HmioDmnInpmZDlhazlj7gxCzAJBgNVBAYT +AkNOMREwDwYDVQQHDAhTaGVuWmhlbjCCASIwDQYJKoZIhvcNAQEBBQADggEPADCC +AQoCggEBAODFaaohlVkRV079c07NzrpSTJgBLr8vNMBY/pZb/Ah+KVoNIMB732NS +ykUqXVia5smQMnljZZodw7KKuB9hfcYcyuvXHu+2o43p5A+IZKGV/0eU5AJ2LXOZ +SsF4xaPlNyWX6V3JrNhqpHjIbpqGGPUGeypn5bpJr3G1N8y1NSsG8m4ebh1YBBHr +YDZN562T1g31zGI7AvsFdomjmFhq6Y2hvPukjPpceoGASEEfpC/yRrvjo05HVQVK +8x6oda/67IHNS2F0goUsJESBCYVOhezugmy4XaeyFkqcw+1rde+LzBs9sBlzhvgr +Asu/1LEEqJGHO1qAXwqpifWThEHyYUMCAwEAAaOBuTCBtjAJBgNVHRMEAjAAMAsG +A1UdDwQEAwID+DCBmwYDVR0fBIGTMIGQMIGNoIGKoIGHhoGEaHR0cDovL2V2Y2Eu +aXRydXMuY29tLmNuL3B1YmxpYy9pdHJ1c2NybD9DQT0xQkQ0MjIwRTUwREJDMDRC +MDZBRDM5NzU0OTg0NkMwMUMzRThFQkQyJnNnPUhBQ0M0NzFCNjU0MjJFMTJCMjdB +OUQzM0E4N0FEMUNERjU5MjZFMTQwMzcxMA0GCSqGSIb3DQEBCwUAA4IBAQAcaVb/ +Eg+fOt1qPr9we38kzUwVRktgamFB3hRfKvZpva3hx4lh8ZC3Et7bIP/r4IV5qCNC +wzN1Niq0aBXtnehOWL+mnnBmmW5QnB80UX1/yFxtaBEK+6R6IObAj7ClUSb0F8ak +0fRkCyWGl985sAUyZVE5g0jQEEcWFhdV9lpwPdprY4S9vck+cCfjPi4EyxEzRh7z +knsvZbjoj/0oTSKgg39D4UEQl6X0e3YR74kIXfKmFK08WxoKKet201pL3bzJKBAY +s+8VBqAKsTvNZJ1/GYPqax7ArpACX4LjgmzCv7/rrM75ce6rXWlkIOBSAz2dHuF0 +Q6iPI92vMh32p19Q +-----END CERTIFICATE----- diff --git a/library/configcenter/configcenter.go b/library/configcenter/configcenter.go index d7606c5b..49e9a27e 100644 --- a/library/configcenter/configcenter.go +++ b/library/configcenter/configcenter.go @@ -64,9 +64,11 @@ type RedisConfig struct { // 微信支付客户端配置 type WxpayClientConfig struct { MchId string `json:"mchid" yaml:"mchid"` // 商户id + AppId string `json:"appid" yaml:"appid"` // appid SerialNo string `json:"serial_no" yaml:"serial_no"` // 商户API证书的证书序列号 ApiV3Key string `json:"apiv3_key" yaml:"apiv3_key"` // APIv3Key,商户平台获取 PrivateKey string `json:"private_key" yaml:"private_key"` // 商户API证书下载后,私钥 apiclient_key.pem 读取后的字符串内容 + NotifyUrl string `json:"notify_url" yaml:"notify_url"` // 回调地址 } // 账号相关验密配置 diff --git a/library/payclients/wxpaycli/client.go b/library/payclients/wxpaycli/client.go index 44598bf2..f4aeb822 100644 --- a/library/payclients/wxpaycli/client.go +++ b/library/payclients/wxpaycli/client.go @@ -36,7 +36,9 @@ func Init(cfg *configcenter.WxpayClientConfig) (err error) { } defaultWxpayClient = &WxpayClient{ - ClientV3: wxpayCli, + ClientV3: wxpayCli, + AppId: cfg.AppId, + NotifyUrl: cfg.NotifyUrl, } return } @@ -51,7 +53,7 @@ type NativePayParam struct { TimeOutSeconds int // 订单有效时间,单位:秒 } -func (c *WxpayClient) NativePay(ctx context.Context, param *NativePayParam) { +func (c *WxpayClient) NativePay(ctx context.Context, param *NativePayParam) (resp *wxpay.NativeRsp, err error) { if param.TimeOutSeconds <= 0 { param.TimeOutSeconds = DefaultOrderTimeoutSeconds } @@ -66,14 +68,14 @@ func (c *WxpayClient) NativePay(ctx context.Context, param *NativePayParam) { "currency": "CNY", }, } - wxRsp, err := c.V3TransactionNative(ctx, bm) + resp, err = c.V3TransactionNative(ctx, bm) if err != nil { return } - if wxRsp.Code != wxpay.Success { - logger.Info("wxpay NativePay resp, fail: %v", util.ToJson(wxRsp)) + if resp.Code != wxpay.Success { + logger.Info("wxpay NativePay resp, fail: %v", util.ToJson(resp)) return } - logger.Info("wxpay NativePay resp, success: %v", util.ToJson(wxRsp)) + logger.Info("wxpay NativePay resp, success: %v", util.ToJson(resp)) return } diff --git a/library/payclients/wxpaycli/client_test.go b/library/payclients/wxpaycli/client_test.go new file mode 100644 index 00000000..a7ff80fd --- /dev/null +++ b/library/payclients/wxpaycli/client_test.go @@ -0,0 +1,71 @@ +package wxpaycli + +import ( + "context" + "fmt" + "os" + "service/bizcommon/util" + "service/library/configcenter" + "service/library/idgenerator" + "testing" +) + +func TestMain(m *testing.M) { + cfg := &configcenter.WxpayClientConfig{ + MchId: "1665016206", + AppId: "wxb1acd21d9c4942cc", + SerialNo: "51D8E75620B9569F10FF5363022F3C9D2152DF50", + ApiV3Key: "UoaswgnuKYwIadqxCVag1IZlq5n9USvt", + PrivateKey: `-----BEGIN PRIVATE KEY-----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jHSx2VExTeRJ30XGd8lx3EEWHEbSboGPbf +G3gxm9a1nwKBgAdH06uPpj4k3WpubV0BiWvM24WCZPp2get4O1WJ0PI2ZcqPbBlQ +GtRZ8FwOhXFIEmz8W+r/eNZ153ErOXzj1NhdvWEEIT9dvMlVjypi62P/Cs/31KDn +C5edktlcVy1CV30CjkVmg6EP00ADBlkIJqZzA7wSt8iNGwcNCuhNON75AoGBAOGA +GXIj24RwM1Agr8UenHZix6HFsnh7YdazjT11RU7gYoTcnkUBvP5vpzaV10puX7D+ +JvOJrTjmK3k5xJkIPaWq/rEBu6yZ45DwHEV9I81h3BSErX852nswVGznprzXq1tI +KoE5BoLfwMqU90nkqsVT9mgbb2W5ZINrsI/uK0RjAoGBAL+9L8iJx6/M4yQosTrQ +IL6SOxPU3HlfkqZzObiQ8vs7VdIpGhB1EMc9UEKe8RcnpTUeLsVeNHdiDZzRHtJ3 +RxZS/AsjJtYAZ2f/maJhgQsh6JN1AceDhMhx1iTsjr/ockyUZuXKiCr5Q43tzrMJ +tMrOrkquEUSn+XDIomat7Bnw +-----END PRIVATE KEY-----`, + NotifyUrl: "https://api.tiefen.fun/vas/wxpay_callback", + } + err := Init(cfg) + if err != nil { + fmt.Println(err) + os.Exit(1) + } + m.Run() +} + +func TestWxpayClient_NativePay(t *testing.T) { + cli := GetDefaultWxpayClient() + resp, err := cli.NativePay(context.Background(), &NativePayParam{ + Description: "测试哈哈", + OutTradeNo: idgenerator.GenOrderId(), + TotalAmount: 1, + TimeOutSeconds: 3600 * 24, + }) + if err != nil { + fmt.Println(err.Error()) + return + } + t.Log(util.ToJson(resp)) + return +}