add order service logic
This commit is contained in:
parent
008f40a898
commit
8596d56fc7
|
@ -119,6 +119,11 @@ issues:
|
||||||
|
|
||||||
exclude-dirs:
|
exclude-dirs:
|
||||||
- internal/model
|
- internal/model
|
||||||
|
- internal/logic/couponservice
|
||||||
|
- internal/logic/inventoryservice
|
||||||
|
- internal/logic/productservice
|
||||||
|
- internal/logic/subscriptionservice
|
||||||
|
- internal/logic/walletservice
|
||||||
|
|
||||||
exclude-files:
|
exclude-files:
|
||||||
- .*_test.go
|
- .*_test.go
|
||||||
|
|
|
@ -52,17 +52,17 @@ type GetOrderQuery struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type GetOrderResp struct {
|
type GetOrderResp struct {
|
||||||
BusinessId string // 訂單業務流水號
|
BusinessID string // 訂單業務流水號
|
||||||
OrderType domain.OrderType `json:"order_type"` // 訂單類型
|
OrderType domain.OrderType `json:"order_type"` // 訂單類型
|
||||||
OrderStatus domain.OrderStatus `json:"order_status"` // 訂單狀態
|
OrderStatus domain.OrderStatus `json:"order_status"` // 訂單狀態
|
||||||
Brand string `json:"brand"` // 下單平台
|
Brand string `json:"brand"` // 下單平台
|
||||||
OrderUid string `json:"order_uid"` // 下單用戶 UID
|
OrderUID string `json:"order_uid"` // 下單用戶 UID
|
||||||
ReferenceId string `json:"reference_id"` // 訂單來源
|
ReferenceID string `json:"reference_id"` // 訂單來源
|
||||||
Count string `json:"count"` // 訂單數量 (decimal to string)
|
Count string `json:"count"` // 訂單數量 (decimal to string)
|
||||||
OrderFee string `json:"order_fee"` // 訂單手續費 (decimal to string)
|
OrderFee string `json:"order_fee"` // 訂單手續費 (decimal to string)
|
||||||
Amount string `json:"amount"` // 單價 (decimal to string)
|
Amount string `json:"amount"` // 單價 (decimal to string)
|
||||||
ReferenceBrand *string `json:"reference_brand,omitempty"` // 訂單來源平台
|
ReferenceBrand *string `json:"reference_brand,omitempty"` // 訂單來源平台
|
||||||
ReferenceUid *string `json:"reference_uid,omitempty"` // 訂單來源用戶 UID
|
ReferenceUID *string `json:"reference_uid,omitempty"` // 訂單來源用戶 UID
|
||||||
WalletStatus *int64 `json:"wallet_status,omitempty"` // 交易金額狀態
|
WalletStatus *int64 `json:"wallet_status,omitempty"` // 交易金額狀態
|
||||||
ThreePartyStatus *int64 `json:"three_party_status,omitempty"` // 三方請求狀態
|
ThreePartyStatus *int64 `json:"three_party_status,omitempty"` // 三方請求狀態
|
||||||
DirectionType *int64 `json:"direction_type,omitempty"` // 交易方向
|
DirectionType *int64 `json:"direction_type,omitempty"` // 交易方向
|
||||||
|
@ -74,7 +74,7 @@ type GetOrderResp struct {
|
||||||
UsdtToCryptoTypeRate *string `json:"usdt_to_crypto_type_rate,omitempty"` // USDT 對交易幣種匯率 (decimal to string)
|
UsdtToCryptoTypeRate *string `json:"usdt_to_crypto_type_rate,omitempty"` // USDT 對交易幣種匯率 (decimal to string)
|
||||||
PaymentFiat *string `json:"payment_fiat,omitempty"` // 支付法幣
|
PaymentFiat *string `json:"payment_fiat,omitempty"` // 支付法幣
|
||||||
PaymentUnitPrice *string `json:"payment_unit_price,omitempty"` // crypto 單價 (decimal to string)
|
PaymentUnitPrice *string `json:"payment_unit_price,omitempty"` // crypto 單價 (decimal to string)
|
||||||
PaymentTemplateId *string `json:"payment_template_id,omitempty"` // 支付方式配置 ID
|
PaymentTemplateID *string `json:"payment_template_id,omitempty"` // 支付方式配置 ID
|
||||||
OrderArrivalTime *int64 `json:"order_arrival_time,omitempty"` // 訂單到帳時間
|
OrderArrivalTime *int64 `json:"order_arrival_time,omitempty"` // 訂單到帳時間
|
||||||
OrderPaymentTime *int64 `json:"order_payment_time,omitempty"` // 訂單付款時間
|
OrderPaymentTime *int64 `json:"order_payment_time,omitempty"` // 訂單付款時間
|
||||||
UnpaidTimeoutSecond *int64 `json:"unpaid_timeout_second,omitempty"` // 支付期限秒數
|
UnpaidTimeoutSecond *int64 `json:"unpaid_timeout_second,omitempty"` // 支付期限秒數
|
||||||
|
|
|
@ -3,9 +3,10 @@ package orderservicelogic
|
||||||
import (
|
import (
|
||||||
"app-cloudep-trade-service/internal/domain"
|
"app-cloudep-trade-service/internal/domain"
|
||||||
"app-cloudep-trade-service/internal/domain/usecase"
|
"app-cloudep-trade-service/internal/domain/usecase"
|
||||||
ers "code.30cm.net/digimon/library-go/errs"
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
ers "code.30cm.net/digimon/library-go/errs"
|
||||||
|
|
||||||
"app-cloudep-trade-service/gen_result/pb/trade"
|
"app-cloudep-trade-service/gen_result/pb/trade"
|
||||||
"app-cloudep-trade-service/internal/svc"
|
"app-cloudep-trade-service/internal/svc"
|
||||||
|
|
||||||
|
|
|
@ -3,8 +3,9 @@ package orderservicelogic
|
||||||
import (
|
import (
|
||||||
"app-cloudep-trade-service/internal/domain"
|
"app-cloudep-trade-service/internal/domain"
|
||||||
"app-cloudep-trade-service/internal/domain/usecase"
|
"app-cloudep-trade-service/internal/domain/usecase"
|
||||||
ers "code.30cm.net/digimon/library-go/errs"
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
ers "code.30cm.net/digimon/library-go/errs"
|
||||||
"github.com/shopspring/decimal"
|
"github.com/shopspring/decimal"
|
||||||
|
|
||||||
"app-cloudep-trade-service/gen_result/pb/trade"
|
"app-cloudep-trade-service/gen_result/pb/trade"
|
||||||
|
|
|
@ -2,9 +2,10 @@ package orderservicelogic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"app-cloudep-trade-service/internal/domain/usecase"
|
"app-cloudep-trade-service/internal/domain/usecase"
|
||||||
ers "code.30cm.net/digimon/library-go/errs"
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
ers "code.30cm.net/digimon/library-go/errs"
|
||||||
|
|
||||||
"app-cloudep-trade-service/gen_result/pb/trade"
|
"app-cloudep-trade-service/gen_result/pb/trade"
|
||||||
"app-cloudep-trade-service/internal/svc"
|
"app-cloudep-trade-service/internal/svc"
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@ package orderservicelogic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"app-cloudep-trade-service/internal/domain/usecase"
|
"app-cloudep-trade-service/internal/domain/usecase"
|
||||||
ers "code.30cm.net/digimon/library-go/errs"
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
ers "code.30cm.net/digimon/library-go/errs"
|
||||||
|
|
||||||
"app-cloudep-trade-service/gen_result/pb/trade"
|
"app-cloudep-trade-service/gen_result/pb/trade"
|
||||||
"app-cloudep-trade-service/internal/svc"
|
"app-cloudep-trade-service/internal/svc"
|
||||||
|
|
||||||
|
@ -49,18 +50,18 @@ func (l *GetOrderLogic) GetOrder(in *trade.GetOrderReq) (*trade.GetOrderResp, er
|
||||||
return &trade.GetOrderResp{
|
return &trade.GetOrderResp{
|
||||||
UpdateTime: o.UpdateTime,
|
UpdateTime: o.UpdateTime,
|
||||||
CreateTime: o.CreateTime,
|
CreateTime: o.CreateTime,
|
||||||
BusinessId: o.BusinessId,
|
BusinessId: o.BusinessID,
|
||||||
OrderType: int32(o.OrderType),
|
OrderType: int32(o.OrderType),
|
||||||
OrderStatus: int32(o.OrderStatus),
|
OrderStatus: int32(o.OrderStatus),
|
||||||
Brand: o.Brand,
|
Brand: o.Brand,
|
||||||
OrderUid: o.OrderUid,
|
OrderUid: o.OrderUID,
|
||||||
ReferenceId: o.ReferenceId,
|
ReferenceId: o.ReferenceID,
|
||||||
Count: o.Count,
|
Count: o.Count,
|
||||||
OrderFee: o.OrderFee,
|
OrderFee: o.OrderFee,
|
||||||
Amount: o.Amount,
|
Amount: o.Amount,
|
||||||
// 下面的為未來擴充用的欄位
|
// 下面的為未來擴充用的欄位
|
||||||
ReferenceBrand: o.ReferenceBrand,
|
ReferenceBrand: o.ReferenceBrand,
|
||||||
ReferenceUid: o.ReferenceUid,
|
ReferenceUid: o.ReferenceUID,
|
||||||
WalletStatus: o.WalletStatus,
|
WalletStatus: o.WalletStatus,
|
||||||
ThreePartyStatus: o.ThreePartyStatus,
|
ThreePartyStatus: o.ThreePartyStatus,
|
||||||
DirectionType: o.DirectionType,
|
DirectionType: o.DirectionType,
|
||||||
|
@ -72,7 +73,7 @@ func (l *GetOrderLogic) GetOrder(in *trade.GetOrderReq) (*trade.GetOrderResp, er
|
||||||
UsdtToCryptoTypeRate: o.UsdtToCryptoTypeRate,
|
UsdtToCryptoTypeRate: o.UsdtToCryptoTypeRate,
|
||||||
PaymentFiat: o.PaymentFiat,
|
PaymentFiat: o.PaymentFiat,
|
||||||
PaymentUnitPrice: o.PaymentUnitPrice,
|
PaymentUnitPrice: o.PaymentUnitPrice,
|
||||||
PaymentTemplateId: o.PaymentTemplateId,
|
PaymentTemplateId: o.PaymentTemplateID,
|
||||||
OrderArrivalTime: o.OrderArrivalTime,
|
OrderArrivalTime: o.OrderArrivalTime,
|
||||||
OrderPaymentTime: o.OrderPaymentTime,
|
OrderPaymentTime: o.OrderPaymentTime,
|
||||||
UnpaidTimeoutSecond: o.UnpaidTimeoutSecond,
|
UnpaidTimeoutSecond: o.UnpaidTimeoutSecond,
|
||||||
|
|
|
@ -3,9 +3,10 @@ package orderservicelogic
|
||||||
import (
|
import (
|
||||||
"app-cloudep-trade-service/internal/domain"
|
"app-cloudep-trade-service/internal/domain"
|
||||||
"app-cloudep-trade-service/internal/domain/usecase"
|
"app-cloudep-trade-service/internal/domain/usecase"
|
||||||
ers "code.30cm.net/digimon/library-go/errs"
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
ers "code.30cm.net/digimon/library-go/errs"
|
||||||
|
|
||||||
"app-cloudep-trade-service/gen_result/pb/trade"
|
"app-cloudep-trade-service/gen_result/pb/trade"
|
||||||
"app-cloudep-trade-service/internal/svc"
|
"app-cloudep-trade-service/internal/svc"
|
||||||
|
|
||||||
|
@ -107,17 +108,17 @@ func (l *ListOrderLogic) ListOrder(in *trade.ListOrderReq) (*trade.ListOrderResp
|
||||||
data := make([]*trade.GetOrderResp, 0, len(order.Data))
|
data := make([]*trade.GetOrderResp, 0, len(order.Data))
|
||||||
for _, item := range order.Data {
|
for _, item := range order.Data {
|
||||||
data = append(data, &trade.GetOrderResp{
|
data = append(data, &trade.GetOrderResp{
|
||||||
BusinessId: item.BusinessId,
|
BusinessId: item.BusinessID,
|
||||||
OrderType: int32(item.OrderType),
|
OrderType: int32(item.OrderType),
|
||||||
OrderStatus: int32(item.OrderStatus),
|
OrderStatus: int32(item.OrderStatus),
|
||||||
Brand: item.Brand,
|
Brand: item.Brand,
|
||||||
OrderUid: item.OrderUid,
|
OrderUid: item.OrderUID,
|
||||||
ReferenceId: item.ReferenceId,
|
ReferenceId: item.ReferenceID,
|
||||||
Count: item.Count,
|
Count: item.Count,
|
||||||
OrderFee: item.OrderFee,
|
OrderFee: item.OrderFee,
|
||||||
Amount: item.Amount,
|
Amount: item.Amount,
|
||||||
ReferenceBrand: item.ReferenceBrand,
|
ReferenceBrand: item.ReferenceBrand,
|
||||||
ReferenceUid: item.ReferenceUid,
|
ReferenceUid: item.ReferenceUID,
|
||||||
WalletStatus: item.WalletStatus,
|
WalletStatus: item.WalletStatus,
|
||||||
ThreePartyStatus: item.ThreePartyStatus,
|
ThreePartyStatus: item.ThreePartyStatus,
|
||||||
DirectionType: item.DirectionType,
|
DirectionType: item.DirectionType,
|
||||||
|
@ -129,7 +130,7 @@ func (l *ListOrderLogic) ListOrder(in *trade.ListOrderReq) (*trade.ListOrderResp
|
||||||
UsdtToCryptoTypeRate: item.UsdtToCryptoTypeRate,
|
UsdtToCryptoTypeRate: item.UsdtToCryptoTypeRate,
|
||||||
PaymentFiat: item.PaymentFiat,
|
PaymentFiat: item.PaymentFiat,
|
||||||
PaymentUnitPrice: item.PaymentUnitPrice,
|
PaymentUnitPrice: item.PaymentUnitPrice,
|
||||||
PaymentTemplateId: item.PaymentTemplateId,
|
PaymentTemplateId: item.PaymentTemplateID,
|
||||||
OrderArrivalTime: item.OrderArrivalTime,
|
OrderArrivalTime: item.OrderArrivalTime,
|
||||||
OrderPaymentTime: item.OrderPaymentTime,
|
OrderPaymentTime: item.OrderPaymentTime,
|
||||||
UnpaidTimeoutSecond: item.UnpaidTimeoutSecond,
|
UnpaidTimeoutSecond: item.UnpaidTimeoutSecond,
|
||||||
|
|
|
@ -2,9 +2,10 @@ package orderservicelogic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"app-cloudep-trade-service/internal/domain/usecase"
|
"app-cloudep-trade-service/internal/domain/usecase"
|
||||||
ers "code.30cm.net/digimon/library-go/errs"
|
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
ers "code.30cm.net/digimon/library-go/errs"
|
||||||
|
|
||||||
"app-cloudep-trade-service/gen_result/pb/trade"
|
"app-cloudep-trade-service/gen_result/pb/trade"
|
||||||
"app-cloudep-trade-service/internal/svc"
|
"app-cloudep-trade-service/internal/svc"
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@ func NewOrderStatusTimeoutLogic(ctx context.Context, svcCtx *svc.ServiceContext)
|
||||||
}
|
}
|
||||||
|
|
||||||
// OrderStatusTimeout 訂單超時任務/cron/order-status/timeout
|
// OrderStatusTimeout 訂單超時任務/cron/order-status/timeout
|
||||||
func (l *OrderStatusTimeoutLogic) OrderStatusTimeout(in *trade.OrderStatusTimeoutReq) (*trade.OKResp, error) {
|
func (l *OrderStatusTimeoutLogic) OrderStatusTimeout(_ *trade.OrderStatusTimeoutReq) (*trade.OKResp, error) {
|
||||||
err := l.svcCtx.OrderUseCase.OrderStatusTimeout(l.ctx)
|
err := l.svcCtx.OrderUseCase.OrderStatusTimeout(l.ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
@ -126,23 +126,24 @@ func (o *OrderUseCase) GetOrder(ctx context.Context, param usecase.GetOrderQuery
|
||||||
if errors.Is(mon.ErrNotFound, err) {
|
if errors.Is(mon.ErrNotFound, err) {
|
||||||
return nil, domain.NotFoundError(domain.DataNotFoundErrorCode, "failed to get this order id:", param.BusinessID)
|
return nil, domain.NotFoundError(domain.DataNotFoundErrorCode, "failed to get this order id:", param.BusinessID)
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
resp := &usecase.GetOrderResp{
|
resp := &usecase.GetOrderResp{
|
||||||
UpdateTime: order.UpdateTime,
|
UpdateTime: order.UpdateTime,
|
||||||
CreateTime: order.CreateTime,
|
CreateTime: order.CreateTime,
|
||||||
BusinessId: order.BusinessID,
|
BusinessID: order.BusinessID,
|
||||||
OrderType: order.OrderType,
|
OrderType: order.OrderType,
|
||||||
OrderStatus: order.OrderStatus,
|
OrderStatus: order.OrderStatus,
|
||||||
Brand: order.Brand,
|
Brand: order.Brand,
|
||||||
OrderUid: order.OrderUID,
|
OrderUID: order.OrderUID,
|
||||||
ReferenceId: order.ReferenceID,
|
ReferenceID: order.ReferenceID,
|
||||||
Count: order.Count.String(),
|
Count: order.Count.String(),
|
||||||
OrderFee: order.OrderFee.String(),
|
OrderFee: order.OrderFee.String(),
|
||||||
Amount: order.Amount.String(),
|
Amount: order.Amount.String(),
|
||||||
ReferenceBrand: order.ReferenceBrand,
|
ReferenceBrand: order.ReferenceBrand,
|
||||||
ReferenceUid: order.ReferenceUID,
|
ReferenceUID: order.ReferenceUID,
|
||||||
WalletStatus: Int64Ptr(order.WalletStatus),
|
WalletStatus: Int64Ptr(order.WalletStatus),
|
||||||
ThreePartyStatus: order.ThreePartyStatus,
|
ThreePartyStatus: order.ThreePartyStatus,
|
||||||
DirectionType: Int64Ptr(order.DirectionType),
|
DirectionType: Int64Ptr(order.DirectionType),
|
||||||
|
@ -154,7 +155,7 @@ func (o *OrderUseCase) GetOrder(ctx context.Context, param usecase.GetOrderQuery
|
||||||
UsdtToCryptoTypeRate: DecimalToStringPtr(order.USDTToCryptoTypeRate),
|
UsdtToCryptoTypeRate: DecimalToStringPtr(order.USDTToCryptoTypeRate),
|
||||||
PaymentFiat: order.PaymentFiat,
|
PaymentFiat: order.PaymentFiat,
|
||||||
PaymentUnitPrice: DecimalToStringPtr(order.PaymentUnitPrice),
|
PaymentUnitPrice: DecimalToStringPtr(order.PaymentUnitPrice),
|
||||||
PaymentTemplateId: order.PaymentTemplateID,
|
PaymentTemplateID: order.PaymentTemplateID,
|
||||||
OrderArrivalTime: order.OrderArrivalTime,
|
OrderArrivalTime: order.OrderArrivalTime,
|
||||||
OrderPaymentTime: order.OrderPaymentTime,
|
OrderPaymentTime: order.OrderPaymentTime,
|
||||||
UnpaidTimeoutSecond: order.UnpaidTimeoutSecond,
|
UnpaidTimeoutSecond: order.UnpaidTimeoutSecond,
|
||||||
|
@ -266,17 +267,17 @@ func (o *OrderUseCase) convertOrdersToResponses(orders []model.Order) []*usecase
|
||||||
resp := &usecase.GetOrderResp{
|
resp := &usecase.GetOrderResp{
|
||||||
UpdateTime: order.UpdateTime,
|
UpdateTime: order.UpdateTime,
|
||||||
CreateTime: order.CreateTime,
|
CreateTime: order.CreateTime,
|
||||||
BusinessId: order.BusinessID,
|
BusinessID: order.BusinessID,
|
||||||
OrderType: order.OrderType,
|
OrderType: order.OrderType,
|
||||||
OrderStatus: order.OrderStatus,
|
OrderStatus: order.OrderStatus,
|
||||||
Brand: order.Brand,
|
Brand: order.Brand,
|
||||||
OrderUid: order.OrderUID,
|
OrderUID: order.OrderUID,
|
||||||
ReferenceId: order.ReferenceID,
|
ReferenceID: order.ReferenceID,
|
||||||
Count: order.Count.String(),
|
Count: order.Count.String(),
|
||||||
OrderFee: order.OrderFee.String(),
|
OrderFee: order.OrderFee.String(),
|
||||||
Amount: order.Amount.String(),
|
Amount: order.Amount.String(),
|
||||||
ReferenceBrand: order.ReferenceBrand,
|
ReferenceBrand: order.ReferenceBrand,
|
||||||
ReferenceUid: order.ReferenceUID,
|
ReferenceUID: order.ReferenceUID,
|
||||||
WalletStatus: Int64Ptr(order.WalletStatus),
|
WalletStatus: Int64Ptr(order.WalletStatus),
|
||||||
ThreePartyStatus: order.ThreePartyStatus,
|
ThreePartyStatus: order.ThreePartyStatus,
|
||||||
DirectionType: Int64Ptr(order.DirectionType),
|
DirectionType: Int64Ptr(order.DirectionType),
|
||||||
|
@ -288,7 +289,7 @@ func (o *OrderUseCase) convertOrdersToResponses(orders []model.Order) []*usecase
|
||||||
UsdtToCryptoTypeRate: DecimalToStringPtr(order.USDTToCryptoTypeRate),
|
UsdtToCryptoTypeRate: DecimalToStringPtr(order.USDTToCryptoTypeRate),
|
||||||
PaymentFiat: order.PaymentFiat,
|
PaymentFiat: order.PaymentFiat,
|
||||||
PaymentUnitPrice: DecimalToStringPtr(order.PaymentUnitPrice),
|
PaymentUnitPrice: DecimalToStringPtr(order.PaymentUnitPrice),
|
||||||
PaymentTemplateId: order.PaymentTemplateID,
|
PaymentTemplateID: order.PaymentTemplateID,
|
||||||
OrderArrivalTime: order.OrderArrivalTime,
|
OrderArrivalTime: order.OrderArrivalTime,
|
||||||
OrderPaymentTime: order.OrderPaymentTime,
|
OrderPaymentTime: order.OrderPaymentTime,
|
||||||
UnpaidTimeoutSecond: order.UnpaidTimeoutSecond,
|
UnpaidTimeoutSecond: order.UnpaidTimeoutSecond,
|
||||||
|
@ -303,5 +304,6 @@ func (o *OrderUseCase) convertOrdersToResponses(orders []model.Order) []*usecase
|
||||||
}
|
}
|
||||||
res = append(res, resp)
|
res = append(res, resp)
|
||||||
}
|
}
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,11 +7,12 @@ import (
|
||||||
model "app-cloudep-trade-service/internal/model/mongo"
|
model "app-cloudep-trade-service/internal/model/mongo"
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/go-playground/assert/v2"
|
"github.com/go-playground/assert/v2"
|
||||||
"github.com/shopspring/decimal"
|
"github.com/shopspring/decimal"
|
||||||
"github.com/zeromicro/go-zero/core/stores/mon"
|
"github.com/zeromicro/go-zero/core/stores/mon"
|
||||||
"go.uber.org/mock/gomock"
|
"go.uber.org/mock/gomock"
|
||||||
"time"
|
|
||||||
|
|
||||||
"reflect"
|
"reflect"
|
||||||
"testing"
|
"testing"
|
||||||
|
@ -266,23 +267,23 @@ func TestOrderUseCase_GetOrder(t *testing.T) {
|
||||||
wantResp: &usecase.GetOrderResp{ // 构建预期响应
|
wantResp: &usecase.GetOrderResp{ // 构建预期响应
|
||||||
UpdateTime: mockOrder.UpdateTime,
|
UpdateTime: mockOrder.UpdateTime,
|
||||||
CreateTime: mockOrder.CreateTime,
|
CreateTime: mockOrder.CreateTime,
|
||||||
BusinessId: mockOrder.BusinessID,
|
BusinessID: mockOrder.BusinessID,
|
||||||
OrderType: mockOrder.OrderType,
|
OrderType: mockOrder.OrderType,
|
||||||
OrderStatus: mockOrder.OrderStatus,
|
OrderStatus: mockOrder.OrderStatus,
|
||||||
Brand: mockOrder.Brand,
|
Brand: mockOrder.Brand,
|
||||||
OrderUid: mockOrder.OrderUID,
|
OrderUID: mockOrder.OrderUID,
|
||||||
ReferenceId: mockOrder.ReferenceID,
|
ReferenceID: mockOrder.ReferenceID,
|
||||||
Count: mockOrder.Count.String(),
|
Count: mockOrder.Count.String(),
|
||||||
OrderFee: mockOrder.OrderFee.String(),
|
OrderFee: mockOrder.OrderFee.String(),
|
||||||
Amount: mockOrder.Amount.String(),
|
Amount: mockOrder.Amount.String(),
|
||||||
ReferenceBrand: mockOrder.ReferenceBrand,
|
ReferenceBrand: mockOrder.ReferenceBrand,
|
||||||
ReferenceUid: mockOrder.ReferenceUID,
|
ReferenceUID: mockOrder.ReferenceUID,
|
||||||
WalletStatus: Int64Ptr(mockOrder.WalletStatus),
|
WalletStatus: Int64Ptr(mockOrder.WalletStatus),
|
||||||
ThreePartyStatus: mockOrder.ThreePartyStatus,
|
ThreePartyStatus: mockOrder.ThreePartyStatus,
|
||||||
DirectionType: Int64Ptr(mockOrder.DirectionType),
|
DirectionType: Int64Ptr(mockOrder.DirectionType),
|
||||||
CryptoType: mockOrder.CryptoType,
|
CryptoType: mockOrder.CryptoType,
|
||||||
PaymentFiat: mockOrder.PaymentFiat,
|
PaymentFiat: mockOrder.PaymentFiat,
|
||||||
PaymentTemplateId: mockOrder.PaymentTemplateID,
|
PaymentTemplateID: mockOrder.PaymentTemplateID,
|
||||||
OrderArrivalTime: mockOrder.OrderArrivalTime,
|
OrderArrivalTime: mockOrder.OrderArrivalTime,
|
||||||
OrderPaymentTime: mockOrder.OrderPaymentTime,
|
OrderPaymentTime: mockOrder.OrderPaymentTime,
|
||||||
UnpaidTimeoutSecond: mockOrder.UnpaidTimeoutSecond,
|
UnpaidTimeoutSecond: mockOrder.UnpaidTimeoutSecond,
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
package usecase
|
package usecase
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"testing"
|
||||||
|
|
||||||
"github.com/go-playground/assert/v2"
|
"github.com/go-playground/assert/v2"
|
||||||
"github.com/shopspring/decimal"
|
"github.com/shopspring/decimal"
|
||||||
"testing"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// 測試 Int64Ptr 函數
|
// 測試 Int64Ptr 函數
|
||||||
|
|
Loading…
Reference in New Issue