fix: update inquiry order
This commit is contained in:
@@ -18,6 +18,10 @@ import (
|
||||
"time"
|
||||
)
|
||||
|
||||
type Config interface {
|
||||
GetOrderFee() float64
|
||||
}
|
||||
|
||||
type OrderService struct {
|
||||
repo repository.Order
|
||||
crypt repository.Crypto
|
||||
@@ -26,6 +30,7 @@ type OrderService struct {
|
||||
payment repository.Payment
|
||||
txmanager repository.TransactionManager
|
||||
wallet repository.WalletRepository
|
||||
cfg Config
|
||||
}
|
||||
|
||||
func NewOrderService(
|
||||
@@ -33,7 +38,7 @@ func NewOrderService(
|
||||
product repository.Product, crypt repository.Crypto,
|
||||
midtrans repository.Midtrans, payment repository.Payment,
|
||||
txmanager repository.TransactionManager,
|
||||
wallet repository.WalletRepository) *OrderService {
|
||||
wallet repository.WalletRepository, cfg Config) *OrderService {
|
||||
return &OrderService{
|
||||
repo: repo,
|
||||
product: product,
|
||||
@@ -42,6 +47,7 @@ func NewOrderService(
|
||||
payment: payment,
|
||||
txmanager: txmanager,
|
||||
wallet: wallet,
|
||||
cfg: cfg,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,6 +83,8 @@ func (s *OrderService) CreateOrder(ctx mycontext.Context, req *entity.OrderReque
|
||||
RefID: generator.GenerateUUID(),
|
||||
Status: order2.New.String(),
|
||||
Amount: totalAmount,
|
||||
Total: totalAmount + s.cfg.GetOrderFee(),
|
||||
Fee: s.cfg.GetOrderFee(),
|
||||
PaymentType: req.PaymentMethod,
|
||||
SiteID: ctx.GetSiteID(),
|
||||
CreatedBy: req.CreatedBy,
|
||||
|
||||
@@ -50,7 +50,7 @@ func NewServiceManagerImpl(cfg *config.Config, repo *repository.RepoManagerImpl)
|
||||
BranchSvc: branch.NewBranchService(repo.Branch),
|
||||
StudioSvc: studio.NewStudioService(repo.Studio),
|
||||
ProductSvc: product.NewProductService(repo.Product),
|
||||
OrderSvc: order.NewOrderService(repo.Order, repo.Product, repo.Crypto, repo.Midtrans, repo.Payment, repo.Trx, repo.Wallet),
|
||||
OrderSvc: order.NewOrderService(repo.Order, repo.Product, repo.Crypto, repo.Midtrans, repo.Payment, repo.Trx, repo.Wallet, &cfg.Order),
|
||||
OSSSvc: oss.NewOSSService(repo.OSS),
|
||||
PartnerSvc: partner.NewPartnerService(
|
||||
repo.Partner, users.NewUserService(repo.User, repo.Branch), repo.Trx, repo.Wallet),
|
||||
|
||||
Reference in New Issue
Block a user