Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Nov 21, 2021
1 parent 37fc163 commit 55a5972
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 11 deletions.
18 changes: 15 additions & 3 deletions driver/alipay/alipay.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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: ``,
Expand Down
2 changes: 1 addition & 1 deletion driver/alipay/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
13 changes: 6 additions & 7 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)

0 comments on commit 55a5972

Please sign in to comment.