fix: update inquiry order
This commit is contained in:
parent
8038e211db
commit
2fd676ef3e
@ -33,6 +33,7 @@ type Config struct {
|
|||||||
Email Email `mapstructure:"email"`
|
Email Email `mapstructure:"email"`
|
||||||
Withdraw Withdraw `mapstructure:"withdrawal"`
|
Withdraw Withdraw `mapstructure:"withdrawal"`
|
||||||
Discovery Discovery `mapstructure:"discovery"`
|
Discovery Discovery `mapstructure:"discovery"`
|
||||||
|
Order Order `mapstructure:"order"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
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
|
||||||
|
}
|
||||||
@ -52,6 +52,9 @@ email:
|
|||||||
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:"
|
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."
|
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:
|
withdrawal:
|
||||||
platform_fee: 5000
|
platform_fee: 5000
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,8 @@ type Order struct {
|
|||||||
PartnerID int64 `gorm:"type:int;column:partner_id"`
|
PartnerID int64 `gorm:"type:int;column:partner_id"`
|
||||||
Status string `gorm:"type:varchar;column:status"`
|
Status string `gorm:"type:varchar;column:status"`
|
||||||
Amount float64 `gorm:"type:numeric;not null;column:amount"`
|
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"`
|
SiteID *int64 `gorm:"type:numeric;not null;column:site_id"`
|
||||||
CreatedAt time.Time `gorm:"autoCreateTime;column:created_at"`
|
CreatedAt time.Time `gorm:"autoCreateTime;column:created_at"`
|
||||||
UpdatedAt time.Time `gorm:"autoUpdateTime;column:updated_at"`
|
UpdatedAt time.Time `gorm:"autoUpdateTime;column:updated_at"`
|
||||||
|
|||||||
@ -125,6 +125,8 @@ func MapOrderToCreateOrderResponse(orderResponse *entity.OrderResponse) response
|
|||||||
PartnerID: order.PartnerID,
|
PartnerID: order.PartnerID,
|
||||||
Status: order.Status,
|
Status: order.Status,
|
||||||
Amount: order.Amount,
|
Amount: order.Amount,
|
||||||
|
Total: order.Total,
|
||||||
|
Fee: order.Fee,
|
||||||
PaymentType: order.PaymentType,
|
PaymentType: order.PaymentType,
|
||||||
CreatedAt: order.CreatedAt,
|
CreatedAt: order.CreatedAt,
|
||||||
OrderItems: orderItems,
|
OrderItems: orderItems,
|
||||||
|
|||||||
@ -85,6 +85,8 @@ type CreateOrderResponse struct {
|
|||||||
PartnerID int64 `json:"partner_id"`
|
PartnerID int64 `json:"partner_id"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Amount float64 `json:"amount"`
|
Amount float64 `json:"amount"`
|
||||||
|
Total float64 `json:"total"`
|
||||||
|
Fee float64 `json:"fee"`
|
||||||
PaymentType string `json:"payment_type"`
|
PaymentType string `json:"payment_type"`
|
||||||
CreatedAt time.Time `json:"created_at"`
|
CreatedAt time.Time `json:"created_at"`
|
||||||
OrderItems []CreateOrderItemResponse `json:"order_items"`
|
OrderItems []CreateOrderItemResponse `json:"order_items"`
|
||||||
|
|||||||
@ -18,6 +18,10 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type Config interface {
|
||||||
|
GetOrderFee() float64
|
||||||
|
}
|
||||||
|
|
||||||
type OrderService struct {
|
type OrderService struct {
|
||||||
repo repository.Order
|
repo repository.Order
|
||||||
crypt repository.Crypto
|
crypt repository.Crypto
|
||||||
@ -26,6 +30,7 @@ type OrderService struct {
|
|||||||
payment repository.Payment
|
payment repository.Payment
|
||||||
txmanager repository.TransactionManager
|
txmanager repository.TransactionManager
|
||||||
wallet repository.WalletRepository
|
wallet repository.WalletRepository
|
||||||
|
cfg Config
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewOrderService(
|
func NewOrderService(
|
||||||
@ -33,7 +38,7 @@ func NewOrderService(
|
|||||||
product repository.Product, crypt repository.Crypto,
|
product repository.Product, crypt repository.Crypto,
|
||||||
midtrans repository.Midtrans, payment repository.Payment,
|
midtrans repository.Midtrans, payment repository.Payment,
|
||||||
txmanager repository.TransactionManager,
|
txmanager repository.TransactionManager,
|
||||||
wallet repository.WalletRepository) *OrderService {
|
wallet repository.WalletRepository, cfg Config) *OrderService {
|
||||||
return &OrderService{
|
return &OrderService{
|
||||||
repo: repo,
|
repo: repo,
|
||||||
product: product,
|
product: product,
|
||||||
@ -42,6 +47,7 @@ func NewOrderService(
|
|||||||
payment: payment,
|
payment: payment,
|
||||||
txmanager: txmanager,
|
txmanager: txmanager,
|
||||||
wallet: wallet,
|
wallet: wallet,
|
||||||
|
cfg: cfg,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +83,8 @@ func (s *OrderService) CreateOrder(ctx mycontext.Context, req *entity.OrderReque
|
|||||||
RefID: generator.GenerateUUID(),
|
RefID: generator.GenerateUUID(),
|
||||||
Status: order2.New.String(),
|
Status: order2.New.String(),
|
||||||
Amount: totalAmount,
|
Amount: totalAmount,
|
||||||
|
Total: totalAmount + s.cfg.GetOrderFee(),
|
||||||
|
Fee: s.cfg.GetOrderFee(),
|
||||||
PaymentType: req.PaymentMethod,
|
PaymentType: req.PaymentMethod,
|
||||||
SiteID: ctx.GetSiteID(),
|
SiteID: ctx.GetSiteID(),
|
||||||
CreatedBy: req.CreatedBy,
|
CreatedBy: req.CreatedBy,
|
||||||
|
|||||||
@ -50,7 +50,7 @@ func NewServiceManagerImpl(cfg *config.Config, repo *repository.RepoManagerImpl)
|
|||||||
BranchSvc: branch.NewBranchService(repo.Branch),
|
BranchSvc: branch.NewBranchService(repo.Branch),
|
||||||
StudioSvc: studio.NewStudioService(repo.Studio),
|
StudioSvc: studio.NewStudioService(repo.Studio),
|
||||||
ProductSvc: product.NewProductService(repo.Product),
|
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),
|
OSSSvc: oss.NewOSSService(repo.OSS),
|
||||||
PartnerSvc: partner.NewPartnerService(
|
PartnerSvc: partner.NewPartnerService(
|
||||||
repo.Partner, users.NewUserService(repo.User, repo.Branch), repo.Trx, repo.Wallet),
|
repo.Partner, users.NewUserService(repo.User, repo.Branch), repo.Trx, repo.Wallet),
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user