fix: types

This commit is contained in:
Nathnael
2026-06-29 14:10:10 +00:00
parent 6d40d185d6
commit e9f9450b0f
2 changed files with 54 additions and 51 deletions

View File

@@ -6,53 +6,13 @@ import type { InitiateResponse } from "./payments.service";
const B = URL_CONSTANTS.BILLING; const B = URL_CONSTANTS.BILLING;
export interface InvoiceCompany { /** A customer-facing invoice row, as returned by `GET /billing/my-invoices`. */
id: string; export type PortalInvoice = Freight.IInvoice;
name: string;
}
export interface InvoiceCompanyProfile { /** An invoice plus its line items, as returned by `GET /billing/my-invoices/:id`. */
id: string; export type PortalInvoiceDetail = Freight.IInvoice & {
type: string; lines: Freight.IInvoiceLine[];
reference: string | null; };
}
/**
* A customer-facing invoice row, as returned by `GET /billing/my-invoices`.
* Mirrors the freight `Invoice` entity (the shared `Freight.IInvoice` type is
* stale and intentionally not reused here).
*/
export interface PortalInvoice {
id: string;
invoiceNumber: string;
totalAmount: number;
currency: string;
status: Freight.InvoiceStatus;
/** Originating subsystem: booking / warehouse / demurrage. */
source: string;
sourceId: string;
/** What the invoice bills for (e.g. PREPAID). */
type: string;
issuedAt: string | null;
dueAt: string;
createdAt: string;
company?: InvoiceCompany;
companyProfile?: InvoiceCompanyProfile;
}
export interface InvoiceLine {
id: string;
chargeType: string;
description?: string | null;
quantity: number;
unitRate: number;
amount: number;
currency: string;
}
export interface PortalInvoiceDetail extends PortalInvoice {
lines: InvoiceLine[];
}
export interface PayInvoicePayload { export interface PayInvoicePayload {
method?: string; method?: string;

View File

@@ -524,14 +524,57 @@ export interface ClearanceView {
allApproved: boolean; allApproved: boolean;
} }
export interface IInvoice extends BaseEntity { /** Company an invoice is billed to (minimal projection). */
bookingId: string; export interface IInvoiceCompany {
invoiceNumber: string; id: string;
name: string;
}
/** Company profile (importer/exporter/forwarder/…) an invoice is billed to. */
export interface IInvoiceCompanyProfile {
id: string;
type: string;
reference: string | null;
}
/** A single billed line on an invoice. */
export interface IInvoiceLine extends BaseEntity {
invoiceId: string;
chargeType: string;
description?: string | null;
/** Units billed (container count, wagon count, tons, …); defaults to 1. */
quantity: number;
/** Price per unit; `amount` is normally `quantity * unitRate`. */
unitRate: number;
amount: number; amount: number;
currency: string; currency: string;
status: PaymentStatus; metadata?: Record<string, unknown> | null;
issuedAt: string; }
export interface IInvoice extends BaseEntity {
invoiceNumber: string;
/** Customer (company) the invoice is billed to. */
companyId: string;
company?: IInvoiceCompany;
/** Specific company profile billed. */
companyProfileId: string;
companyProfile?: IInvoiceCompanyProfile;
totalAmount: number;
currency: string;
status: InvoiceStatus;
/** Originating subsystem: booking / warehouse / demurrage. */
source: InvoiceSource;
/** Identifier of the source record (e.g. booking id). */
sourceId: string;
/** What the invoice bills for (e.g. PREPAID). */
type: string;
/** Set when issued; null while DRAFT. */
issuedAt?: string | null;
/** Gateway payment that settled the invoice, once paid. */
paymentId?: string | null;
dueAt: string; dueAt: string;
/** Present on invoice-detail reads. */
lines?: IInvoiceLine[];
} }
// ── Reference Data (booking form catalog) ────────────────────────────────────── // ── Reference Data (booking form catalog) ──────────────────────────────────────