package order import ( "context" "enaklo-pos-be/internal/common/mycontext" "enaklo-pos-be/internal/entity" ) type Repository interface { Create(ctx mycontext.Context, order *entity.Order) (*entity.Order, error) FindByID(ctx mycontext.Context, id int64) (*entity.Order, error) 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 } type ProductService interface { GetProductDetails(ctx mycontext.Context, productIDs []int64, partnerID int64) (*entity.ProductDetails, error) GetProductsByIDs(ctx mycontext.Context, ids []int64, partnerID int64) ([]*entity.Product, error) } type CustomerService interface { ResolveCustomer(ctx mycontext.Context, req *entity.CustomerResolutionRequest) (int64, error) AddPoints(ctx mycontext.Context, customerID int64, points int, reference string) error GetCustomer(ctx mycontext.Context, id int64) (*entity.Customer, error) } type TransactionService interface { Create(ctx mycontext.Context, transaction *entity.Transaction) (*entity.Transaction, error) } type CryptService interface { GenerateJWTOrderInquiry(inquiry *entity.OrderInquiry) (string, error) ValidateJWTOrderInquiry(tokenString string) (int64, string, error) } type NotificationService interface { SendEmailTransactional(ctx context.Context, param entity.SendEmailNotificationParam) error } 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) } type Config interface { GetOrderFee(source string) float64 } type orderSvc struct { repo Repository product ProductService customer CustomerService transaction TransactionService crypt CryptService cfg Config notification NotificationService } func New( repo Repository, product ProductService, customer CustomerService, transaction TransactionService, crypt CryptService, cfg Config, notification NotificationService, ) Service { return &orderSvc{ repo: repo, product: product, customer: customer, transaction: transaction, crypt: crypt, cfg: cfg, notification: notification, } }