add order service logic
This commit is contained in:
parent
8596d56fc7
commit
ea419a9943
|
@ -1,16 +1,12 @@
|
||||||
package orderservicelogic
|
package orderservicelogic
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"app-cloudep-trade-service/gen_result/pb/trade"
|
||||||
"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"
|
||||||
"context"
|
|
||||||
|
|
||||||
ers "code.30cm.net/digimon/library-go/errs"
|
|
||||||
"github.com/shopspring/decimal"
|
|
||||||
|
|
||||||
"app-cloudep-trade-service/gen_result/pb/trade"
|
|
||||||
"app-cloudep-trade-service/internal/svc"
|
"app-cloudep-trade-service/internal/svc"
|
||||||
|
ers "code.30cm.net/digimon/library-go/errs"
|
||||||
|
"context"
|
||||||
"github.com/zeromicro/go-zero/core/logx"
|
"github.com/zeromicro/go-zero/core/logx"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -29,40 +25,40 @@ func NewCreateOrderLogic(ctx context.Context, svcCtx *svc.ServiceContext) *Creat
|
||||||
}
|
}
|
||||||
|
|
||||||
type createOrderReq struct { // 訂單ID
|
type createOrderReq struct { // 訂單ID
|
||||||
BusinessID string `json:"business_id" validate:"required"` // 訂單業務流水號
|
BusinessID string `json:"business_id" validate:"required"` // 訂單業務流水號
|
||||||
OrderType int8 `json:"order_type" validate:"required"` // 訂單類型
|
OrderType int8 `json:"order_type" validate:"required"` // 訂單類型
|
||||||
OrderStatus int8 `json:"order_status" validate:"oneof=0 1 2 3 4 5 6 7 8 9 10 11"` // 訂單狀態
|
OrderStatus int8 `json:"order_status" validate:"oneof=0 1 2 3 4 5 6 7 8 9 10 11"` // 訂單狀態
|
||||||
Brand string `json:"brand" validate:"required"` // 下單平台
|
Brand string `json:"brand" validate:"required"` // 下單平台
|
||||||
OrderUID string `json:"order_uid" validate:"required"` // 下單用戶 UID
|
OrderUID string `json:"order_uid" validate:"required"` // 下單用戶 UID
|
||||||
ReferenceID string `json:"reference_id" validate:"required"` // 訂單來源
|
ReferenceID string `json:"reference_id" validate:"required"` // 訂單來源
|
||||||
Count decimal.Decimal `json:"count" validate:"required,decimalGt=0"` // 訂單數量
|
Count string `json:"count" validate:"required,decimalGt=0"` // 訂單數量
|
||||||
OrderFee decimal.Decimal `json:"order_fee" validate:"required,decimalGte=0"` // 訂單手續費
|
OrderFee string `json:"order_fee" validate:"required,decimalGte=0"` // 訂單手續費
|
||||||
Amount decimal.Decimal `json:"amount" validate:"required,decimalGte=0"` // 單價
|
Amount string `json:"amount" validate:"required,decimalGte=0"` // 單價
|
||||||
ReferenceBrand *string `json:"reference_brand,omitempty" validate:"omitempty"` // 訂單來源平台
|
ReferenceBrand *string `json:"reference_brand,omitempty" validate:"omitempty"` // 訂單來源平台
|
||||||
ReferenceUID *string `json:"reference_uid,omitempty" validate:"omitempty"` // 訂單來源用戶 UID
|
ReferenceUID *string `json:"reference_uid,omitempty" validate:"omitempty"` // 訂單來源用戶 UID
|
||||||
WalletStatus *int64 `json:"wallet_status,omitempty" validate:"omitempty,oneof=1 2 3 4 5 6 7"` // 交易金額狀態
|
WalletStatus *int64 `json:"wallet_status,omitempty" validate:"omitempty,oneof=1 2 3 4 5 6 7"` // 交易金額狀態
|
||||||
ThreePartyStatus *int64 `json:"three_party_status,omitempty" validate:"omitempty,oneof=1 2 3"` // 三方請求狀態
|
ThreePartyStatus *int64 `json:"three_party_status,omitempty" validate:"omitempty,oneof=1 2 3"` // 三方請求狀態
|
||||||
DirectionType *int64 `json:"direction_type,omitempty" validate:"omitempty,oneof=1 2"` // 交易方向
|
DirectionType *int64 `json:"direction_type,omitempty" validate:"omitempty,oneof=1 2"` // 交易方向
|
||||||
CryptoType *string `json:"crypto_type,omitempty" validate:"omitempty"` // 交易幣種
|
CryptoType *string `json:"crypto_type,omitempty" validate:"omitempty"` // 交易幣種
|
||||||
ThirdPartyFee *decimal.Decimal `json:"third_party_fee,omitempty" validate:"omitempty,decimalGte=0"` // 第三方手續費
|
ThirdPartyFee *string `json:"third_party_fee,omitempty" validate:"omitempty,decimalGte=0"` // 第三方手續費
|
||||||
CryptoToUSDTRate *decimal.Decimal `json:"crypto_to_usdt_rate,omitempty" validate:"omitempty,decimalGte=0"` // 交易幣種對 USDT 匯率
|
CryptoToUSDTRate *string `json:"crypto_to_usdt_rate,omitempty" validate:"omitempty,decimalGte=0"` // 交易幣種對 USDT 匯率
|
||||||
FiatToUSDRate *decimal.Decimal `json:"fiat_to_usd_rate,omitempty" validate:"omitempty,decimalGte=0"` // 法幣對 USD 匯率
|
FiatToUSDRate *string `json:"fiat_to_usd_rate,omitempty" validate:"omitempty,decimalGte=0"` // 法幣對 USD 匯率
|
||||||
FeeCryptoToUSDTRate *decimal.Decimal `json:"fee_crypto_to_usdt_rate,omitempty" validate:"omitempty,decimalGte=0"` // 手續費幣種對 USDT 匯率
|
FeeCryptoToUSDTRate *string `json:"fee_crypto_to_usdt_rate,omitempty" validate:"omitempty,decimalGte=0"` // 手續費幣種對 USDT 匯率
|
||||||
USDTToCryptoTypeRate *decimal.Decimal `json:"usdt_to_crypto_type_rate,omitempty" validate:"omitempty,decimalGte=0"` // USDT 對交易幣種匯率
|
USDTToCryptoTypeRate *string `json:"usdt_to_crypto_type_rate,omitempty" validate:"omitempty,decimalGte=0"` // USDT 對交易幣種匯率
|
||||||
PaymentFiat *string `json:"payment_fiat,omitempty" validate:"omitempty"` // 支付法幣
|
PaymentFiat *string `json:"payment_fiat,omitempty" validate:"omitempty"` // 支付法幣
|
||||||
PaymentUnitPrice *decimal.Decimal `json:"payment_unit_price,omitempty" validate:"omitempty,decimalGte=0"` // crypto 單價
|
PaymentUnitPrice *string `json:"payment_unit_price,omitempty" validate:"omitempty,decimalGte=0"` // crypto 單價
|
||||||
PaymentTemplateID *string `json:"payment_template_id,omitempty" validate:"omitempty"` // 支付方式配置 ID
|
PaymentTemplateID *string `json:"payment_template_id,omitempty" validate:"omitempty"` // 支付方式配置 ID
|
||||||
OrderArrivalTime *int64 `json:"order_arrival_time,omitempty" validate:"omitempty"` // 訂單到帳時間
|
OrderArrivalTime *int64 `json:"order_arrival_time,omitempty" validate:"omitempty,gt=1"` // 訂單到帳時間
|
||||||
OrderPaymentTime *int64 `json:"order_payment_time,omitempty" validate:"omitempty"` // 訂單付款時間
|
OrderPaymentTime *int64 `json:"order_payment_time,omitempty" validate:"omitempty,gt=1"` // 訂單付款時間
|
||||||
UnpaidTimeoutSecond *int64 `json:"unpaid_timeout_second,omitempty" validate:"omitempty,decimalGte=0"` // 支付期限秒數
|
UnpaidTimeoutSecond *int64 `json:"unpaid_timeout_second,omitempty" validate:"omitempty,gt=1"` // 支付期限秒數
|
||||||
ChainType *string `json:"chain_type,omitempty" validate:"omitempty"` // 主網類型
|
ChainType *string `json:"chain_type,omitempty" validate:"omitempty"` // 主網類型
|
||||||
TxHash *string `json:"tx_hash,omitempty" validate:"omitempty"` // 交易哈希
|
TxHash *string `json:"tx_hash,omitempty" validate:"omitempty"` // 交易哈希
|
||||||
FromAddress *string `json:"from_address,omitempty" validate:"omitempty"` // 來源地址
|
FromAddress *string `json:"from_address,omitempty" validate:"omitempty"` // 來源地址
|
||||||
ToAddress *string `json:"to_address,omitempty" validate:"omitempty"` // 目標地址
|
ToAddress *string `json:"to_address,omitempty" validate:"omitempty"` // 目標地址
|
||||||
ChainFee *decimal.Decimal `json:"chain_fee,omitempty" validate:"omitempty,decimalGte=0"` // 鏈上交易手續費
|
ChainFee *string `json:"chain_fee,omitempty" validate:"omitempty,decimalGte=0"` // 鏈上交易手續費
|
||||||
ChainFeeCrypto *string `json:"chain_fee_crypto,omitempty" validate:"omitempty"` // 鏈上手續費使用幣別
|
ChainFeeCrypto *string `json:"chain_fee_crypto,omitempty" validate:"omitempty"` // 鏈上手續費使用幣別
|
||||||
Memo *string `json:"memo,omitempty" validate:"omitempty"` // 鏈上備註
|
Memo *string `json:"memo,omitempty" validate:"omitempty"` // 鏈上備註
|
||||||
OrderNote *string `json:"order_note,omitempty" validate:"omitempty"`
|
OrderNote *string `json:"order_note,omitempty" validate:"omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
//nolint:gocyclo,gocognit
|
//nolint:gocyclo,gocognit
|
||||||
|
@ -76,25 +72,15 @@ func buildCreateOrderReq(in *trade.CreateOrderReq) (*createOrderReq, error) {
|
||||||
ReferenceID: in.ReferenceId,
|
ReferenceID: in.ReferenceId,
|
||||||
}
|
}
|
||||||
|
|
||||||
var err error
|
|
||||||
// 只有當 Count, OrderFee, Amount 不為空時才進行轉換和設置
|
// 只有當 Count, OrderFee, Amount 不為空時才進行轉換和設置
|
||||||
if in.Count != "" {
|
if in.Count != "" {
|
||||||
createOrderReq.Count, err = decimal.NewFromString(in.Count)
|
createOrderReq.Count = in.Count
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if in.OrderFee != "" {
|
if in.OrderFee != "" {
|
||||||
createOrderReq.OrderFee, err = decimal.NewFromString(in.OrderFee)
|
createOrderReq.OrderFee = in.OrderFee
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if in.Amount != "" {
|
if in.Amount != "" {
|
||||||
createOrderReq.Amount, err = decimal.NewFromString(in.Amount)
|
createOrderReq.Amount = in.Amount
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 判斷可選字段,只有不為 nil 才設置
|
// 判斷可選字段,只有不為 nil 才設置
|
||||||
|
@ -117,25 +103,25 @@ func buildCreateOrderReq(in *trade.CreateOrderReq) (*createOrderReq, error) {
|
||||||
createOrderReq.CryptoType = in.CryptoType
|
createOrderReq.CryptoType = in.CryptoType
|
||||||
}
|
}
|
||||||
if in.ThirdPartyFee != nil && *in.ThirdPartyFee != "" {
|
if in.ThirdPartyFee != nil && *in.ThirdPartyFee != "" {
|
||||||
createOrderReq.ThirdPartyFee = decimalPtrFromString(*in.ThirdPartyFee)
|
createOrderReq.ThirdPartyFee = in.ThirdPartyFee
|
||||||
}
|
}
|
||||||
if in.CryptoToUsdtRate != nil && *in.CryptoToUsdtRate != "" {
|
if in.CryptoToUsdtRate != nil && *in.CryptoToUsdtRate != "" {
|
||||||
createOrderReq.CryptoToUSDTRate = decimalPtrFromString(*in.CryptoToUsdtRate)
|
createOrderReq.CryptoToUSDTRate = in.CryptoToUsdtRate
|
||||||
}
|
}
|
||||||
if in.FiatToUsdRate != nil && *in.FiatToUsdRate != "" {
|
if in.FiatToUsdRate != nil && *in.FiatToUsdRate != "" {
|
||||||
createOrderReq.FiatToUSDRate = decimalPtrFromString(*in.FiatToUsdRate)
|
createOrderReq.FiatToUSDRate = in.FiatToUsdRate
|
||||||
}
|
}
|
||||||
if in.FeeCryptoToUsdtRate != nil && *in.FeeCryptoToUsdtRate != "" {
|
if in.FeeCryptoToUsdtRate != nil && *in.FeeCryptoToUsdtRate != "" {
|
||||||
createOrderReq.FeeCryptoToUSDTRate = decimalPtrFromString(*in.FeeCryptoToUsdtRate)
|
createOrderReq.FeeCryptoToUSDTRate = in.FeeCryptoToUsdtRate
|
||||||
}
|
}
|
||||||
if in.UsdtToCryptoTypeRate != nil && *in.UsdtToCryptoTypeRate != "" {
|
if in.UsdtToCryptoTypeRate != nil && *in.UsdtToCryptoTypeRate != "" {
|
||||||
createOrderReq.USDTToCryptoTypeRate = decimalPtrFromString(*in.UsdtToCryptoTypeRate)
|
createOrderReq.USDTToCryptoTypeRate = in.UsdtToCryptoTypeRate
|
||||||
}
|
}
|
||||||
if in.PaymentFiat != nil {
|
if in.PaymentFiat != nil {
|
||||||
createOrderReq.PaymentFiat = in.PaymentFiat
|
createOrderReq.PaymentFiat = in.PaymentFiat
|
||||||
}
|
}
|
||||||
if in.PaymentUnitPrice != nil && *in.PaymentUnitPrice != "" {
|
if in.PaymentUnitPrice != nil && *in.PaymentUnitPrice != "" {
|
||||||
createOrderReq.PaymentUnitPrice = decimalPtrFromString(*in.PaymentUnitPrice)
|
createOrderReq.PaymentUnitPrice = in.PaymentUnitPrice
|
||||||
}
|
}
|
||||||
if in.PaymentTemplateId != nil {
|
if in.PaymentTemplateId != nil {
|
||||||
createOrderReq.PaymentTemplateID = in.PaymentTemplateId
|
createOrderReq.PaymentTemplateID = in.PaymentTemplateId
|
||||||
|
@ -162,7 +148,7 @@ func buildCreateOrderReq(in *trade.CreateOrderReq) (*createOrderReq, error) {
|
||||||
createOrderReq.ToAddress = in.ToAddress
|
createOrderReq.ToAddress = in.ToAddress
|
||||||
}
|
}
|
||||||
if in.ChainFee != nil && *in.ChainFee != "" {
|
if in.ChainFee != nil && *in.ChainFee != "" {
|
||||||
createOrderReq.ChainFee = decimalPtrFromString(*in.ChainFee)
|
createOrderReq.ChainFee = in.ChainFee
|
||||||
}
|
}
|
||||||
if in.ChainFeeCrypto != nil {
|
if in.ChainFeeCrypto != nil {
|
||||||
createOrderReq.ChainFeeCrypto = in.ChainFeeCrypto
|
createOrderReq.ChainFeeCrypto = in.ChainFeeCrypto
|
||||||
|
@ -178,6 +164,7 @@ func buildCreateOrderReq(in *trade.CreateOrderReq) (*createOrderReq, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// toCreateOrderReq 將 createOrderReq 轉換為 CreateOrderReq
|
// toCreateOrderReq 將 createOrderReq 轉換為 CreateOrderReq
|
||||||
|
// toCreateOrderUseCase 將 createOrderReq 轉換為 CreateOrderReq
|
||||||
func toCreateOrderUseCase(req *createOrderReq) usecase.CreateOrderReq {
|
func toCreateOrderUseCase(req *createOrderReq) usecase.CreateOrderReq {
|
||||||
return usecase.CreateOrderReq{
|
return usecase.CreateOrderReq{
|
||||||
BusinessID: req.BusinessID,
|
BusinessID: req.BusinessID,
|
||||||
|
@ -186,22 +173,22 @@ func toCreateOrderUseCase(req *createOrderReq) usecase.CreateOrderReq {
|
||||||
Brand: req.Brand,
|
Brand: req.Brand,
|
||||||
OrderUID: req.OrderUID,
|
OrderUID: req.OrderUID,
|
||||||
ReferenceID: req.ReferenceID,
|
ReferenceID: req.ReferenceID,
|
||||||
Count: req.Count,
|
Count: *stringToDecimalPtr(&req.Count),
|
||||||
OrderFee: req.OrderFee,
|
OrderFee: *stringToDecimalPtr(&req.OrderFee),
|
||||||
Amount: req.Amount,
|
Amount: *stringToDecimalPtr(&req.Amount),
|
||||||
WalletStatus: *req.WalletStatus,
|
WalletStatus: getInt64Value(req.WalletStatus),
|
||||||
DirectionType: *req.DirectionType,
|
DirectionType: getInt64Value(req.DirectionType),
|
||||||
ReferenceBrand: req.ReferenceBrand,
|
ReferenceBrand: req.ReferenceBrand,
|
||||||
ReferenceUID: req.ReferenceUID,
|
ReferenceUID: req.ReferenceUID,
|
||||||
ThreePartyStatus: req.ThreePartyStatus,
|
ThreePartyStatus: req.ThreePartyStatus,
|
||||||
CryptoType: req.CryptoType,
|
CryptoType: req.CryptoType,
|
||||||
ThirdPartyFee: req.ThirdPartyFee,
|
ThirdPartyFee: stringToDecimalPtr(req.ThirdPartyFee),
|
||||||
CryptoToUSDTRate: req.CryptoToUSDTRate,
|
CryptoToUSDTRate: stringToDecimalPtr(req.CryptoToUSDTRate),
|
||||||
FiatToUSDRate: req.FiatToUSDRate,
|
FiatToUSDRate: stringToDecimalPtr(req.FiatToUSDRate),
|
||||||
FeeCryptoToUSDTRate: req.FeeCryptoToUSDTRate,
|
FeeCryptoToUSDTRate: stringToDecimalPtr(req.FeeCryptoToUSDTRate),
|
||||||
USDTToCryptoTypeRate: req.USDTToCryptoTypeRate,
|
USDTToCryptoTypeRate: stringToDecimalPtr(req.USDTToCryptoTypeRate),
|
||||||
PaymentFiat: req.PaymentFiat,
|
PaymentFiat: req.PaymentFiat,
|
||||||
PaymentUnitPrice: req.PaymentUnitPrice,
|
PaymentUnitPrice: stringToDecimalPtr(req.PaymentUnitPrice),
|
||||||
PaymentTemplateID: req.PaymentTemplateID,
|
PaymentTemplateID: req.PaymentTemplateID,
|
||||||
OrderArrivalTime: req.OrderArrivalTime,
|
OrderArrivalTime: req.OrderArrivalTime,
|
||||||
OrderPaymentTime: req.OrderPaymentTime,
|
OrderPaymentTime: req.OrderPaymentTime,
|
||||||
|
@ -210,7 +197,7 @@ func toCreateOrderUseCase(req *createOrderReq) usecase.CreateOrderReq {
|
||||||
TxHash: req.TxHash,
|
TxHash: req.TxHash,
|
||||||
FromAddress: req.FromAddress,
|
FromAddress: req.FromAddress,
|
||||||
ToAddress: req.ToAddress,
|
ToAddress: req.ToAddress,
|
||||||
ChainFee: req.ChainFee,
|
ChainFee: stringToDecimalPtr(req.ChainFee),
|
||||||
ChainFeeCrypto: req.ChainFeeCrypto,
|
ChainFeeCrypto: req.ChainFeeCrypto,
|
||||||
Memo: req.Memo,
|
Memo: req.Memo,
|
||||||
OrderNote: req.OrderNote,
|
OrderNote: req.OrderNote,
|
||||||
|
@ -219,6 +206,7 @@ func toCreateOrderUseCase(req *createOrderReq) usecase.CreateOrderReq {
|
||||||
|
|
||||||
// CreateOrder 建立訂單
|
// CreateOrder 建立訂單
|
||||||
func (l *CreateOrderLogic) CreateOrder(in *trade.CreateOrderReq) (*trade.OKResp, error) {
|
func (l *CreateOrderLogic) CreateOrder(in *trade.CreateOrderReq) (*trade.OKResp, error) {
|
||||||
|
|
||||||
req, err := buildCreateOrderReq(in)
|
req, err := buildCreateOrderReq(in)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// 錯誤代碼 06-011-00
|
// 錯誤代碼 06-011-00
|
||||||
|
|
|
@ -18,3 +18,25 @@ func decimalPtrFromString(val string) *decimal.Decimal {
|
||||||
|
|
||||||
return &dec
|
return &dec
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// getInt64Value 將 *int64 的值返回,如果為 nil 則返回 0
|
||||||
|
func getInt64Value(val *int64) int64 {
|
||||||
|
if val == nil {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
return *val
|
||||||
|
}
|
||||||
|
|
||||||
|
// stringToDecimalPtr 將 *string 轉換為 *decimal.Decimal,如果解析失敗或值為 nil 則返回 nil
|
||||||
|
func stringToDecimalPtr(s *string) *decimal.Decimal {
|
||||||
|
if s == nil {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
dec, err := decimal.NewFromString(*s)
|
||||||
|
if err != nil {
|
||||||
|
return nil // 解析失敗時返回 nil,或根據需求記錄錯誤
|
||||||
|
}
|
||||||
|
|
||||||
|
return &dec
|
||||||
|
}
|
||||||
|
|
|
@ -67,6 +67,7 @@ func (o *OrderUseCase) CreateOrder(ctx context.Context, param usecase.CreateOrde
|
||||||
Memo: param.Memo,
|
Memo: param.Memo,
|
||||||
OrderNote: param.OrderNote,
|
OrderNote: param.OrderNote,
|
||||||
}
|
}
|
||||||
|
|
||||||
err := o.OrderModel.Insert(ctx, order)
|
err := o.OrderModel.Insert(ctx, order)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -14,7 +14,6 @@ import (
|
||||||
"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"
|
||||||
|
|
||||||
"reflect"
|
|
||||||
"testing"
|
"testing"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -499,30 +498,3 @@ func TestOrderUseCase_OrderStatusTimeout(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestOrderUseCase_convertOrdersToResponses(t *testing.T) {
|
|
||||||
type fields struct {
|
|
||||||
OrderModel model.OrderModel
|
|
||||||
}
|
|
||||||
type args struct {
|
|
||||||
orders []model.Order
|
|
||||||
}
|
|
||||||
tests := []struct {
|
|
||||||
name string
|
|
||||||
fields fields
|
|
||||||
args args
|
|
||||||
want []*usecase.GetOrderResp
|
|
||||||
}{
|
|
||||||
// TODO: Add test cases.
|
|
||||||
}
|
|
||||||
for _, tt := range tests {
|
|
||||||
t.Run(tt.name, func(t *testing.T) {
|
|
||||||
o := &OrderUseCase{
|
|
||||||
OrderModel: tt.fields.OrderModel,
|
|
||||||
}
|
|
||||||
if got := o.convertOrdersToResponses(tt.args.orders); !reflect.DeepEqual(got, tt.want) {
|
|
||||||
t.Errorf("convertOrdersToResponses() = %v, want %v", got, tt.want)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue