mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 00:38:11 +00:00
View manual (offline) payment channel settings
Confirm offline (bank transfer) invoice payment
This commit is contained in:
@@ -113,3 +113,36 @@ export function clearanceCodesForBooking(booking: Booking): {
|
||||
includesCustoms,
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Statuses after which clearance documents are closed: the shipment is paid
|
||||
* and moving. Everything before that — review, clearance ready, operation
|
||||
* request, batch selection, PNR, payment verification — still accepts new
|
||||
* customer documents and still lets GL review them.
|
||||
*/
|
||||
const CLEARANCE_DOCS_CLOSED_STATUSES = new Set<string>([
|
||||
'PAID',
|
||||
'IN_TRANSIT',
|
||||
'ARRIVED',
|
||||
'COMPLETED',
|
||||
'REJECTED',
|
||||
'CANCELLED',
|
||||
'EXPIRED',
|
||||
]);
|
||||
|
||||
/**
|
||||
* True while the customer may still attach clearance documents and GL may
|
||||
* still approve or query them.
|
||||
*
|
||||
* Clearance finalization is NOT the cut-off: a customs shipment keeps
|
||||
* collecting paperwork (amended invoices, revised packing lists, port
|
||||
* documents) right up to the final invoice being settled. Both the customer's
|
||||
* upload endpoint and GL's review endpoint gate on this one predicate, so the
|
||||
* two sides can never drift apart.
|
||||
*/
|
||||
export function clearanceDocumentsOpen(booking: Booking): boolean {
|
||||
if (CLEARANCE_DOCS_CLOSED_STATUSES.has(booking.status)) return false;
|
||||
// Payment settled ahead of the status transition (webhook ordering).
|
||||
if (booking.paymentStatus === 'PAID') return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user