Skip to content

D74 · v1's confirmed payments and its paid bills with no instalment load as paid

Accepted · 2026-10-23 · zuki · Closes #293 and #294 · Partly supersedes D34 (v1's payments table is not a source; the balance of record is the instalments alone)

Decision: Two kinds of money v1 holds outside the instalments load into v2.

1 · v1's payments table is a real record. The data phase's money step lines each of its rows up with the instalments inside v1's bills, and loads every payment finance has confirmed exactly once. A row finance hasn't confirmed (verif_status Pending) doesn't load:

v1 On the copy, 2026-10-23 v2
A payments row that matches an instalment by bill, amount and day 30,913 The same money: it loads once, from the instalment (D34)
An instalment with no payments row 263 · Rp 72.1M Loads from the instalment, as D34 says
A payments row that matches no instalment and is Pending 586 · Rp 125.8M Not loaded. The reconcile lists it by v1 id, with #294 as the reason, until finance confirms it in v1 or zuki signs it
A confirmed payments row that matches no instalment, on a bill that exists None on the day A migrated payment on the driver its lead_id names, allocated to its bill up to the bill's open balance; the rest is unallocated, the driver's credit
A confirmed payments row whose bill_id names no bill None on the day A migrated payment on its driver, unallocated
A payments row whose lead_id names no lead An unmatched row (R-MIG-04), never guessed

Of the 586, 19 name a bill that doesn't exist. The counts describe the v1 copy on the day; the step applies the rule to whatever v1 holds on the night it runs, so a row finance confirms in v1 before cutover loads on the next night's run, and one still Pending at cutover is recorded in v2 by finance once confirmed, like any new payment.

2 · A bill v1 marks paid with no instalment loads as paid. A bill with status Lunas, dibayar at least its total and no instalment in pembayaran[] loads one migrated payment of dibayar, on the charge's date, with migrated_from naming bills.data.dibayar. Its one allocation pays the charge in full; where dibayar is more than the total, the rest is unallocated, the driver's credit. On the copy that is 17,129 bills, nearly all of them the registration admin fee, about Rp 5.3B. A bill marked Lunas whose dibayar doesn't cover its total (40 on the copy, 18 of them admin fees with dibayar zero) loads as owed, as D34 says, and the reconcile lists it by v1 id with #293 as the reason until zuki signs it.

Why: zuki on #293, 2026-10-23, chose option (a), paid: read literally, D34 would have opened about Rp 5.4B of admin fees v1 shows as paid, and collection would chase them. zuki on #294, 2026-10-23: "the payment table is already functional. Try to align with data from bills and try to allocate them to respective drivers (leadId)". And on Pending: "newly added feature. It's as you've said, the payment data is in but finance team hasn't confirmed it yet." v2 has no pending payment: once recorded, a payment lowers the balance, so an unconfirmed one can't load. D34 had made the table no source, on the understanding that it was empty (D17), and asked for a change request if it held payments the bills don't. The money study found 586 (the report, finding 5), and this is that change request, answered.

Consequences:

  • The instalments stay the record of what they hold. A payment that both sides record is counted once, so no driver pays twice. D34 is otherwise unchanged.
  • The balance of record is computed from the instalments inside bills, the confirmed payments rows that match no instalment, and the dibayar of the paid bills with no instalment. "Balance per driver" reads all three; Pending rows count in neither check. "Payments per day and per bank account" reads the instalments and the confirmed payments rows; the paid bills' payments have no bank account, so that check counts them apart, by day. A difference counts until it is signed in migration.accepted_differences (D18).
  • An allocation never exceeds what the bill still owes (R-MON-15). Where a bill's instalments already paid it, the payment loads unallocated, as credit on the driver.
  • The money step's read-only check comes first. BE counts the 586 on the copy by verif_status, lead_id found or not, bill found or not, proof present or not, and how many match an instalment with no payments row by bill and amount on another day, which may be the same money recorded twice. Those counts go on #294 before the step is written; a pair found that way is reviewed on the step's pull request, not loaded twice.
  • Proof and bank account: both kinds are migrated payments, so migrated_from exempts them from R-MON-22 and R-MON-23 like any other (#295).
  • The rules: R-MON-54 says a migrated payment's allocations come from an instalment; it gains both kinds here, allocated from the payments row's bill_id or to the paid bill itself. Money's answered question on the balance of record cites this page too. Both are the Docs Engineer's, on #295.