mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 18:42:49 +00:00
fix: types
This commit is contained in:
@@ -6,53 +6,13 @@ import type { InitiateResponse } from "./payments.service";
|
||||
|
||||
const B = URL_CONSTANTS.BILLING;
|
||||
|
||||
export interface InvoiceCompany {
|
||||
id: string;
|
||||
name: string;
|
||||
}
|
||||
/** A customer-facing invoice row, as returned by `GET /billing/my-invoices`. */
|
||||
export type PortalInvoice = Freight.IInvoice;
|
||||
|
||||
export interface InvoiceCompanyProfile {
|
||||
id: string;
|
||||
type: string;
|
||||
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[];
|
||||
}
|
||||
/** An invoice plus its line items, as returned by `GET /billing/my-invoices/:id`. */
|
||||
export type PortalInvoiceDetail = Freight.IInvoice & {
|
||||
lines: Freight.IInvoiceLine[];
|
||||
};
|
||||
|
||||
export interface PayInvoicePayload {
|
||||
method?: string;
|
||||
|
||||
@@ -524,14 +524,57 @@ export interface ClearanceView {
|
||||
allApproved: boolean;
|
||||
}
|
||||
|
||||
export interface IInvoice extends BaseEntity {
|
||||
bookingId: string;
|
||||
invoiceNumber: string;
|
||||
/** Company an invoice is billed to (minimal projection). */
|
||||
export interface IInvoiceCompany {
|
||||
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;
|
||||
currency: string;
|
||||
status: PaymentStatus;
|
||||
issuedAt: string;
|
||||
metadata?: Record<string, unknown> | null;
|
||||
}
|
||||
|
||||
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;
|
||||
/** Present on invoice-detail reads. */
|
||||
lines?: IInvoiceLine[];
|
||||
}
|
||||
|
||||
// ── Reference Data (booking form catalog) ──────────────────────────────────────
|
||||
|
||||
Reference in New Issue
Block a user