From 55a59729deb1cc417db27500c15d089972f18121 Mon Sep 17 00:00:00 2001 From: Hank Shen Date: Sun, 21 Nov 2021 16:33:34 +0800 Subject: [PATCH] update --- driver/alipay/alipay.go | 18 +++++++++++++++--- driver/alipay/helpers.go | 2 +- go.mod | 13 ++++++------- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/driver/alipay/alipay.go b/driver/alipay/alipay.go index 137281b..f23cac8 100644 --- a/driver/alipay/alipay.go +++ b/driver/alipay/alipay.go @@ -7,8 +7,8 @@ import ( "net/url" "time" + alipay "github.com/admpub/alipay/v3" "github.com/admpub/log" - alipay "github.com/smartwalle/alipay/v3" "github.com/webx-top/echo" "github.com/webx-top/echo/param" "github.com/webx-top/payment" @@ -209,9 +209,10 @@ func (a *Alipay) PayQuery(ctx echo.Context, cfg *config.Query) (*config.Result, } return nil, errors.New(resp.Content.Msg) } + return &config.Result{ Operation: config.OperationPayment, - Status: config.TradeStatusSuccess, + Status: string(resp.Content.TradeStatus), TradeNo: resp.Content.TradeNo, OutTradeNo: resp.Content.OutTradeNo, Currency: resp.Content.PayCurrency, @@ -318,9 +319,20 @@ func (a *Alipay) RefundQuery(ctx echo.Context, cfg *config.Query) (*config.Resul } return nil, errors.New(resp.Content.Msg) } + var status string + switch resp.Content.RefundStatus { + case `REFUND_SUCCESS`: + status = config.TradeStatusSuccess + case `REFUND_FAIL`: + status = config.TradeStatusException + case `REFUND_PROCESSING`: + status = config.TradeStatusProcessing + default: + status = config.TradeStatusProcessing + } return &config.Result{ Operation: config.OperationRefund, - Status: config.TradeStatusSuccess, + Status: status, TradeNo: resp.Content.TradeNo, OutTradeNo: resp.Content.OutTradeNo, Currency: ``, diff --git a/driver/alipay/helpers.go b/driver/alipay/helpers.go index e3023a1..f5a419e 100644 --- a/driver/alipay/helpers.go +++ b/driver/alipay/helpers.go @@ -3,7 +3,7 @@ package alipay import ( "net/url" - alipay "github.com/smartwalle/alipay/v3" + alipay "github.com/admpub/alipay/v3" "github.com/webx-top/echo" "github.com/webx-top/echo/param" "github.com/webx-top/payment" diff --git a/go.mod b/go.mod index 3b1b5f7..e09e5ff 100644 --- a/go.mod +++ b/go.mod @@ -3,6 +3,7 @@ module github.com/webx-top/payment go 1.16 require ( + github.com/admpub/alipay/v3 v3.0.1 github.com/admpub/copier v0.0.2 // indirect github.com/admpub/decimal v1.3.1 github.com/admpub/events v1.2.0 // indirect @@ -19,16 +20,14 @@ require ( github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/objcoding/wxpay v1.0.6 github.com/qingwg/payjs v0.0.0-20190928033402-c53dbe16b371 - github.com/smartwalle/alipay/v3 v3.1.6 - github.com/smartwalle/crypto4go v1.0.3 // indirect github.com/smartwalle/paypal v1.0.1 github.com/webx-top/captcha v0.0.0-20161202061115-29e9e7f30aa0 // indirect github.com/webx-top/codec v0.1.1 - github.com/webx-top/com v0.2.12 - github.com/webx-top/echo v2.22.17+incompatible + github.com/webx-top/com v0.3.3 + github.com/webx-top/echo v2.22.19+incompatible github.com/webx-top/validation v0.0.3 // indirect - golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 // indirect - golang.org/x/net v0.0.0-20211105192438-b53810dc28af // indirect - golang.org/x/sys v0.0.0-20211105183446-c75c47738b0c // indirect + golang.org/x/crypto v0.0.0-20211117183948-ae814b36b871 // indirect + golang.org/x/net v0.0.0-20211118161319-6a13c67c3ce4 // indirect + golang.org/x/sys v0.0.0-20211117180635-dee7805ff2e1 // indirect golang.org/x/text v0.3.7 // indirect )