90 lines
5.6 KiB
Go
Executable File
90 lines
5.6 KiB
Go
Executable File
package entity
|
|
|
|
import (
|
|
"code.30cm.net/digimon/app-cloudep-order-service/pkg/domain/order"
|
|
"github.com/shopspring/decimal"
|
|
"go.mongodb.org/mongo-driver/bson/primitive"
|
|
)
|
|
|
|
type Order struct {
|
|
ID primitive.ObjectID `bson:"_id,omitempty" json:"id,omitempty"`
|
|
UpdateTime int64 `bson:"update_time"`
|
|
CreateTime int64 `bson:"create_time"`
|
|
BusinessID string `bson:"business_id"` // 訂單業務流水號
|
|
OrderType order.Type `bson:"order_type"` // 訂單類型
|
|
OrderStatus order.Status `bson:"order_status"` // 訂單狀態
|
|
Brand string `bson:"brand"` // 下單平台
|
|
OrderUID string `bson:"order_uid"` // 下單用戶 UID
|
|
ReferenceID string `bson:"reference_id"` // 訂單來源
|
|
Count decimal.Decimal `bson:"count"` // 訂單數量
|
|
OrderFee decimal.Decimal `bson:"order_fee"` // 訂單手續費
|
|
Amount decimal.Decimal `bson:"amount"` // 單價
|
|
WalletStatus int64 `bson:"wallet_status,omitempty"` // 交易金額狀態
|
|
DirectionType int64 `bson:"direction_type,omitempty"` // 交易方向
|
|
BookingInfo *BookingInfo `bson:"booking_info,omitempty"` // 寄送資訊
|
|
InvoiceInfo *InvoiceInfo `bson:"invoice_info,omitempty"` // 寄送資訊
|
|
OrderItem []OrderItem `bson:"order_item,omitempty"` // 這筆訂單所訂購的 ProductItem List
|
|
// 以上為必要欄位,下面是區塊鏈時才需要
|
|
ReferenceBrand *string `bson:"reference_brand,omitempty"` // 訂單來源平台
|
|
ReferenceUID *string `bson:"reference_uid,omitempty"` // 訂單來源用戶 UID
|
|
ThreePartyStatus *int64 `bson:"three_party_status,omitempty"` // 三方請求狀態
|
|
CryptoType *string `bson:"crypto_type,omitempty"` // 交易幣種
|
|
ThirdPartyFee *decimal.Decimal `bson:"third_party_fee,omitempty"` // 第三方手續費
|
|
CryptoToUSDTRate *decimal.Decimal `bson:"crypto_to_usdt_rate,omitempty"` // 加密貨幣對 USDT 匯率
|
|
FiatToUSDRate *decimal.Decimal `bson:"fiat_to_usd_rate,omitempty"` // 法幣對 USD 匯率
|
|
FeeCryptoToUSDTRate *decimal.Decimal `bson:"fee_crypto_to_usdt_rate,omitempty"` // 手續費加密貨幣對 USDT 匯率
|
|
USDTToCryptoTypeRate *decimal.Decimal `bson:"usdt_to_crypto_type_rate,omitempty"` // USDT 對加密貨幣匯率
|
|
PaymentFiat *string `bson:"payment_fiat,omitempty"` // 支付法幣
|
|
PaymentUnitPrice *decimal.Decimal `bson:"payment_unit_price,omitempty"` // 加密貨幣單價
|
|
PaymentTemplateID *string `bson:"payment_template_id,omitempty"` // 支付方式配置 ID
|
|
OrderArrivalTime *int64 `bson:"order_arrival_time,omitempty"` // 訂單到帳時間
|
|
OrderPaymentTime *int64 `bson:"order_payment_time,omitempty"` // 訂單付款時間
|
|
UnpaidTimeoutSecond *int64 `bson:"unpaid_timeout_second,omitempty"` // 支付期限秒數
|
|
ChainType *string `bson:"chain_type,omitempty"` // 主網類型
|
|
TxHash *string `bson:"tx_hash,omitempty"` // 交易哈希
|
|
FromAddress *string `bson:"from_address,omitempty"` // 來源地址
|
|
ToAddress *string `bson:"to_address,omitempty"` // 目標地址
|
|
ChainFee *decimal.Decimal `bson:"chain_fee,omitempty"` // 鏈上交易手續費
|
|
ChainFeeCrypto *string `bson:"chain_fee_crypto,omitempty"` // 鏈上手續費使用幣別
|
|
Memo *string `bson:"memo,omitempty"` // 鏈上備註
|
|
OrderNote *string `bson:"order_note,omitempty"` // 訂單交易備註
|
|
|
|
}
|
|
|
|
type BookingInfo struct {
|
|
SenderName string `bson:"sender_name"` // 寄件者姓名
|
|
SenderPhone string `bson:"sender_phone"` // 寄件者手機
|
|
SenderEmail string `bson:"sender_email"` // 寄件者信箱
|
|
SenderNational string `bson:"sender_national"` // 寄件者國家
|
|
SenderAddress string `bson:"sender_address"` // 寄件者地址
|
|
SenderCode string `bson:"sender_code"` // 寄件者郵遞區號
|
|
ReceiverName string `bson:"receiver_name"` // 收件者姓名
|
|
ReceiverPhone string `bson:"receiver_phone"` // 收件者手機
|
|
ReceiverEmail string `bson:"receiver_email"` // 收件者信箱
|
|
ReceiverAddress string `bson:"receiver_address"` // 收件者地址
|
|
ReceiverNational string `bson:"receiver_national"` // 收件者國家
|
|
ReceiverCode string `bson:"receiver_code"` // 收件者郵遞區號
|
|
Memo string `bson:"memo"` // 備註
|
|
}
|
|
type InvoiceInfo struct {
|
|
Type string `bson:"type"` // 發票類型
|
|
Code string `bson:"code"` // 載具條碼
|
|
Name string `bson:"name"` // 捐款人姓名 / 公司抬頭
|
|
ID string `bson:"id"` // 身分證字號,通依編號
|
|
National string `bson:"national"` // 國家
|
|
City string `bson:"city" ` // 縣市
|
|
Area string `bson:"area"` // 地區
|
|
Address string `bson:"address"` // 收件者地址
|
|
Memo string `bson:"memo"` // 備註
|
|
}
|
|
|
|
type OrderItem struct {
|
|
ItemID string
|
|
Count int64
|
|
Additional uint64
|
|
}
|
|
|
|
func (p *Order) CollectionName() string {
|
|
return "order"
|
|
}
|