Skip to content

Commit

Permalink
fix verify bug and update comment
Browse files Browse the repository at this point in the history
  • Loading branch information
iGoogle-ink committed Apr 25, 2020
1 parent ea74965 commit 7a86d0f
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 160 deletions.
58 changes: 29 additions & 29 deletions alipay/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ func NewClient(appId, privateKey string, isProd bool) (client *Client) {
}

// alipay.trade.fastpay.refund.query(统一收单交易退款查询)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.fastpay.refund.query
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.fastpay.refund.query
func (a *Client) TradeFastPayRefundQuery(bm gopay.BodyMap) (aliRsp *TradeFastpayRefundQueryResponse, err error) {
if bm.Get("out_trade_no") == gopay.NULL && bm.Get("trade_no") == gopay.NULL {
return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time")
Expand All @@ -70,7 +70,7 @@ func (a *Client) TradeFastPayRefundQuery(bm gopay.BodyMap) (aliRsp *TradeFastpay
}

// alipay.trade.order.settle(统一收单交易结算接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.order.settle
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.order.settle
func (a *Client) TradeOrderSettle(bm gopay.BodyMap) (aliRsp *TradeOrderSettleResponse, err error) {
err = bm.CheckEmptyError("out_request_no", "trade_no", "royalty_parameters")
if err != nil {
Expand All @@ -93,7 +93,7 @@ func (a *Client) TradeOrderSettle(bm gopay.BodyMap) (aliRsp *TradeOrderSettleRes
}

// alipay.trade.create(统一收单交易创建接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.create
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.create
func (a *Client) TradeCreate(bm gopay.BodyMap) (aliRsp *TradeCreateResponse, err error) {
err = bm.CheckEmptyError("out_trade_no", "total_amount", "subject")
if err != nil {
Expand All @@ -116,7 +116,7 @@ func (a *Client) TradeCreate(bm gopay.BodyMap) (aliRsp *TradeCreateResponse, err
}

// alipay.trade.close(统一收单交易关闭接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.close
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.close
func (a *Client) TradeClose(bm gopay.BodyMap) (aliRsp *TradeCloseResponse, err error) {
if bm.Get("out_trade_no") == gopay.NULL && bm.Get("trade_no") == gopay.NULL {
return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time")
Expand All @@ -138,7 +138,7 @@ func (a *Client) TradeClose(bm gopay.BodyMap) (aliRsp *TradeCloseResponse, err e
}

// alipay.trade.cancel(统一收单交易撤销接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.cancel
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.cancel
func (a *Client) TradeCancel(bm gopay.BodyMap) (aliRsp *TradeCancelResponse, err error) {
if bm.Get("out_trade_no") == gopay.NULL && bm.Get("trade_no") == gopay.NULL {
return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time")
Expand All @@ -160,7 +160,7 @@ func (a *Client) TradeCancel(bm gopay.BodyMap) (aliRsp *TradeCancelResponse, err
}

// alipay.trade.refund(统一收单交易退款接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.refund
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.refund
func (a *Client) TradeRefund(bm gopay.BodyMap) (aliRsp *TradeRefundResponse, err error) {
if bm.Get("out_trade_no") == gopay.NULL && bm.Get("trade_no") == gopay.NULL {
return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time")
Expand All @@ -186,7 +186,7 @@ func (a *Client) TradeRefund(bm gopay.BodyMap) (aliRsp *TradeRefundResponse, err
}

// alipay.trade.page.refund(统一收单退款页面接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.page.refund
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.page.refund
func (a *Client) TradePageRefund(bm gopay.BodyMap) (aliRsp *TradePageRefundResponse, err error) {
if bm.Get("out_trade_no") == gopay.NULL && bm.Get("trade_no") == gopay.NULL {
return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time")
Expand All @@ -212,7 +212,7 @@ func (a *Client) TradePageRefund(bm gopay.BodyMap) (aliRsp *TradePageRefundRespo
}

// alipay.trade.precreate(统一收单线下交易预创建)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.precreate
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.precreate
func (a *Client) TradePrecreate(bm gopay.BodyMap) (aliRsp *TradePrecreateResponse, err error) {
err = bm.CheckEmptyError("out_trade_no", "total_amount", "subject")
if err != nil {
Expand All @@ -239,7 +239,7 @@ func (a *Client) TradePrecreate(bm gopay.BodyMap) (aliRsp *TradePrecreateRespons
}

// alipay.trade.pay(统一收单交易支付接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.pay
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.pay
func (a *Client) TradePay(bm gopay.BodyMap) (aliRsp *TradePayResponse, err error) {
err = bm.CheckEmptyError("out_trade_no", "scene", "auth_code", "subject")
if err != nil {
Expand All @@ -262,7 +262,7 @@ func (a *Client) TradePay(bm gopay.BodyMap) (aliRsp *TradePayResponse, err error
}

// alipay.trade.query(统一收单线下交易查询)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.query
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.query
func (a *Client) TradeQuery(bm gopay.BodyMap) (aliRsp *TradeQueryResponse, err error) {
if bm.Get("out_trade_no") == gopay.NULL && bm.Get("trade_no") == gopay.NULL {
return nil, errors.New("out_trade_no and trade_no are not allowed to be null at the same time")
Expand All @@ -284,7 +284,7 @@ func (a *Client) TradeQuery(bm gopay.BodyMap) (aliRsp *TradeQueryResponse, err e
}

// alipay.trade.app.pay(app支付接口2.0)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.app.pay
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.app.pay
func (a *Client) TradeAppPay(bm gopay.BodyMap) (payParam string, err error) {
err = bm.CheckEmptyError("out_trade_no", "total_amount", "subject")
if err != nil {
Expand All @@ -299,7 +299,7 @@ func (a *Client) TradeAppPay(bm gopay.BodyMap) (payParam string, err error) {
}

// alipay.trade.wap.pay(手机网站支付接口2.0)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.wap.pay
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.wap.pay
func (a *Client) TradeWapPay(bm gopay.BodyMap) (payUrl string, err error) {
bm.Set("product_code", "QUICK_WAP_WAY")
err = bm.CheckEmptyError("out_trade_no", "total_amount", "subject")
Expand All @@ -315,7 +315,7 @@ func (a *Client) TradeWapPay(bm gopay.BodyMap) (payUrl string, err error) {
}

// alipay.trade.page.pay(统一收单下单并支付页面接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.page.pay
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.page.pay
func (a *Client) TradePagePay(bm gopay.BodyMap) (payUrl string, err error) {
bm.Set("product_code", "FAST_INSTANT_TRADE_PAY")
err = bm.CheckEmptyError("out_trade_no", "total_amount", "subject")
Expand All @@ -331,7 +331,7 @@ func (a *Client) TradePagePay(bm gopay.BodyMap) (payUrl string, err error) {
}

// alipay.fund.trans.toaccount.transfer(单笔转账到支付宝账户接口)
// 文档地址:https://docs.open.alipay.com/api_28/alipay.fund.trans.toaccount.transfer
// 文档地址:https://opendocs.alipay.com/apis/api_28/alipay.fund.trans.toaccount.transfer
// 注意:此接口官方以升级替换为 alipay.fund.trans.uni.transfer
func (a *Client) FundTransToaccountTransfer(bm gopay.BodyMap) (aliRsp *FundTransToaccountTransferResponse, err error) {
if bm.Get("out_biz_no") == gopay.NULL {
Expand All @@ -354,7 +354,7 @@ func (a *Client) FundTransToaccountTransfer(bm gopay.BodyMap) (aliRsp *FundTrans
}

// alipay.fund.trans.uni.transfer(单笔转账接口)
// 文档地址:https://docs.open.alipay.com/api_28/alipay.fund.trans.uni.transfer
// 文档地址:https://opendocs.alipay.com/apis/api_28/alipay.fund.trans.uni.transfer
func (a *Client) FundTransUniTransfer(bm gopay.BodyMap) (aliRsp *FundTransUniTransferResponse, err error) {
err = bm.CheckEmptyError("out_biz_no", "trans_amount", "product_code", "payee_info")
if err != nil {
Expand All @@ -377,7 +377,7 @@ func (a *Client) FundTransUniTransfer(bm gopay.BodyMap) (aliRsp *FundTransUniTra
}

// alipay.fund.trans.common.query(转账业务单据查询接口)
// 文档地址:https://docs.open.alipay.com/api_28/alipay.fund.trans.common.query
// 文档地址:https://opendocs.alipay.com/apis/api_28/alipay.fund.trans.common.query
func (a *Client) FundTransCommonQuery(bm gopay.BodyMap) (aliRsp *FundTransCommonQueryResponse, err error) {
var bs []byte
if bs, err = a.doAliPay(bm, "alipay.fund.trans.common.query"); err != nil {
Expand All @@ -396,7 +396,7 @@ func (a *Client) FundTransCommonQuery(bm gopay.BodyMap) (aliRsp *FundTransCommon
}

// alipay.fund.account.query(支付宝资金账户资产查询接口)
// 文档地址:https://docs.open.alipay.com/api_28/alipay.fund.account.query
// 文档地址:https://opendocs.alipay.com/apis/api_28/alipay.fund.account.query
func (a *Client) FundAccountQuery(bm gopay.BodyMap) (aliRsp *FundAccountQueryResponse, err error) {
err = bm.CheckEmptyError("alipay_user_id")
if err != nil {
Expand All @@ -419,13 +419,13 @@ func (a *Client) FundAccountQuery(bm gopay.BodyMap) (aliRsp *FundAccountQueryRes
}

// alipay.trade.orderinfo.sync(支付宝订单信息同步接口)
// 文档地址:https://docs.open.alipay.com/api_1/alipay.trade.orderinfo.sync
// 文档地址:https://opendocs.alipay.com/apis/api_1/alipay.trade.orderinfo.sync
func (a *Client) TradeOrderinfoSync(body gopay.BodyMap) {

}

// alipay.system.oauth.token(换取授权访问令牌)
// 文档地址:https://docs.open.alipay.com/api_9/alipay.system.oauth.token
// 文档地址:https://opendocs.alipay.com/apis/api_9/alipay.system.oauth.token
func (a *Client) SystemOauthToken(bm gopay.BodyMap) (aliRsp *SystemOauthTokenResponse, err error) {
if bm.Get("code") == gopay.NULL && bm.Get("refresh_token") == gopay.NULL {
return nil, errors.New("code and refresh_token are not allowed to be null at the same time")
Expand All @@ -452,7 +452,7 @@ func (a *Client) SystemOauthToken(bm gopay.BodyMap) (aliRsp *SystemOauthTokenRes

// alipay.user.info.share(支付宝会员授权信息查询接口)
// body:此接口无需body参数
// 文档地址:https://docs.open.alipay.com/api_2/alipay.user.info.share
// 文档地址:https://opendocs.alipay.com/apis/api_2/alipay.user.info.share
func (a *Client) UserInfoShare() (aliRsp *UserInfoShareResponse, err error) {
var bs []byte
if bs, err = a.doAliPay(nil, "alipay.user.info.share"); err != nil {
Expand All @@ -471,7 +471,7 @@ func (a *Client) UserInfoShare() (aliRsp *UserInfoShareResponse, err error) {
}

// alipay.open.auth.token.app(换取应用授权令牌)
// 文档地址:https://docs.open.alipay.com/api_9/alipay.open.auth.token.app
// 文档地址:https://opendocs.alipay.com/apis/api_9/alipay.open.auth.token.app
func (a *Client) OpenAuthTokenApp(bm gopay.BodyMap) (aliRsp *OpenAuthTokenAppResponse, err error) {
if bm.Get("code") == gopay.NULL && bm.Get("refresh_token") == gopay.NULL {
return nil, errors.New("code and refresh_token are not allowed to be null at the same time")
Expand All @@ -497,7 +497,7 @@ func (a *Client) OpenAuthTokenApp(bm gopay.BodyMap) (aliRsp *OpenAuthTokenAppRes
}

// zhima.credit.score.get(芝麻分)
// 文档地址:https://docs.open.alipay.com/api_8/zhima.credit.score.get
// 文档地址:https://opendocs.alipay.com/apis/api_8/zhima.credit.score.get
func (a *Client) ZhimaCreditScoreGet(bm gopay.BodyMap) (aliRsp *ZhimaCreditScoreGetResponse, err error) {
if bm.Get("product_code") == gopay.NULL {
bm.Set("product_code", "w1010100100000000001")
Expand All @@ -523,7 +523,7 @@ func (a *Client) ZhimaCreditScoreGet(bm gopay.BodyMap) (aliRsp *ZhimaCreditScore
}

// alipay.user.certify.open.initialize(身份认证初始化服务)
// 文档地址:https://docs.open.alipay.com/api_2/alipay.user.certify.open.initialize
// 文档地址:https://opendocs.alipay.com/apis/api_2/alipay.user.certify.open.initialize
func (a *Client) UserCertifyOpenInit(bm gopay.BodyMap) (aliRsp *UserCertifyOpenInitResponse, err error) {
err = bm.CheckEmptyError("outer_order_no", "biz_code", "identity_param", "merchant_config")
if err != nil {
Expand All @@ -546,8 +546,8 @@ func (a *Client) UserCertifyOpenInit(bm gopay.BodyMap) (aliRsp *UserCertifyOpenI
}

// alipay.user.certify.open.certify(身份认证开始认证)
// API文档地址:https://docs.open.alipay.com/api_2/alipay.user.certify.open.certify
// 产品文档地址:https://docs.open.alipay.com/20181012100420932508/quickstart
// API文档地址:https://opendocs.alipay.com/apis/api_2/alipay.user.certify.open.certify
// 产品文档地址:https://opendocs.alipay.com/open/20181012100420932508/quickstart
func (a *Client) UserCertifyOpenCertify(bm gopay.BodyMap) (certifyUrl string, err error) {
err = bm.CheckEmptyError("certify_id")
if err != nil {
Expand All @@ -562,7 +562,7 @@ func (a *Client) UserCertifyOpenCertify(bm gopay.BodyMap) (certifyUrl string, er
}

// alipay.user.certify.open.query(身份认证记录查询)
// 文档地址:https://docs.open.alipay.com/api_2/alipay.user.certify.open.query
// 文档地址:https://opendocs.alipay.com/apis/api_2/alipay.user.certify.open.query
func (a *Client) UserCertifyOpenQuery(bm gopay.BodyMap) (aliRsp *UserCertifyOpenQueryResponse, err error) {
err = bm.CheckEmptyError("certify_id")
if err != nil {
Expand All @@ -585,7 +585,7 @@ func (a *Client) UserCertifyOpenQuery(bm gopay.BodyMap) (aliRsp *UserCertifyOpen
}

// alipay.user.info.auth(用户登陆授权)
// 文档地址:https://docs.open.alipay.com/api_9/alipay.user.info.auth
// 文档地址:https://opendocs.alipay.com/apis/api_9/alipay.user.info.auth
func (a *Client) UserInfoAuth(bm gopay.BodyMap) (aliRsp *UserInfoAuthResponse, err error) {
err = bm.CheckEmptyError("scopes", "state")
if err != nil {
Expand All @@ -612,7 +612,7 @@ func (a *Client) UserInfoAuth(bm gopay.BodyMap) (aliRsp *UserInfoAuthResponse, e
}

// alipay.data.bill.balance.query(支付宝商家账户当前余额查询)
// 文档地址:https://docs.open.alipay.com/api_15/alipay.data.bill.balance.query
// 文档地址:https://opendocs.alipay.com/apis/api_15/alipay.data.bill.balance.query
func (a *Client) DataBillBalanceQuery(bm gopay.BodyMap) (aliRsp *DataBillBalanceQueryResponse, err error) {
var bs []byte
if bs, err = a.doAliPay(bm, "alipay.data.bill.balance.query"); err != nil {
Expand All @@ -631,7 +631,7 @@ func (a *Client) DataBillBalanceQuery(bm gopay.BodyMap) (aliRsp *DataBillBalance
}

// alipay.data.dataservice.bill.downloadurl.query(查询对账单下载地址)
// 文档地址:https://docs.open.alipay.com/api_15/alipay.data.dataservice.bill.downloadurl.query
// 文档地址:https://opendocs.alipay.com/apis/api_15/alipay.data.dataservice.bill.downloadurl.query
func (a *Client) DataBillDownloadUrlQuery(bm gopay.BodyMap) (aliRsp *DataBillDownloadUrlQueryResponse, err error) {
err = bm.CheckEmptyError("bill_type", "bill_date")
if err != nil {
Expand Down
88 changes: 28 additions & 60 deletions alipay/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -434,68 +434,36 @@ func TestSyncVerifySign(t *testing.T) {

func TestVerifySign(t *testing.T) {
// 测试,假数据,无法验签通过

publicKey := "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAp8gueNlkbiDidz6FBQEBpqoRgH8h7JtsPtYW0nzAqy1MME4mFnDSMfSKlreUomS3a55gmBopL1eF4/Km/dEnaL5tCY9+24SKn1D4iyls+lvz/ZjvUjVwxoUYBh8kkcxMZSDeDz8//o+9qZTrICVP2a4sBB8T0XmU4gxfw8FsmtoomBH1nLk3AO7wgRN2a3+SRSAmxrhIGDmF1lljSlhY32eJpJ2TZQKaWNW+7yDBU/0Wt3kQVY84vr14yYagnSCiIfqyVFqePayRtmVJDr5qvSXr51tdqs2zKZCu+26X7JAF4BSsaq4gmY5DmDTm4TohCnBduI1+bPGD+igVmtl05wIDAQAB"

//bm := make(gopay.BodyMap)
//bm.Set("sign", "f19WZ3rko3cVpSG3uEEJF0eb4DuZVLt4/GXnNw9qg8iHUsJLkav0V91R5SSTDhW5lgkn3Xhq7TkFRJiDXdVXMu3XUlsONArp3Iu4tXagYJWt9jbcnc2/l29VYDXPLNcs7BXEWFEaCZLutQY2U82AumEwSc1XBKtsLC4mVX3M3f/ExFQHWklJEBHArYBGe4535uFRlsT2fk6WVuX8CuYZatCrVF1o02xMS5aD29eICPkmin/h87OcTbE1syktyCU1WVgcypagUdGGPTF0SVDFf7FRov7+w7fiCGGGL10tNlK/MLzcewtN2dyGF6RLUX3m+HQ7sNEk2wylRXLNUFig==")
//bm.Set("seller_email", "[email protected]")
//bm.Set("sign_type", RSA2)
//bm.Set("total_amount", "0.02")
//bm.Set("buyer_id", "2088812847201551")
//bm.Set("invoice_amount", "0.02")
//bm.Set("fund_bill_list", `[{"amount":"0.02","fundChannel":"PCREDIT"}]`)
//bm.Set("trade_no", "2020010222001401551430614892")
//bm.Set("receipt_amount", "0.02")
//bm.Set("buyer_pay_amount", "0.02")
//bm.Set("notify_time", "2020-01-02 16:18:21")
//bm.Set("subject", "商品")
//bm.Set("auth_app_id", "2015102700040153")
//bm.Set("charset", "utf-8")
//bm.Set("point_amount", "0.00")
//bm.Set("notify_type", "trade_status_sync")
//bm.Set("out_trade_no", "1086209247658383466")
//bm.Set("gmt_payment", "2020-01-02 16:18:21")
//bm.Set("trade_status", "TRADE_SUCCESS")
//bm.Set("version", "1.0")
//bm.Set("buyer_logon_id", "185****2920")
//bm.Set("gmt_create", "2020-01-02 16:18:21")
//bm.Set("app_id", "2015102700040153")
//bm.Set("seller_id", "2088631240818980")
//bm.Set("notify_id", "2020010200222161821001551453140885")

req := new(NotifyRequest)
req.GmtCreate = "2020-01-02 16:18:21"
req.Charset = "utf-8"
req.SellerEmail = "[email protected]"
req.Subject = "商品"
req.Sign = "f19WZ3rko3cVpSG3uEEJF0eb4DuZVLt4/GXnNw9qg8iHUsJLkav0V91R5SSTDhW5lgkn3Xhq7TkFRJiDXdVXMu3XUlsONArp3Iu4tXagYJWt9jbcnc2/l29VYDXPLNcs7BXEWFEaCZLutQY2U82AumEwSc1XBKtsLC4mVX3M3f/ExFQHWklJEBHArYBGe4535uFRlsT2fk6WVuX8CuYZatCrVF1o02xMS5aD29eICPkmin/h87OcTbE1syktyCU1WVgcypagUdGGPTF0SVDFf7FRov7+w7fiCGGGL10tNlK/MLzcewtN2dyGF6RLUX3m+HQ7sNEk2wylRXLNUFig=="
req.BuyerId = "2088812847201551"
req.InvoiceAmount = "0.02"
req.NotifyId = "2020010200222161821001551453140885"
infos := []*FundBillListInfo{&FundBillListInfo{
Amount: "0.02",
FundChannel: "PCREDIT",
}}
req.FundBillList = infos
req.NotifyType = "trade_status_sync"
req.TradeStatus = "TRADE_SUCCESS"
req.ReceiptAmount = "0.02"
req.AppId = "2015102700040153"
req.BuyerPayAmount = "0.02"
req.SignType = RSA2
req.SellerId = "2088631240818980"
req.GmtPayment = "2020-01-02 16:18:21"
req.NotifyTime = "2020-01-02 16:18:21"
req.Version = "1.0"
req.OutTradeNo = "1086209247658383466"
req.TotalAmount = "0.02"
req.TradeNo = "2020010222001401551430614892"
req.AuthAppId = "2015102700040153"
req.BuyerLogonId = "185****2920"
req.PointAmount = "0.00"

ok, err := VerifySign(publicKey, req)
bm := make(gopay.BodyMap)
bm.Set("sign", "f19WZ3rko3cVpSG3uEEJF0eb4DuZVLt4/GXnNw9qg8iHUsJLkav0V91R5SSTDhW5lgkn3Xhq7TkFRJiDXdVXMu3XUlsONArp3Iu4tXagYJWt9jbcnc2/l29VYDXPLNcs7BXEWFEaCZLutQY2U82AumEwSc1XBKtsLC4mVX3M3f/ExFQHWklJEBHArYBGe4535uFRlsT2fk6WVuX8CuYZatCrVF1o02xMS5aD29eICPkmin/h87OcTbE1syktyCU1WVgcypagUdGGPTF0SVDFf7FRov7+w7fiCGGGL10tNlK/MLzcewtN2dyGF6RLUX3m+HQ7sNEk2wylRXLNUFig==")
bm.Set("seller_email", "[email protected]")
bm.Set("sign_type", RSA2)
bm.Set("total_amount", "0.02")
bm.Set("buyer_id", "2088812847201551")
bm.Set("invoice_amount", "0.02")
bm.Set("fund_bill_list", `[{"amount":"0.02","fundChannel":"PCREDIT"}]`)
bm.Set("trade_no", "2020010222001401551430614892")
bm.Set("receipt_amount", "0.02")
bm.Set("buyer_pay_amount", "0.02")
bm.Set("notify_time", "2020-01-02 16:18:21")
bm.Set("subject", "商品")
bm.Set("auth_app_id", "2015102700040153")
bm.Set("charset", "utf-8")
bm.Set("point_amount", "0.00")
bm.Set("notify_type", "trade_status_sync")
bm.Set("out_trade_no", "1086209247658383466")
bm.Set("gmt_payment", "2020-01-02 16:18:21")
bm.Set("trade_status", "TRADE_SUCCESS")
bm.Set("version", "1.0")
bm.Set("buyer_logon_id", "185****2920")
bm.Set("gmt_create", "2020-01-02 16:18:21")
bm.Set("app_id", "2015102700040153")
bm.Set("seller_id", "2088631240818980")
bm.Set("notify_id", "2020010200222161821001551453140885")

ok, err := VerifySign(publicKey, bm)
if err != nil {
fmt.Println("err:", err)
return
Expand Down
Loading

0 comments on commit 7a86d0f

Please sign in to comment.