diff --git a/app/lib/alipay/api.go b/app/lib/alipay/api.go deleted file mode 100644 index 8b71df2..0000000 --- a/app/lib/alipay/api.go +++ /dev/null @@ -1,261 +0,0 @@ -package alipay - -import ( - "applet/app/cfg" - "applet/app/utils/logx" - "fmt" - - "github.com/iGoogle-ink/gopay" - "github.com/iGoogle-ink/gopay/alipay" -) - -// TradeAppPay is 支付宝APP支付 -// 抖音头条小程序使用APP调起 -func TradeAppPay(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS string, paySet *md.PayData) (string, error) { - //初始化支付宝客户端 - // appID 是在支付宝申请的APPID - // priKey 是支付宝私钥 - // subject 是支付订单的主题 - // orderID 是智莺这边生成的订单id - // amount 是付费金额 - // notiURL 通知地址url - // passback_params 回调通知参数 - - client := alipay.NewClient(appID, priKey, true) - client.DebugSwitch = gopay.DebugOn - //判断密钥的类型 - rsa_type := alipay.RSA2 - pkcs_type := alipay.PKCS1 - if RSA == "1" { - rsa_type = alipay.RSA - } - if PKCS == "1" { - pkcs_type = alipay.PKCS8 - } - if paySet.PayAliUseType == "1" { - rsa_type = alipay.RSA2 - pkcs_type = alipay.PKCS8 - } - //配置公共参数 - client.SetCharset("utf-8"). - SetSignType(rsa_type). - SetPrivateKeyType(pkcs_type) - if notiURL != "" { - client.SetNotifyUrl(notiURL) - } - //新支付宝支付 - if paySet.PayAliUseType == "1" { - appCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAppCertSn) - fmt.Println("-应用-") - fmt.Println(appCertSN) - if err != nil { - fmt.Println(err) - return "", err - } - if appCertSN == "" { - fmt.Println(err) - return "", err - } - client.SetAppCertSN(appCertSN) - //aliPayRootCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAlipayRootCertSn) - aliPayRootCertSN := "687b59193f3f462dd5336e5abf83c5d8_02941eef3187dddf3d3b83462e1dfcf6" - client.SetAliPayRootCertSN(aliPayRootCertSN) - aliPayPublicCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAlipayrsaPublicKey) - fmt.Println("-公钥-") - fmt.Println(aliPayPublicCertSN) - - if err != nil { - fmt.Println(err) - return "", err - } - if aliPayPublicCertSN == "" { - fmt.Println(err) - return "", err - } - client.SetAliPayPublicCertSN(aliPayPublicCertSN) - } - fmt.Println(client) - //请求参数 - body := make(gopay.BodyMap) - body.Set("subject", subject) - body.Set("body", subject) - body.Set("out_trade_no", orderID) - body.Set("total_amount", amount) - body.Set("timeout_express", "30m") - - // body.Set("passback_params", orderID) - //手机APP支付参数请求 - payParam, err := client.TradeAppPay(body) - if err != nil { - return "", logx.Warn(err) - } - return payParam, nil -} - -// TradeAppPay is 支付宝H5支付 -func TradeWapPay(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS, page_url string, paySet *md.PayData) (string, error) { - fmt.Println("notifyURL is:>>>>>>>>>>", notiURL) - //aliPayPublicKey := "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1wn1sU/8Q0rYLlZ6sq3enrPZw2ptp6FecHR2bBFLjJ+sKzepROd0bKddgj+Mr1ffr3Ej78mLdWV8IzLfpXUi945DkrQcOUWLY0MHhYVG2jSs/qzFfpzmtut2Cl2TozYpE84zom9ei06u2AXLMBkU6VpznZl+R4qIgnUfByt3Ix5b3h4Cl6gzXMAB1hJrrrCkq+WvWb3Fy0vmk/DUbJEz8i8mQPff2gsHBE1nMPvHVAMw1GMk9ImB4PxucVek4ZbUzVqxZXphaAgUXFK2FSFU+Q+q1SPvHbUsjtIyL+cLA6H/6ybFF9Ffp27Y14AHPw29+243/SpMisbGcj2KD+evBwIDAQAB" - privateKey := priKey - //判断密钥的类型 - rsa_type := alipay.RSA2 - pkcs_type := alipay.PKCS1 - if RSA == "1" { - rsa_type = alipay.RSA - } - if PKCS == "1" { - pkcs_type = alipay.PKCS8 - } - if paySet.PayAliUseType == "1" { - rsa_type = alipay.RSA2 - pkcs_type = alipay.PKCS8 - } - //初始化支付宝客户端 - // appId:应用ID - // privateKey:应用秘钥 - // isProd:是否是正式环境 - client := alipay.NewClient(appID, privateKey, true) - //配置公共参数 - client.SetCharset("utf-8"). - SetSignType(rsa_type). - SetPrivateKeyType(pkcs_type). - SetReturnUrl(page_url). - SetNotifyUrl(notiURL) - //新支付宝支付 - if paySet.PayAliUseType == "1" { - appCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAppCertSn) - if err != nil { - fmt.Println("appCertSn_err:>>>>>>>>", err) - return "", err - } - if appCertSN == "" { - fmt.Println(err) - return "", err - } - client.SetAppCertSN(appCertSN) - //aliPayRootCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAlipayRootCertSn) - //if err != nil { - // - // fmt.Println("rootcertsn_err:>>>>>>>>>>", err) - // fmt.Println("rootcertsn_err:>>>>>>>>>>", cfg.WxappletFilepath.URL) - // fmt.Println("rootcertsn_err:>>>>>>>>>>", paySet.PayAlipayRootCertSn) - // return "", err - //} - //if aliPayRootCertSN == "" { - // fmt.Println(err) - // return "", err - //} - aliPayRootCertSN := "687b59193f3f462dd5336e5abf83c5d8_02941eef3187dddf3d3b83462e1dfcf6" - client.SetAliPayRootCertSN(aliPayRootCertSN) - aliPayPublicCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAlipayrsaPublicKey) - if err != nil { - fmt.Println("publicCertSn_err:>>>>>>>>>>>", err) - return "", err - } - if aliPayPublicCertSN == "" { - fmt.Println(err) - return "", err - } - client.SetAliPayPublicCertSN(aliPayPublicCertSN) - } - //请求参数 - body := make(gopay.BodyMap) - body.Set("subject", subject) - body.Set("out_trade_no", orderID) - // quit_url is 用户付款中途退出返回商户网站的地址 - body.Set("quit_url", notiURL) - body.Set("total_amount", amount) - // product_code is 销售产品码,商家和支付宝签约的产品码 - body.Set("product_code", "QUICK_WAP_WAY") - //手机网站支付请求 - payUrl, err := client.TradeWapPay(body) - if err != nil { - return "", logx.Warn(err) - - } - return payUrl, nil -} - -// TradeAppPay is 支付宝小程序本身支付 -func TradeCreate(appID, priKey, subject, orderID, amount, notiURL, RSA, PKCS string, paySet *md.PayData) (*alipay.TradeCreateResponse, error) { - //aliPayPublicKey := "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA1wn1sU/8Q0rYLlZ6sq3enrPZw2ptp6FecHR2bBFLjJ+sKzepROd0bKddgj+Mr1ffr3Ej78mLdWV8IzLfpXUi945DkrQcOUWLY0MHhYVG2jSs/qzFfpzmtut2Cl2TozYpE84zom9ei06u2AXLMBkU6VpznZl+R4qIgnUfByt3Ix5b3h4Cl6gzXMAB1hJrrrCkq+WvWb3Fy0vmk/DUbJEz8i8mQPff2gsHBE1nMPvHVAMw1GMk9ImB4PxucVek4ZbUzVqxZXphaAgUXFK2FSFU+Q+q1SPvHbUsjtIyL+cLA6H/6ybFF9Ffp27Y14AHPw29+243/SpMisbGcj2KD+evBwIDAQAB" - privateKey := priKey - rsa_type := alipay.RSA2 - pkcs_type := alipay.PKCS1 - if RSA == "1" { - rsa_type = alipay.RSA - } - if PKCS == "1" { - pkcs_type = alipay.PKCS8 - } - if paySet.PayAliUseType == "1" { - rsa_type = alipay.RSA2 - pkcs_type = alipay.PKCS8 - } - //初始化支付宝客户端 - // appId:应用ID - // privateKey:应用私钥,支持PKCS1和PKCS8 - // isProd:是否是正式环境 - client := alipay.NewClient(appID, privateKey, true) - //配置公共参数 - client.SetCharset("utf-8"). - SetSignType(rsa_type). - SetPrivateKeyType(pkcs_type). - SetNotifyUrl(notiURL) - if paySet.PayAliUseType == "1" { - appCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAppCertSn) - if err != nil { - fmt.Println(err) - return nil, err - } - if appCertSN == "" { - fmt.Println(err) - return nil, err - } - client.SetAppCertSN(appCertSN) - //aliPayRootCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAlipayRootCertSn) - //if err != nil { - // fmt.Println(err) - // return nil, err - //} - //if aliPayRootCertSN == "" { - // fmt.Println(err) - // return nil, err - //} - aliPayRootCertSN := "687b59193f3f462dd5336e5abf83c5d8_02941eef3187dddf3d3b83462e1dfcf6" - client.SetAliPayRootCertSN(aliPayRootCertSN) - aliPayPublicCertSN, err := alipay.GetCertSN(cfg.WxappletFilepath.URL + "/" + paySet.PayAlipayrsaPublicKey) - if err != nil { - fmt.Println(err) - return nil, err - } - if aliPayPublicCertSN == "" { - fmt.Println(err) - return nil, err - } - client.SetAliPayPublicCertSN(aliPayPublicCertSN) - } - //请求参数 - body := make(gopay.BodyMap) - body.Set("subject", subject) - // 支付宝小程序支付时 buyer_id 为必传参数,需要提前获取,获取方法如下两种 - // 1、alipay.SystemOauthToken() 返回取值:rsp.SystemOauthTokenResponse.UserId - // 2、client.SystemOauthToken() 返回取值:aliRsp.SystemOauthTokenResponse.UserId - buyer_id, err := client.SystemOauthToken(body) - if err != nil { - return nil, logx.Warn(err) - } - body.Set("buyer_id", buyer_id) - body.Set("out_trade_no", orderID) - body.Set("total_amount", amount) - //创建订单 - aliRsp, err := client.TradeCreate(body) - - if err != nil { - return nil, logx.Warn(err) - } - logx.Warn("aliRsp:", *aliRsp) - logx.Warn("aliRsp.TradeNo:", aliRsp.Response.TradeNo) - return aliRsp, nil - -} diff --git a/app/lib/alipay/init.go b/app/lib/alipay/init.go new file mode 100644 index 0000000..fd7df1f --- /dev/null +++ b/app/lib/alipay/init.go @@ -0,0 +1,74 @@ +package alipay + +import ( + "applet/app/db" + "applet/app/utils/cache" + "code.fnuoos.com/EggPlanet/egg_models.git/src/implement" + "code.fnuoos.com/EggPlanet/egg_system_rules.git/enum" + "github.com/go-pay/gopay/alipay" + "github.com/iGoogle-ink/gopay" + "github.com/iGoogle-ink/gopay/pkg/xlog" +) + +type InitStruct struct { + IsProd bool `json:"is_prod" label:"是否生产环境"` + AlipayAppId string `json:"alipay_app_id" label:"支付宝商家应用appid"` + AlipayPrivateKey string `json:"alipay_private_key" label:"支付宝商家应用私钥"` + AlipayPublicKey string `json:"alipay_public_key" label:"支付宝商家应用公钥"` + AlipayPublicContentRSA2 []byte `json:"alipay_public_content_rsa_2" label:"支付宝公钥证书"` + AlipayRootContent []byte `json:"alipay_root_content" label:"支付宝根证书"` + AppPublicContent []byte `json:"app_public_content" label:"应用公钥证书"` +} + +// Init 初始化支付宝客户端 +// appid:应用ID +// privateKey:应用私钥,支持PKCS1和PKCS8 +// isProd:是否是正式环境,沙箱环境请选择新版沙箱应用。 +func Init(initData *InitStruct) (client *alipay.Client, err error) { + if initData == nil { + sysCfgDb := implement.NewSysCfgDb(db.Db, cache.GetPool().Get()) + sysCfgMap := sysCfgDb.SysCfgFindWithDb(enum.AlipayAppId, enum.AlipayPrivateKey, enum.AlipayPublicKey, enum.AlipayPublicContentRSA2, enum.AlipayRootContent, enum.AppPublicContent) + initData = &InitStruct{ + IsProd: true, + AlipayAppId: sysCfgMap[enum.AlipayAppId], + AlipayPrivateKey: sysCfgMap[enum.AlipayPrivateKey], + AlipayPublicKey: sysCfgMap[enum.AlipayPublicKey], + AlipayPublicContentRSA2: []byte(sysCfgMap[enum.AlipayPublicContentRSA2]), + AlipayRootContent: []byte(sysCfgMap[enum.AlipayRootContent]), + AppPublicContent: []byte(sysCfgMap[enum.AppPublicContent]), + } + } + + client, err = alipay.NewClient(initData.AlipayAppId, initData.AlipayPrivateKey, initData.IsProd) + if err != nil { + xlog.Error(err) + return + } + + // 自定义配置http请求接收返回结果body大小,默认 10MB + client.SetBodySize(10) // 没有特殊需求,可忽略此配置 + + // 打开Debug开关,输出日志,默认关闭 + client.DebugSwitch = gopay.DebugOn + + client.SetLocation(alipay.LocationShanghai). // 设置时区,不设置或出错均为默认服务器时间 + SetCharset(alipay.UTF8). // 设置字符编码,不设置默认 utf-8 + SetSignType(alipay.RSA2) // 设置签名类型,不设置默认 RSA2 + + // SetAppAuthToken("") //授权token + + //SetReturnUrl("https://www.fmm.ink"). // 设置返回URL + // SetNotifyUrl("https://www.fmm.ink"). // 设置异步通知URL + + // 传入 支付宝公钥证书 alipayPublicCert.crt 内容 + client.AutoVerifySign(initData.AlipayPublicContentRSA2) + + // 传入证书内容 + err = client.SetCertSnByContent(initData.AppPublicContent, initData.AlipayRootContent, initData.AlipayPublicContentRSA2) + if err != nil { + xlog.Debug("SetCertSn:", err) + return + } + + return +} diff --git a/app/lib/alipay/utils_test.go b/app/lib/alipay/utils_test.go new file mode 100644 index 0000000..9e037c5 --- /dev/null +++ b/app/lib/alipay/utils_test.go @@ -0,0 +1,41 @@ +package alipay + +import ( + "context" + "github.com/go-pay/gopay" + "github.com/go-pay/xlog" + "testing" +) + +func TestFundTransUniTransfer(t *testing.T) { + client, err := Init(&InitStruct{ + IsProd: true, + AlipayAppId: "2021005100673124", + AlipayPrivateKey: "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCMK7YWZigquw+Ywyw6QjXFjQqkR4TkIzxMKuB62vcG1ywvnYLLpmWDxZ9YJuxoZuxZTuoZtTnfZkvgHo8ik9rdMAB8CqK03fgnlHJp57Zzstl2+kqvKw3mypM0PYWcSB9M9WxmrWF8vKHcGzMu/IK0t0lT9cjnjTJCZjC4jHKXjqWIdua4MV/9swg5EoWov1ySa0feE1ZmcLPbZWkdum7BEK7gZcOpPXMQybLvqUun0PAo/Vyx+PfZj6zyXhCbhbEXJOaXyN6BtM1wYgN4XwT/RpVVuL/SJyRzH4f7bD0f7HItYnTOBts3GxLr4kIgBE9yeSofZ0K3jn+BT4FQs0SDAgMBAAECggEAC6vkGI9fDtfOn6i4uQ0kTxPEbBNsdFaewbTcRj6PTSmDi19xMaXkVAmTkBKFotfXHESe548Yh4qMDNhekMGA+uPxVmLIU4kcDaelsz3RCmc9BlQm/dj26l25ziLFSlMTECRrZ01OjcVjMOGu7F2oQIX2fCA+H1G5ep/ptKQ1MntUy9darg+cZlppNe0YTDi9MyZ9Nmk6Tx916u2/S3aNKfR/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UMFIwKAYIKwYBBQUHMAKGHGh0dHA6Ly9jYS5hbGlwYXku\nY29tL2NhNi5jZXIwJgYIKwYBBQUHMAGGGmh0dHA6Ly9jYS5hbGlwYXkuY29tOjgzNDAvMA0GCSqG\nSIb3DQEBCwUAA4IBAQBEcjNGQ0wE30h6/i9zSNdY1xFQmNfbN1qobqKyH1VvwTIHtURXnacDT/LS\nYRDxn8cqwvT2cetDkpZvihSsfvU+B2PIYPUpfkyvswC13MzL3axkOv6KT/B5hqm+R8HMSNMtzq8W\ngJ/5OZ/7OTz9TAspajL+qfh9UG/KHUWFCfFIRxIIBcdtotL7vMTVtqMLruEj0U+gc+/n0XYkgqgi\naahaTPBVMJdJWINbaNQZlNG/XzQNLjfiCiZllKaPaE1RcZIAVGvYKQ8IL/elJTnU5RzqgjHtT6Iw\n2ETJqImGV6xR+7F2lG3CpdYdhOw2cuqpO9AVxZQkVg2EXCkbuMl2ig6H\n-----END CERTIFICATE-----"), + }) + if err != nil { + xlog.Error(err) + return + } + bm := make(gopay.BodyMap) + bm.Set("out_biz_no", "201806300011232301"). + Set("trans_amount", "0.01"). + Set("biz_scene", "DIRECT_TRANSFER"). + Set("product_code", "TRANS_ACCOUNT_NO_PWD"). + SetBodyMap("payee_info", func(bm gopay.BodyMap) { + bm.Set("identity", "1239118001@qq.com") + bm.Set("identity_type", "ALIPAY_LOGON_ID") + }) + + aliRsp, err := client.FundTransUniTransfer(context.Background(), bm) + if err != nil { + xlog.Error(err) + return + } + xlog.Debug("aliRsp:", *aliRsp) + xlog.Debug("aliRsp.Response:", aliRsp.Response) +} diff --git a/app/pkg/pb/business.ext.pb.go b/app/pkg/pb/business.ext.pb.go index f4da7f6..eb058fd 100644 --- a/app/pkg/pb/business.ext.pb.go +++ b/app/pkg/pb/business.ext.pb.go @@ -1406,7 +1406,6 @@ func (x *SearchUserResp) ProtoReflect() protoreflect.Message { return mi.MessageOf(x) } - // Deprecated: Use SearchUserResp.ProtoReflect.Descriptor instead. func (*SearchUserResp) Descriptor() ([]byte, []int) { return file_business_ext_proto_rawDescGZIP(), []int{19} diff --git a/go.mod b/go.mod index b01c893..b12fcb9 100644 --- a/go.mod +++ b/go.mod @@ -39,6 +39,7 @@ require ( code.fnuoos.com/go_rely_warehouse/zyos_go_mq.git v0.0.5 github.com/360EntSecGroup-Skylar/excelize v1.4.1 github.com/aliyun/aliyun-oss-go-sdk v3.0.2+incompatible + github.com/go-pay/gopay v1.5.106 github.com/go-sql-driver/mysql v1.8.1 github.com/gocolly/colly v1.2.0 github.com/olivere/elastic/v7 v7.0.32 @@ -67,6 +68,9 @@ require ( github.com/go-openapi/jsonreference v0.20.0 // indirect github.com/go-openapi/spec v0.20.11 // indirect github.com/go-openapi/swag v0.19.15 // indirect + github.com/go-pay/crypto v0.0.1 // indirect + github.com/go-pay/xlog v0.0.3 // indirect + github.com/go-pay/xtime v0.0.2 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.2 // indirect github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect @@ -83,6 +87,7 @@ require ( github.com/leodido/go-urn v1.4.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mattn/go-sqlite3 v2.0.3+incompatible // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect @@ -100,14 +105,14 @@ require ( go.uber.org/atomic v1.7.0 // indirect go.uber.org/multierr v1.6.0 // indirect golang.org/x/arch v0.7.0 // indirect - golang.org/x/crypto v0.22.0 // indirect + golang.org/x/crypto v0.27.0 // indirect golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect - golang.org/x/net v0.24.0 // indirect + golang.org/x/net v0.25.0 // indirect golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.26.0 // indirect - golang.org/x/text v0.15.0 // indirect + golang.org/x/text v0.18.0 // indirect golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect - golang.org/x/tools v0.20.0 // indirect + golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // indirect golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect google.golang.org/appengine v1.4.0 // indirect google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55 // indirect