mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
fix(BE): edit customer, finance: bank optional, nominal minus, and filter
This commit is contained in:
@@ -110,7 +110,7 @@ func (s *injectionService) CreateOne(c *fiber.Ctx, req *validation.Create) (*ent
|
||||
PaymentDate: adjustmentDate,
|
||||
PaymentMethod: string(utils.PaymentMethodSaldo),
|
||||
BankId: req.BankId,
|
||||
Direction: "IN",
|
||||
Direction: directionForInjectionNominal(req.Nominal),
|
||||
Nominal: req.Nominal,
|
||||
Notes: req.Notes,
|
||||
CreatedBy: actorID,
|
||||
@@ -186,6 +186,7 @@ func (s injectionService) UpdateOne(c *fiber.Ctx, req *validation.Update, id uin
|
||||
}
|
||||
if req.Nominal != nil {
|
||||
updateBody["nominal"] = *req.Nominal
|
||||
updateBody["direction"] = directionForInjectionNominal(*req.Nominal)
|
||||
}
|
||||
if req.Notes != nil {
|
||||
updateBody["notes"] = *req.Notes
|
||||
@@ -210,6 +211,13 @@ func isInjectionTransaction(transactionType string) bool {
|
||||
return strings.EqualFold(transactionType, string(utils.TransactionTypeInjection))
|
||||
}
|
||||
|
||||
func directionForInjectionNominal(nominal float64) string {
|
||||
if nominal < 0 {
|
||||
return "OUT"
|
||||
}
|
||||
return "IN"
|
||||
}
|
||||
|
||||
func (s injectionService) generateInjectionCode(ctx context.Context) (string, error) {
|
||||
sequence, err := s.Repository.NextPaymentSequence(ctx)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user