Documentation
¶
Index ¶
- type OrderDetail
- type OrderRepo
- type OrderResult
- type OrderUsecase
- func (uc *OrderUsecase) CloseOrder(ctx context.Context, userID int, orderNo string) error
- func (uc *OrderUsecase) PreCreateOrder(ctx context.Context, req *PreCreateOrderParams) (*PreCreateOrderResult, error)
- func (uc *OrderUsecase) Purchase(ctx context.Context, req *PurchaseParams) (*OrderResult, error)
- func (uc *OrderUsecase) QueryOrderDetail(ctx context.Context, userID int, orderNo string) (*OrderDetail, error)
- func (uc *OrderUsecase) QueryOrderList(ctx context.Context, userID int, page, size int, status, orderType int32) ([]*OrderDetail, int32, error)
- func (uc *OrderUsecase) Recharge(ctx context.Context, req *RechargeParams) (*OrderResult, error)
- func (uc *OrderUsecase) Renewal(ctx context.Context, req *RenewalParams) (*OrderResult, error)
- func (uc *OrderUsecase) ResetTraffic(ctx context.Context, req *ResetTrafficParams) (*OrderResult, error)
- type PaymentMethod
- type PreCreateOrderParams
- type PreCreateOrderResult
- type PurchaseParams
- type RechargeParams
- type RenewalParams
- type ResetTrafficParams
- type Subscribe
- type SubscribeDiscount
- type SubscribePriceOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OrderDetail ¶
type OrderDetail struct {
ID int64
ParentID int64
UserID int64
OrderNo string
Type int32
Quantity int64
Price int64
Amount int64
GiftAmount int64
Discount int64
Coupon string
CouponDiscount int64
Commission int64
Payment *PaymentMethod // Nested payment method object
Method string
FeeAmount int64
TradeNo string
Status int32
SubscribeID int64
PriceOptionID int64
PriceOptionName string
DurationUnit string
DurationValue int64
OptionPrice int64
SubscribeToken string
IsNew bool
CreatedAt int64
UpdatedAt int64
Subscribe *Subscribe // Nested subscribe object
// Additional fields for backward compatibility
SubscribeName string
PaymentName string
StatusText string
TypeText string
}
OrderDetail represents order detail
type OrderRepo ¶
type OrderRepo interface {
// CloseOrder closes an order
CloseOrder(ctx context.Context, userID int, orderNo string) error
// QueryOrderDetail queries order detail
QueryOrderDetail(ctx context.Context, userID int, orderNo string) (*OrderDetail, error)
// QueryOrderList queries order list
QueryOrderList(ctx context.Context, userID int, page, size int, status, orderType int32) ([]*OrderDetail, int32, error)
// PreCreateOrder validates and calculates order price
PreCreateOrder(ctx context.Context, req *PreCreateOrderParams) (*PreCreateOrderResult, error)
// Purchase creates a purchase order
Purchase(ctx context.Context, req *PurchaseParams) (*OrderResult, error)
// Recharge creates a recharge order
Recharge(ctx context.Context, req *RechargeParams) (*OrderResult, error)
// Renewal creates a renewal order
Renewal(ctx context.Context, req *RenewalParams) (*OrderResult, error)
// ResetTraffic creates a reset traffic order
ResetTraffic(ctx context.Context, req *ResetTrafficParams) (*OrderResult, error)
}
OrderRepo is the interface for order data access
type OrderResult ¶
type OrderResult struct {
OrderID int64
OrderNo string
Amount int64
PaymentURL string
QRCode string
}
OrderResult represents order creation result
type OrderUsecase ¶
type OrderUsecase struct {
// contains filtered or unexported fields
}
OrderUsecase is the usecase for public order operations
func NewOrderUsecase ¶
func NewOrderUsecase(repo OrderRepo, logger log.Logger) *OrderUsecase
NewOrderUsecase creates a new OrderUsecase
func (*OrderUsecase) CloseOrder ¶
CloseOrder closes an order
func (*OrderUsecase) PreCreateOrder ¶
func (uc *OrderUsecase) PreCreateOrder(ctx context.Context, req *PreCreateOrderParams) (*PreCreateOrderResult, error)
PreCreateOrder validates and calculates order price
func (*OrderUsecase) Purchase ¶
func (uc *OrderUsecase) Purchase(ctx context.Context, req *PurchaseParams) (*OrderResult, error)
Purchase creates a purchase order
func (*OrderUsecase) QueryOrderDetail ¶
func (uc *OrderUsecase) QueryOrderDetail(ctx context.Context, userID int, orderNo string) (*OrderDetail, error)
QueryOrderDetail queries order detail
func (*OrderUsecase) QueryOrderList ¶
func (uc *OrderUsecase) QueryOrderList(ctx context.Context, userID int, page, size int, status, orderType int32) ([]*OrderDetail, int32, error)
QueryOrderList queries order list
func (*OrderUsecase) Recharge ¶
func (uc *OrderUsecase) Recharge(ctx context.Context, req *RechargeParams) (*OrderResult, error)
Recharge creates a recharge order
func (*OrderUsecase) Renewal ¶
func (uc *OrderUsecase) Renewal(ctx context.Context, req *RenewalParams) (*OrderResult, error)
Renewal creates a renewal order
func (*OrderUsecase) ResetTraffic ¶
func (uc *OrderUsecase) ResetTraffic(ctx context.Context, req *ResetTrafficParams) (*OrderResult, error)
ResetTraffic creates a reset traffic order
type PaymentMethod ¶
type PaymentMethod struct {
ID int64
Name string
Platform string
Description string
Icon string
FeeMode int32
FeePercent int64
FeeAmount int64
}
PaymentMethod represents payment method
type PreCreateOrderParams ¶
type PreCreateOrderParams struct {
UserID int64
Type int32
SubscribeID int64
SubscribeGroupID int64
Quantity int64
PriceOptionID int64
Coupon string
Payment int64
}
PreCreateOrderParams represents pre-create order parameters
type PreCreateOrderResult ¶
type PreCreateOrderResult struct {
Price int64
Amount int64
Discount int64
CouponDiscount int64
FeeAmount int64
Commission int64
GiftAmount int64
Valid bool
Message string
}
PreCreateOrderResult represents pre-create order result
type PurchaseParams ¶
type PurchaseParams struct {
UserID int64
SubscribeID int64
PriceOptionID int64
Quantity int64
Coupon string
Payment int64
}
PurchaseParams represents purchase parameters
type RechargeParams ¶
RechargeParams represents recharge parameters
type RenewalParams ¶
type RenewalParams struct {
UserID int64
UserSubscribeID int64
PriceOptionID int64
Quantity int64
Coupon string
Payment int64
}
RenewalParams represents renewal parameters
type ResetTrafficParams ¶
ResetTrafficParams represents reset traffic parameters
type Subscribe ¶
type Subscribe struct {
ID int64
Name string
Language string
Description string
UnitPrice int64
UnitTime string
Discount []SubscribeDiscount
Replacement int64
Inventory int64
Traffic int64
SpeedLimit int64
DeviceLimit int64
Quota int64
CategoryID int64
CategoryName string
Nodes []int
NodeTags []string
Show bool
Sell bool
Sort int64
DeductionRatio int64
AllowDeduction bool
NodeGroupIds []string
NodeGroupId string
ResetCycle int64
RenewalReset bool
ShowOriginalPrice bool
PriceOptions []SubscribePriceOption
CreatedAt int64
UpdatedAt int64
}
Subscribe represents subscribe
type SubscribeDiscount ¶
SubscribeDiscount represents subscribe discount
type SubscribePriceOption ¶ added in v1.0.10
type SubscribePriceOption struct {
ID int64
SubscribeID int64
Code string
Type string
Name string
DurationUnit string
DurationValue int64
Price int64
OriginalPrice int64
Inventory int64
Show bool
Sell bool
IsDefault bool
Sort int64
CreatedAt int64
UpdatedAt int64
}
SubscribePriceOption represents a public sellable price/duration option.