fix: update inquiry order
This commit is contained in:
parent
8038e211db
commit
2fd676ef3e
@ -33,6 +33,7 @@ type Config struct {
|
||||
Email Email `mapstructure:"email"`
|
||||
Withdraw Withdraw `mapstructure:"withdrawal"`
|
||||
Discovery Discovery `mapstructure:"discovery"`
|
||||
Order Order `mapstructure:"order"`
|
||||
}
|
||||
|
||||
var (
|
||||
|
||||
9
config/order.go
Normal file
9
config/order.go
Normal file
@ -0,0 +1,9 @@
|
||||
package config
|
||||
|
||||
type Order struct {
|
||||
Fee float64 `mapstructure:"fee"`
|
||||
}
|
||||
|
||||
func (w *Order) GetOrderFee() float64 {
|
||||
return w.Fee
|
||||
}
|
||||
@ -51,6 +51,9 @@ email:
|
||||
subject: "Reset Password"
|
||||
opening_word: "Terima kasih sudah menjadi bagian dari Furtuna. Anda telah berhasil melakukan reset password, silakan masukan unik password yang dibuat oleh sistem dibawah ini:"
|
||||
closing_word: "Silakan login kembali menggunakan email dan password anda diatas, sistem akan secara otomatis meminta anda untuk membuat password baru setelah berhasil login. Mohon maaf atas kendala yang dialami."
|
||||
|
||||
order:
|
||||
fee: 5000
|
||||
|
||||
withdrawal:
|
||||
platform_fee: 5000
|
||||
|
||||
@ -10,6 +10,8 @@ type Order struct {
|
||||
PartnerID int64 `gorm:"type:int;column:partner_id"`
|
||||
Status string `gorm:"type:varchar;column:status"`
|
||||
Amount float64 `gorm:"type:numeric;not null;column:amount"`
|
||||
Total float64 `gorm:"type:numeric;not null;column:total"`
|
||||
Fee float64 `gorm:"type:numeric;not null;column:fee"`
|
||||
SiteID *int64 `gorm:"type:numeric;not null;column:site_id"`
|
||||
CreatedAt time.Time `gorm:"autoCreateTime;column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"autoUpdateTime;column:updated_at"`
|
||||
|
||||
@ -125,6 +125,8 @@ func MapOrderToCreateOrderResponse(orderResponse *entity.OrderResponse) response
|
||||
PartnerID: order.PartnerID,
|
||||
Status: order.Status,
|
||||
Amount: order.Amount,
|
||||
Total: order.Total,
|
||||
Fee: order.Fee,
|
||||
PaymentType: order.PaymentType,
|
||||
CreatedAt: order.CreatedAt,
|
||||
OrderItems: orderItems,
|
||||
|
||||
@ -85,6 +85,8 @@ type CreateOrderResponse struct {
|
||||
PartnerID int64 `json:"partner_id"`
|
||||
Status string `json:"status"`
|
||||
Amount float64 `json:"amount"`
|
||||
Total float64 `json:"total"`
|
||||
Fee float64 `json:"fee"`
|
||||
PaymentType string `json:"payment_type"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
OrderItems []CreateOrderItemResponse `json:"order_items"`
|
||||
|
||||
@ -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),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user