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,
|
||||
|
||||
Reference in New Issue
Block a user