支付服务

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

File diff suppressed because one or more lines are too long