mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-30 04:08:11 +00:00
View manual (offline) payment channel settings
Confirm offline (bank transfer) invoice payment
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
import { Booking } from './entities/booking.entity';
|
||||
import { clearanceDocumentsOpen } from './clearance.util';
|
||||
|
||||
/**
|
||||
* The customer may attach clearance documents — and GL may review them — right
|
||||
* up to payment, not merely until clearance is finalized. Both the upload and
|
||||
* the review endpoint gate on this one predicate, so a drift here silently
|
||||
* desynchronizes the two sides.
|
||||
*/
|
||||
const booking = (patch: Partial<Booking>): Booking =>
|
||||
({ status: 'CLEARANCE_READY', paymentStatus: 'PENDING', ...patch }) as Booking;
|
||||
|
||||
describe('clearanceDocumentsOpen', () => {
|
||||
it('stays open across the whole pre-payment flow', () => {
|
||||
for (const status of [
|
||||
'AWAITING_DOCUMENTS',
|
||||
'DOCUMENTS_UNDER_REVIEW',
|
||||
'CLEARANCE_READY',
|
||||
'OPERATION_REQUEST_PENDING',
|
||||
'SELECTED_FOR_BATCH',
|
||||
'PNR_GENERATED',
|
||||
'PAYMENT_VERIFICATION_IN_PROGRESS',
|
||||
]) {
|
||||
expect(clearanceDocumentsOpen(booking({ status }))).toBe(true);
|
||||
}
|
||||
});
|
||||
|
||||
it('closes once the shipment is paid or finished', () => {
|
||||
for (const status of ['PAID', 'IN_TRANSIT', 'ARRIVED', 'COMPLETED']) {
|
||||
expect(clearanceDocumentsOpen(booking({ status }))).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it('closes on a dead booking', () => {
|
||||
for (const status of ['REJECTED', 'CANCELLED', 'EXPIRED']) {
|
||||
expect(clearanceDocumentsOpen(booking({ status }))).toBe(false);
|
||||
}
|
||||
});
|
||||
|
||||
it('closes when payment settled before the status caught up', () => {
|
||||
expect(
|
||||
clearanceDocumentsOpen(
|
||||
booking({ status: 'PNR_GENERATED', paymentStatus: 'PAID' }),
|
||||
),
|
||||
).toBe(false);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user