测试阿里

This commit is contained in:
陈俊宏 2024-08-06 14:07:56 +08:00
parent 6adcce1480
commit daf5e2134f
2 changed files with 64 additions and 17 deletions

View File

@ -149,8 +149,8 @@ func ALiOrderQuery(ctx context.Context, aliConfig AliPay, OrderNo string) (PayOr
tradeStateDesc = "未付款交易超时关闭,或支付完成后全额退款"
}
amountTotal, _ := strconv.Atoi(aliRsp.Response.TotalAmount)
payerTotal, _ := strconv.Atoi(aliRsp.Response.BuyerPayAmount)
amountTotal, _ := strconv.ParseFloat(aliRsp.Response.TotalAmount, 64)
payerTotal, _ := strconv.ParseFloat(aliRsp.Response.BuyerPayAmount, 64)
// 构建数据
outTradeNo, _ := strconv.Atoi(aliRsp.Response.OutTradeNo)
return PayOrderQueryInfo{
@ -177,9 +177,10 @@ func AliRefundOrder(ctx context.Context, orderRefundRequest OrderRefundRequest)
return OrderRefundInfo{}, err
}
// 请求参数
refundAmount := float64(orderRefundRequest.RefundAmount) / 100.0
bm := make(gopay.BodyMap)
bm.Set("out_trade_no", orderRefundRequest.OrderId).
Set("refund_amount", orderRefundRequest.RefundAmount).
Set("refund_amount", refundAmount).
Set("refund_reason", orderRefundRequest.RefundReason).
Set("out_request_no", orderRefundRequest.RefundOrderId)
@ -193,14 +194,15 @@ func AliRefundOrder(ctx context.Context, orderRefundRequest OrderRefundRequest)
return OrderRefundInfo{}, err
}
refundFee, _ := strconv.Atoi(aliRsp.Response.RefundFee)
outTradeNo, _ := strconv.Atoi(aliRsp.Response.OutTradeNo)
refundFee, _ := strconv.ParseFloat(aliRsp.Response.RefundFee, 64)
outTradeNo, _ := strconv.ParseFloat(aliRsp.Response.OutTradeNo, 64)
return OrderRefundInfo{
OutTradeNo: int64(outTradeNo),
TransactionId: aliRsp.Response.TradeNo,
RefundFee: int64(refundFee * 100),
RefundOrderId: orderRefundRequest.RefundOrderId,
RefundStatus: payCommon.PAY_REFUND_STATU_SUCCESS,
OutTradeNo: int64(outTradeNo),
TransactionId: aliRsp.Response.TradeNo,
RefundFee: int64(refundFee * 100),
RefundOrderId: orderRefundRequest.RefundOrderId,
RefundStatus: payCommon.PAY_REFUND_STATU_SUCCESS,
RefundSuccessTime: aliRsp.Response.GmtRefundPay,
}, nil
}
@ -230,7 +232,7 @@ func AliRefundOrderQuery(ctx context.Context, orderRefundQueryRequest OrderRefun
}
return OrderRefundInfo{}, err
}
refundFee, _ := strconv.Atoi(aliRsp.Response.RefundAmount)
refundFee, _ := strconv.ParseFloat(aliRsp.Response.RefundAmount, 64)
outTradeNo, _ := strconv.Atoi(aliRsp.Response.OutTradeNo)
refundOrderId, _ := strconv.Atoi(aliRsp.Response.OutRequestNo)
return OrderRefundInfo{

File diff suppressed because one or more lines are too long