支付服务

This commit is contained in:
陈俊宏 2024-08-09 17:59:19 +08:00
parent a54212d38c
commit bdfd4c6b9c
2 changed files with 35 additions and 36 deletions

View File

@ -9,7 +9,6 @@ import (
"context"
"encoding/json"
"fmt"
"github.com/qit-team/snow-core/log/logger"
"strconv"
)
@ -48,7 +47,7 @@ type PayOrderResponse struct {
// PaymentService 统一发起支付
func PaymentService(c context.Context, payOrderRequest PayOrderRequest) PayOrderResponse {
logger.Info(c, "PaymentService 收到支付请求", payOrderRequest)
//logger.Info(c, "PaymentService 收到支付请求", payOrderRequest)
var err error
var info string
var payOrderResponse PayOrderResponse
@ -73,7 +72,7 @@ func PaymentService(c context.Context, payOrderRequest PayOrderRequest) PayOrder
ErrorMsg: err.Error(),
}
logStatus = common.THIRD_ORDER_LOG_STATUS_FAIL
} else {
} else if payOrderResponse.ErrorMsg == "" {
payOrderResponse = PayOrderResponse{
Code: payCommon.PAY_SUCCESS_CODE,
ErrorMsg: "",
@ -142,7 +141,7 @@ func PayOrderQuery(c context.Context, payOrderQueryRequest PayOrderQueryRequest)
ErrorMsg: err.Error(),
}
logStatus = common.THIRD_ORDER_LOG_STATUS_FAIL
} else {
} else if payOrderQueryResponse.ErrorMsg == "" {
payOrderQueryResponse = PayOrderQueryResponse{
Code: payCommon.PAY_SUCCESS_CODE,
Result: info,
@ -188,7 +187,7 @@ type OrderRefundInfo struct {
// OrderRefund 订单退款
func OrderRefund(c context.Context, orderRefundRequest OrderRefundRequest) OrderRefundResponse {
logger.Info(c, "PaymentService 收到退款请求", orderRefundRequest)
//logger.Info(c, "PaymentService 收到退款请求", orderRefundRequest)
var err error
var info OrderRefundInfo
var orderRefundResponse OrderRefundResponse
@ -212,7 +211,7 @@ func OrderRefund(c context.Context, orderRefundRequest OrderRefundRequest) Order
ErrorMsg: err.Error(),
}
logStatus = common.THIRD_ORDER_LOG_STATUS_FAIL
} else {
} else if orderRefundResponse.ErrorMsg == "" {
orderRefundResponse = OrderRefundResponse{
Code: payCommon.PAY_SUCCESS_CODE,
Result: info,
@ -269,7 +268,7 @@ func OrderRefundQuery(c context.Context, orderRefundQueryRequest OrderRefundQuer
ErrorMsg: err.Error(),
}
logStatus = common.THIRD_ORDER_LOG_STATUS_FAIL
} else {
} else if orderRefundQueryResponse.ErrorMsg == "" {
orderRefundQueryResponse = OrderRefundQueryResponse{
Code: payCommon.PAY_SUCCESS_CODE,
Result: info,
@ -307,7 +306,7 @@ type OrderCloseInfo struct {
// OrderClose 关闭订单
func OrderClose(c context.Context, orderCloseRequest OrderCloseRequest) OrderCloseResponse {
logger.Info(c, "PaymentService 收到关闭订单请求", orderCloseRequest)
//logger.Info(c, "PaymentService 收到关闭订单请求", orderCloseRequest)
var err error
var info OrderCloseInfo
var orderCloseResponse OrderCloseResponse
@ -331,7 +330,7 @@ func OrderClose(c context.Context, orderCloseRequest OrderCloseRequest) OrderClo
ErrorMsg: err.Error(),
}
logStatus = common.THIRD_ORDER_LOG_STATUS_FAIL
} else {
} else if orderCloseResponse.ErrorMsg == "" {
orderCloseResponse = OrderCloseResponse{
Code: payCommon.PAY_SUCCESS_CODE,
Result: info,

File diff suppressed because one or more lines are too long