update
This commit is contained in:
@@ -12,6 +12,24 @@ type Repository interface {
|
||||
CreateInquiry(ctx mycontext.Context, inquiry *entity.OrderInquiry) (*entity.OrderInquiry, error)
|
||||
FindInquiryByID(ctx mycontext.Context, id string) (*entity.OrderInquiry, error)
|
||||
UpdateInquiryStatus(ctx mycontext.Context, id string, status string) error
|
||||
GetOrderHistoryByPartnerID(ctx mycontext.Context, partnerID int64, req entity.SearchRequest) ([]*entity.Order, int64, error)
|
||||
GetOrderPaymentMethodBreakdown(
|
||||
ctx mycontext.Context,
|
||||
partnerID int64,
|
||||
req entity.SearchRequest,
|
||||
) ([]entity.PaymentMethodBreakdown, error)
|
||||
GetRevenueOverview(
|
||||
ctx mycontext.Context,
|
||||
req entity.RevenueOverviewRequest,
|
||||
) ([]entity.RevenueOverviewItem, error)
|
||||
GetSalesByCategory(
|
||||
ctx mycontext.Context,
|
||||
req entity.SalesByCategoryRequest,
|
||||
) ([]entity.SalesByCategoryItem, error)
|
||||
GetPopularProducts(
|
||||
ctx mycontext.Context,
|
||||
req entity.PopularProductsRequest,
|
||||
) ([]entity.PopularProductItem, error)
|
||||
}
|
||||
|
||||
type ProductService interface {
|
||||
@@ -42,21 +60,65 @@ type Service interface {
|
||||
CreateOrderInquiry(ctx mycontext.Context,
|
||||
req *entity.OrderRequest) (*entity.OrderInquiryResponse, error)
|
||||
ExecuteOrderInquiry(ctx mycontext.Context,
|
||||
token string, paymentMethod, paymentProvider, inProgressOrderID string) (*entity.OrderResponse, error)
|
||||
token string, paymentMethod, paymentProvider string, inProgressOrderID int64) (*entity.OrderResponse, error)
|
||||
GetOrderHistory(ctx mycontext.Context, partnerID int64, request entity.SearchRequest) ([]*entity.Order, int64, error)
|
||||
CalculateOrderTotals(
|
||||
ctx mycontext.Context,
|
||||
items []entity.OrderItemRequest,
|
||||
productDetails *entity.ProductDetails,
|
||||
source string,
|
||||
) (*entity.OrderCalculation, error)
|
||||
ValidateOrderItems(ctx mycontext.Context, items []entity.OrderItemRequest) ([]int64, []entity.OrderItemRequest, error)
|
||||
GetOrderPaymentAnalysis(
|
||||
ctx mycontext.Context,
|
||||
partnerID int64,
|
||||
req entity.SearchRequest,
|
||||
) (*entity.OrderPaymentAnalysis, error)
|
||||
GetRevenueOverview(
|
||||
ctx mycontext.Context,
|
||||
partnerID int64,
|
||||
year int,
|
||||
granularity string,
|
||||
status string,
|
||||
) ([]entity.RevenueOverviewItem, error)
|
||||
GetSalesByCategory(
|
||||
ctx mycontext.Context,
|
||||
partnerID int64,
|
||||
period string,
|
||||
status string,
|
||||
) ([]entity.SalesByCategoryItem, error)
|
||||
GetPopularProducts(
|
||||
ctx mycontext.Context,
|
||||
partnerID int64,
|
||||
period string,
|
||||
status string,
|
||||
limit int,
|
||||
sortBy string,
|
||||
) ([]entity.PopularProductItem, error)
|
||||
}
|
||||
|
||||
type Config interface {
|
||||
GetOrderFee(source string) float64
|
||||
}
|
||||
|
||||
type PartnerSettings interface {
|
||||
GetSettings(ctx mycontext.Context, partnerID int64) (*entity.PartnerSettings, error)
|
||||
}
|
||||
|
||||
type InProgressOrderRepository interface {
|
||||
GetListByPartnerID(ctx mycontext.Context, partnerID int64, limit, offset int) ([]*entity.InProgressOrder, error)
|
||||
}
|
||||
|
||||
type orderSvc struct {
|
||||
repo Repository
|
||||
product ProductService
|
||||
customer CustomerService
|
||||
transaction TransactionService
|
||||
crypt CryptService
|
||||
cfg Config
|
||||
notification NotificationService
|
||||
repo Repository
|
||||
product ProductService
|
||||
customer CustomerService
|
||||
transaction TransactionService
|
||||
crypt CryptService
|
||||
cfg Config
|
||||
notification NotificationService
|
||||
partnerSetting PartnerSettings
|
||||
inprogressOrder InProgressOrderRepository
|
||||
}
|
||||
|
||||
func New(
|
||||
@@ -67,14 +129,16 @@ func New(
|
||||
crypt CryptService,
|
||||
cfg Config,
|
||||
notification NotificationService,
|
||||
partnerSetting PartnerSettings,
|
||||
) Service {
|
||||
return &orderSvc{
|
||||
repo: repo,
|
||||
product: product,
|
||||
customer: customer,
|
||||
transaction: transaction,
|
||||
crypt: crypt,
|
||||
cfg: cfg,
|
||||
notification: notification,
|
||||
repo: repo,
|
||||
product: product,
|
||||
customer: customer,
|
||||
transaction: transaction,
|
||||
crypt: crypt,
|
||||
cfg: cfg,
|
||||
notification: notification,
|
||||
partnerSetting: partnerSetting,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user