Commit Graph

57 Commits

Author SHA1 Message Date
Nathnael Wondisha
616269a988 Merge branch 'staging' into dev-to-staging 2026-08-01 10:27:47 +03:00
Abubeker Yasin
aa4ce7fd23 feat: ( payment ) specific CBE query descriptions + Payment_Reason 2026-07-31 16:03:28 +03:00
Nathnael
97bfe95ec3 feat(payment): integrate CAC Bank OTP payments into freight flows
CAC Bank is an OTP debit with no redirect and no webhook: initiate SMSes a
code to the payer's mobile, and the charge only settles when that code is
confirmed. The payment service already spoke it (passenger uses it); the
freight side had the enum values but none of the flow.

API:
- PaymentClientService.confirmOtp forwards the code to
  POST /payments/intents/:id/confirm, mapping 400/404 to BadRequest so a
  mistyped code stays retryable instead of surfacing as a gateway failure.
- PaymentService.confirmOtp is keyed by the LOCAL intent id (the invoice's
  paymentId) rather than the domain reference, so the right invoice settles
  when several share a booking. On success billing settles the invoice.
- payInvoice rejects CAC_BANK without payerAccount before calling the
  gateway, and no longer runs the demo auto-settle for a COLLECT_OTP intent
  (it is not paid until the payer confirms).
- POST /billing/my-invoices/:id/confirm — ownership-checked, and since
  warehouse fee invoices are central invoices it covers those too.

Portal:
- useInvoicePayment owns the whole flow (initiate, redirect-or-OTP, confirm)
  and replaces the five near-identical pay mutations at the call sites.
- PaymentMethodModal gains the CAC Bank option, the payer mobile field, and
  the OTP step. Click-outside is disabled there so a stray click cannot drop
  the payer out of a live OTP window.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-07-31 08:11:23 +00:00
Abubeker
37855b0a83 feat: ( payment ) implement cbe payment 2026-07-31 07:50:10 +00:00
Marshal
acb6f286d4 fix(payments): reconcile with gateway before expiring unpaid holds
Replace the fixed 5-minute grace with a settlement check at expiry:
expire() calls the payment API's reconcile endpoint — paid intents are
kept and allocated via payment.succeeded, unverifiable results defer
expiry to the next tick, only verifiably unpaid holds expire.
2026-07-30 12:01:59 +00:00
Marshal
2ca04b8f98 changes export flow 2026-07-30 11:30:34 +00:00
Marshal
3a697e12f2 changes 2026-07-17 11:40:25 +00:00
Marshal
5a1e0dba4d Comment out payment event handling for local demos in BillingService 2026-07-17 07:43:17 +00:00
Marshal
71507b27fd changes 2026-07-16 20:09:59 +00:00
Marshal
35c53e3f36 changes 2026-07-16 20:03:35 +00:00
Nathnael
c19e4260c1 fix: revert the testing 2026-07-16 12:04:58 +00:00
Nathnael
6dde17fa4d fix: premature payable invoice 2026-07-16 08:38:49 +00:00
Nathnael
08faf56c4f fix: payment autopay on the payment init added for testing 2026-07-16 06:43:30 +00:00
Marshal
41fe04652f fix issue 2026-07-16 00:33:31 +00:00
Hagernesh
00875dd2f4 fix(billing): fallback PDF paginates long tables instead of truncating
The marshalling manifest cut off at one page ("... 10 more row(s) not
shown") because the fallback drew rows only until it hit the bottom band.
Now the table flows across as many pages as it needs:

- page 1 keeps the full header + summary tiles; continuation pages get a slim
  "(continued — page N)" header and a re-drawn table header
- the verification notice and signature lines stay pinned to the final page,
  moving to a fresh page when rows run too deep for the bottom band
- the copy watermark repeats on every page of its copy
- a 12-page safety cap keeps the old truncation note as a last resort

Verified by standalone render: 50-row manifest -> 2 pages, all 50 rows, no
truncation; 5-row doc stays 1 page; two-copy freight order still renders 2
watermarked pages.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 11:13:21 +00:00
Hagernesh
4ca4363489 fix(billing): fallback PDF renders duplicate-copy documents as watermarked pages
buildTabularFallbackPdf parsed the whole HTML at once, so a two-copy document
(freight order: Port Operations copy + Gate Security & Carrier copy) came out
as ONE page with every tile duplicated and no watermarks.

- documents wrapped in <section class="copy"> now render one page per copy,
  each parsed independently (no more merged/duplicated tiles)
- each page carries its copy label as a large rotated light-gray watermark,
  drawn beneath the content (new watermarkOp, 30-degree text matrix)
- new assemblePdf() multi-page assembler; assembleSinglePagePdf untouched for
  its existing callers
- the meta label is parsed from the document ("Booking") instead of the
  hardcoded "TRAIN / SCHEDULE"

Verified by compiling the util standalone and rendering a two-copy freight
order: 2 pages, both watermarks present, tiles once per page, valid xref/EOF;
copy-less documents (marshalling) still render a single unwatermarked page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 11:13:21 +00:00
Marshal
3349d256b8 ensure pessimistic-lock writes run in a transaction for invoice processing 2026-07-08 10:13:22 +00:00
Hagernesh
838895897d Marshaling doc fix 2026-07-06 19:12:14 +00:00
Hagernesh
bc47a42e1e export loading 2026-07-06 18:53:25 +00:00
marshal
ef2e8b6461 Merge pull request #460 from Tria-plc/freight_feature/usermanagement
Freight feature/usermanagement
2026-07-04 12:04:03 +03:00
Marshal
c4a92c6482 changes 2026-07-04 08:23:08 +00:00
marshal
8fbff3b91b Merge pull request #454 from Tria-plc/freight_feature/usermanagement
changes
2026-07-04 09:22:58 +03:00
Marshal
7058922987 changes 2026-07-04 06:19:35 +00:00
natib21
4ddf03e357 mile 2026-07-03 20:43:26 +00:00
Nathnael
53fed882be feat: setup pagination to find all invoice api 2026-07-03 06:20:05 +00:00
ghost2023
2c5e553d7c Merge branch 'dev' into freight/feat/fixes-v1 2026-07-02 16:43:16 +03:00
hagiye
5af45c2643 Customer Truck Assignment and Portal Delivary Approval 2026-07-02 15:54:16 +03:00
ghost2023
4098b5476f fix(temp): invoice no for the telebirr 2026-07-02 15:37:49 +03:00
Nathnael
787da1ccc0 chore: fix the invoice event 2026-07-02 12:35:43 +00:00
Nathnael Wondisha
e874de25fe Merge pull request #397 from Tria-plc/feight/fix/ui-ux-issues
Feight/fix/UI ux issues
2026-07-02 12:49:07 +03:00
Nathnael
41fc0cabdf fix: duplicate invoice 2026-07-02 09:44:56 +00:00
Nathnael
5aafa436c1 fixes 2026-07-02 09:38:14 +00:00
Nathnael
63937db32b fix: update the updateStatus iss 2026-07-02 09:22:25 +00:00
ghost2023
1c012ce1e2 refactor(payment): centralize invoice processing with detailed tracking and configurable logging 2026-07-02 11:47:35 +03:00
yaschalew
54b2114e7f fix issue 2026-07-02 11:28:56 +03:00
hagiye
14a00af341 train gate pass, Telebirr and Wafi 2026-07-01 16:23:52 +03:00
ghost2023
aef868bc40 fix: the invoice status syncing with booking payment window 2026-07-01 15:46:13 +03:00
Nathnael
94982d3c5a feat: setup pdf on the central billing 2026-07-01 06:25:24 +00:00
Nathnael
8ab27a6721 feat: add expiration to invoice 2026-07-01 06:19:07 +00:00
Nathnael
0056dec924 style: clean up the invoice and setup event for warehouse. 2026-06-30 13:28:14 +00:00
Nathnael
fa3138f2ac refactor: migrate the warehouse invoice to use the central one 2026-06-30 12:54:04 +00:00
Nathnael
5ad4efd7eb feat: add pdf to the central invoice system 2026-06-30 11:58:28 +00:00
Nathnael
21cf24950d feat: add partial payment to match the warehouse invoice before migration 2026-06-30 10:50:43 +00:00
Nathnael
69955bc0e6 feat: setup the invoice backend 2026-06-29 13:53:32 +00:00
Nathnael
2551f76f8a fix: reference type in payment and billing 2026-06-29 09:50:29 +00:00
Nathnael
4be4286fbf feat: rewired up the billing and payment with the booking 2026-06-29 09:25:46 +00:00
Nathnael
36711eace4 chore: type updates on the billing service 2026-06-29 08:28:12 +00:00
Nathnael
1da5af94ab feat: scoped the payables by type 2026-06-29 07:32:42 +00:00
Nathnael
5bad245ce8 feat: setup billing services 2026-06-29 07:11:52 +00:00
Nathnael
55c42058d0 chore: updating billing logic 2026-06-27 08:42:18 +00:00