fix(BE): add party account number in payments

This commit is contained in:
Hafizh A. Y
2026-01-09 16:03:41 +07:00
parent 8a57d439dc
commit b7914e8294
12 changed files with 104 additions and 68 deletions
@@ -101,20 +101,25 @@ func ToInitialDetailDTO(e entity.Payment) InitialDetailDTO {
func partyFromInitial(e entity.Payment) Party {
party := Party{
Id: e.PartyId,
Type: e.PartyType,
Id: e.PartyId,
Type: e.PartyType,
}
if e.PartyAccountNumber != nil {
party.AccountNumber = *e.PartyAccountNumber
}
switch utils.PaymentParty(e.PartyType) {
case utils.PaymentPartyCustomer:
if e.Customer != nil && e.Customer.Id != 0 {
party.Name = e.Customer.Name
party.AccountNumber = e.Customer.AccountNumber
if party.AccountNumber == "" {
party.AccountNumber = e.Customer.AccountNumber
}
}
case utils.PaymentPartySupplier:
if e.Supplier != nil && e.Supplier.Id != 0 {
party.Name = e.Supplier.Name
if e.Supplier.AccountNumber != nil {
if party.AccountNumber == "" && e.Supplier.AccountNumber != nil {
party.AccountNumber = *e.Supplier.AccountNumber
}
}
@@ -120,6 +120,7 @@ func (s *initialService) CreateOne(c *fiber.Ctx, req *validation.Create) (*entit
TransactionType: string(utils.TransactionTypeSaldoAwal),
PartyType: party,
PartyId: req.PartyId,
PartyAccountNumber: nil,
PaymentDate: time.Now(),
PaymentMethod: string(utils.PaymentMethodSaldo),
BankId: req.BankId,