Merge branch 'alpha' of github.com:Tria-plc/edr-platform into alpha

This commit is contained in:
Abubeker Yasin
2026-07-24 13:59:21 +03:00
445 changed files with 33383 additions and 7513 deletions

View File

@@ -135,15 +135,18 @@ export class WaafiProvider implements PaymentProvider, OnModuleInit {
// Waafi returns transaction info (params.status) ONLY when responseCode is 2001. For an
// unpaid or not-yet-existing transaction it returns an error envelope (e.g. 5001 / E10206
// "Failed to get transaction info") with no status. Treat that as still-pending (PROCESSING),
// never terminal — so the intent keeps waiting for the webhook / its expiry rather than being
// wrongly resolved off a "no info" response.
// "Failed to get transaction info") with no status — i.e. the payer hasn't done anything at
// the hosted page yet. That's REQUIRES_ACTION (still awaiting the payer), NOT PROCESSING:
// returning PROCESSING here would let the reconciliation sweep persist that guess and block
// the payer from switching providers on a session they never touched (see cac-bank.provider's
// queryStatus for the same convention). The intent still resolves correctly either way — via
// the webhook on a genuine payment, or via expiresAt once the 5-minute HPP session lapses.
if (response.responseCode !== WAAFI_SUCCESS_CODE) {
this.logger.warn(
`Waafi HPP_GETTRANINFO ${merchantOrderId}: ${response.responseCode}/${response.errorCode} ${response.responseMsg} — treating as pending`,
`Waafi HPP_GETTRANINFO ${merchantOrderId}: ${response.responseCode}/${response.errorCode} ${response.responseMsg} — treating as still awaiting the payer`,
);
return {
status: ProviderPaymentStatus.PROCESSING,
status: ProviderPaymentStatus.REQUIRES_ACTION,
rawResponse: response as unknown as Record<string, unknown>,
};
}

View File

@@ -42,7 +42,6 @@ export const CONTRACT_STATUSES = [
"FULLY_EXECUTED", // ONE_TIME
"CONTRACT_ACTIVE", // GENERAL
// customs clearance execution (Path B, pre-booking)
"AWAITING_CLEARANCE_PAYMENT", // clearance service fee invoiced, unpaid
"AWAITING_CLEARANCE_DOCUMENTS",
"CLEARANCE_UNDER_REVIEW",
"CLEARANCE_READY_FOR_BOOKING",
@@ -68,7 +67,6 @@ export type ContractStatus = (typeof CONTRACT_STATUSES)[number];
*/
export const CONTRACT_CLEARANCE_STATUSES = [
"NOT_APPLICABLE",
"AWAITING_PAYMENT", // Path B — clearance service fee must be paid first
"AWAITING_DOCUMENTS",
"DOCUMENTS_UNDER_REVIEW",
"CLEARANCE_READY_FOR_BOOKING", // Path B — GL may create the booking
@@ -89,6 +87,7 @@ export const CONTRACT_CUSTOMER_EDITABLE_STATUSES: ContractStatus[] = [
export type ContractRateUnit =
| "per_container"
| "per_wagon"
| "per_ton"
| "per_item"
| "per_km"
@@ -534,6 +533,7 @@ export const INCIDENT_TYPES = [
"CONTAINER_OPENED",
"CONTAINER_DAMAGED",
"FLUID_LEAKING",
"OTHER",
] as const;
export type IncidentType = (typeof INCIDENT_TYPES)[number];
@@ -847,6 +847,8 @@ export interface CreateBookingUnderContractDto {
equipmentReturn?: string;
containers?: CreateBookingContainerLineDto[];
bulkLines?: CreateBulkLineDto[];
/** What the containers carry — captured per booking (container freight). */
cargoFreeText?: string;
notes?: string;
}

View File

@@ -103,8 +103,6 @@ export enum BookingStatus {
PendingConsolidation = "PENDING_CONSOLIDATION",
Consolidated = "CONSOLIDATED",
// Post counter-sign document-clearance gate (GL workflow).
/** Clearance service fee invoiced; docs + GL work locked until paid. */
AwaitingClearancePayment = "AWAITING_CLEARANCE_PAYMENT",
AwaitingDocuments = "AWAITING_DOCUMENTS",
DocumentsUnderReview = "DOCUMENTS_UNDER_REVIEW",
ClearanceReady = "CLEARANCE_READY",