Commit Graph

45 Commits

Author SHA1 Message Date
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
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
18311f22f7 Comment out payment event handling for local demos in BillingService 2026-07-17 09:20:36 +00:00
Marshal
7058922987 changes 2026-07-04 06:19:35 +00:00
ghost2023
79c3293a72 fix: booking paid trigger 2026-07-02 16:18:46 +03:00
Nathnael
0056dec924 style: clean up the invoice and setup event for warehouse. 2026-06-30 13:28:14 +00:00
Nathnael
7fa18b8ee7 fix: reference type in payment service 2026-06-30 11:54:43 +00:00
Marshal
ce3584cd4a cfix payment 2026-06-29 15:41:00 +00:00
Nathnael Wondisha
4cf8e89780 Merge branch 'dev' into freight/feat/invoice 2026-06-29 17:24:29 +03:00
yaschalew
0d4587cf52 Merge branch 'freight/feature/last_mile_invoice' of github.com:Tria-plc/edr-platform into freight/feature/last_mile_invoice 2026-06-29 15:26:54 +03:00
natib21
fc95d48d28 fix 2026-06-29 12:25:36 +00:00
marshal
6685a3ba76 payemnt 2026-06-29 15:17:51 +03:00
marshal
b688a76550 payemnt 2026-06-29 15:05:50 +03:00
marshal
1491db304b payemnt 2026-06-29 15:04:01 +03: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
9cd24d9b51 feat(WIP): Wire up the invoice with the booking. 2026-06-29 08:29:07 +00:00
Marshal
01d53c218c contrat,booking,global logestic 2026-06-26 23:24:48 +00:00
marshal
49ae46934a fix(freight-api): call acceptBooking after payment completion 2026-06-24 12:16:03 +03:00
Nathnael Wondisha
56968e0709 Merge branch 'freight/develop' into freight/style/ui-sync 2026-06-23 09:51:24 +03:00
Nathnael
a6f3fd5643 feat: finish company profile in the backoffice 2026-06-23 06:45:29 +00:00
Marshal
b6d5047d27 feat: Implement general contract booking orders functionality
- Add DTOs for creating booking orders and viewing contract quantities.
- Create entities for booking orders and booking order lines.
- Implement service for managing general contract operations, including activation after payment and retrieving quantity lines.
- Develop UI components for contract detail and list pages, including order placement dialog.
- Integrate API service for booking orders, enabling listing and creating orders against contracts.
- Enhance contract status display and quantity pool visualization in the UI.
2026-06-20 19:31:51 +00:00
Marshal
5b9fed57fe add payment success and failure pages with environment variable support 2026-06-17 17:13:19 +00:00
marshal
d7476a51c1 Removed console.log statements and corrected the amount calculation by removing the multiplication by 100. 2026-06-17 14:21:33 +03:00
Marshal
2de3f78fb0 Add payments management features including summary and listing, and integrate with the dashboard 2026-06-17 04:35:43 +00:00
marshal
0aed9824ae cac payemnt integration and cbe rate exchange webscrabing 2026-06-15 14:54:20 +03:00
marshal
fe1bed8c4b payment integration 2026-06-15 11:09:58 +03:00
marshal
484151d909 payments 2026-06-14 15:59:52 +03:00
marshal
ef0abf1c41 auto allocation and batch managemnt, tracking the train 2026-06-12 11:42:46 +03:00
Marshal
cde3e462ba automate the schedule 2026-06-11 19:42:23 +00:00
marshal
c871330f7f resolve merge conflict 2026-06-11 10:52:37 +03:00
marshal
10b011de8f merge conflict 2026-06-10 16:45:45 +03:00
marshal
5774d7db9d booking operations and trains scheduling also allocations 2026-06-10 00:48:32 +03:00
Eyosiyas Girma
7c5e7408b0 Merge branch 'freight/develop' into freight/feature/telebirr-integration 2026-06-08 16:35:18 +03:00
Eyosiyas
3a66242f8b working on dmoney 2026-06-08 16:29:20 +03:00
Eyosiyas
a1940c4901 telebirr out in the payment 2026-06-08 11:49:50 +03:00
ghost2023
df725015a1 fix(api): improve payment status API handling and frontend user experience 2026-06-08 08:51:54 +03:00
Eyosiyas
b5f64bc9ad providers 2026-06-06 11:32:14 +03:00
Tria
828f93d160 minor update 2026-06-06 08:13:38 +03:00
Tria
ebe59f491a payment | webhook 2026-06-05 17:34:33 +03:00
Tria
6786bdd210 receipt template 2026-06-05 17:23:21 +03:00
Tria
21bc6948e8 receipt 2026-06-05 15:56:29 +03:00
Tria
c0dc9f5fc5 payment 2026-06-05 12:54:35 +03:00
Tria
7c124d9845 telebirr configured 2026-06-05 11:01:01 +03:00
Tria
93020b3153 working on payment 2026-06-04 16:18:14 +03:00