Skip to content

Commit

Permalink
improved
Browse files Browse the repository at this point in the history
  • Loading branch information
admpub committed Mar 3, 2021
1 parent 9e77111 commit 86ccbbb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions driver/mugglepay/mugglepay.go
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,11 @@ func (a *Mugglepay) PayQuery(ctx echo.Context, cfg *config.Query) (*config.Resul

// Refund documentation https://github.com/MugglePay/MugglePay/blob/master/API/order/Refund.md
func (a *Mugglepay) Refund(ctx echo.Context, cfg *config.Refund) (*config.Result, error) {
result, err := a.PayQuery(ctx, config.NewQuery().CopyFromRefund(cfg))
queryResult, err := a.PayQuery(ctx, config.NewQuery().CopyFromRefund(cfg))
if err != nil {
return nil, err
}
if result.PayAmount != cfg.RefundAmount {
if queryResult.PayAmount != cfg.RefundAmount {
return nil, fmt.Errorf("MugglePay只支持全额退款")
}
serverRefund, err := a.Client().Refund(cfg.TradeNo)
Expand All @@ -148,11 +148,11 @@ func (a *Mugglepay) Refund(ctx echo.Context, cfg *config.Refund) (*config.Result
return nil, errors.New(serverRefund.ErrorCode + `: ` + serverRefund.Error)
}
result := &config.Result{
Operation: config.OperationRefund,
TradeNo: serverRefund.Order.OrderID,
OutTradeNo: serverRefund.Order.MerchantOrderID,
//Currency: serverOrder.Order.PayCurrency,
//TotalAmount: serverOrder.Order.PayAmount,
Operation: config.OperationRefund,
TradeNo: serverRefund.Order.OrderID,
OutTradeNo: serverRefund.Order.MerchantOrderID,
Currency: queryResult.Currency,
TotalAmount: queryResult.TotalAmount,
PayCurrency: serverRefund.Order.PriceCurrency,
PayAmount: serverRefund.Order.PriceAmount,
Reason: ``,
Expand Down

0 comments on commit 86ccbbb

Please sign in to comment.