Add refund order

This commit is contained in:
aditya.siregar
2025-06-14 21:17:13 +07:00
parent 58d3b32c40
commit ebb33186b8
42 changed files with 1152 additions and 2094 deletions
+9
View File
@@ -12,6 +12,7 @@ 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
UpdateOrder(ctx mycontext.Context, id int64, status string, description string) error
GetOrderHistoryByPartnerID(ctx mycontext.Context, partnerID int64, req entity.SearchRequest) ([]*entity.Order, int64, error)
GetOrderPaymentMethodBreakdown(
ctx mycontext.Context,
@@ -65,6 +66,7 @@ type Service interface {
req *entity.OrderRequest) (*entity.OrderInquiryResponse, error)
ExecuteOrderInquiry(ctx mycontext.Context,
token string, paymentMethod, paymentProvider string, inProgressOrderID int64) (*entity.OrderResponse, error)
RefundRequest(ctx mycontext.Context, partnerID, orderID int64, reason string) error
GetOrderHistory(ctx mycontext.Context, partnerID int64, request entity.SearchRequest) ([]*entity.Order, int64, error)
CalculateOrderTotals(
ctx mycontext.Context,
@@ -122,6 +124,10 @@ type VoucherUndianRepo interface {
CreateUndianVouchers(ctx mycontext.Context, vouchers []*entity.UndianVoucherDB) error
}
type CashierSvc interface {
GetOpenSession(ctx mycontext.Context, cashierID int64) (*entity.CashierSession, error)
}
type orderSvc struct {
repo Repository
product ProductService
@@ -133,6 +139,7 @@ type orderSvc struct {
partnerSetting PartnerSettings
inprogressOrder InProgressOrderRepository
voucherUndianRepo VoucherUndianRepo
cashierSvc CashierSvc
}
func New(
@@ -145,6 +152,7 @@ func New(
notification NotificationService,
partnerSetting PartnerSettings,
voucherUndianRepo VoucherUndianRepo,
cashierSvc CashierSvc,
) Service {
return &orderSvc{
repo: repo,
@@ -156,5 +164,6 @@ func New(
notification: notification,
partnerSetting: partnerSetting,
voucherUndianRepo: voucherUndianRepo,
cashierSvc: cashierSvc,
}
}