107 lines
2.8 KiB
TypeScript
107 lines
2.8 KiB
TypeScript
|
|
/**
|
||
|
|
* Orders Domain - Contract
|
||
|
|
*
|
||
|
|
* Normalized order types used across the portal.
|
||
|
|
* Represents orders from fulfillment, Salesforce, and WHMCS contexts.
|
||
|
|
*/
|
||
|
|
|
||
|
|
import type { IsoDateTimeString } from "../common/types";
|
||
|
|
|
||
|
|
// ============================================================================
|
||
|
|
// Fulfillment Order Types
|
||
|
|
// ============================================================================
|
||
|
|
|
||
|
|
export interface FulfillmentOrderProduct {
|
||
|
|
id?: string;
|
||
|
|
sku?: string;
|
||
|
|
name?: string;
|
||
|
|
itemClass?: string;
|
||
|
|
whmcsProductId?: string;
|
||
|
|
billingCycle?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface FulfillmentOrderItem {
|
||
|
|
id: string;
|
||
|
|
orderId: string;
|
||
|
|
quantity: number;
|
||
|
|
product: FulfillmentOrderProduct | null;
|
||
|
|
}
|
||
|
|
|
||
|
|
export interface FulfillmentOrderDetails {
|
||
|
|
id: string;
|
||
|
|
orderNumber?: string;
|
||
|
|
orderType?: string;
|
||
|
|
items: FulfillmentOrderItem[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ============================================================================
|
||
|
|
// Order Item Summary (for listing orders)
|
||
|
|
// ============================================================================
|
||
|
|
|
||
|
|
export interface OrderItemSummary {
|
||
|
|
productName?: string;
|
||
|
|
sku?: string;
|
||
|
|
status?: string;
|
||
|
|
billingCycle?: string;
|
||
|
|
}
|
||
|
|
|
||
|
|
// ============================================================================
|
||
|
|
// Detailed Order Item (for order details)
|
||
|
|
// ============================================================================
|
||
|
|
|
||
|
|
export interface OrderItemDetails {
|
||
|
|
id: string;
|
||
|
|
orderId: string;
|
||
|
|
quantity: number;
|
||
|
|
unitPrice?: number;
|
||
|
|
totalPrice?: number;
|
||
|
|
billingCycle?: string;
|
||
|
|
product?: {
|
||
|
|
id?: string;
|
||
|
|
name?: string;
|
||
|
|
sku?: string;
|
||
|
|
itemClass?: string;
|
||
|
|
whmcsProductId?: string;
|
||
|
|
internetOfferingType?: string;
|
||
|
|
internetPlanTier?: string;
|
||
|
|
vpnRegion?: string;
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
// ============================================================================
|
||
|
|
// Order Summary (for listing orders)
|
||
|
|
// ============================================================================
|
||
|
|
|
||
|
|
export type OrderStatus = string;
|
||
|
|
export type OrderType = string;
|
||
|
|
|
||
|
|
export interface OrderSummary {
|
||
|
|
id: string;
|
||
|
|
orderNumber: string;
|
||
|
|
status: OrderStatus;
|
||
|
|
orderType?: OrderType;
|
||
|
|
effectiveDate: IsoDateTimeString;
|
||
|
|
totalAmount?: number;
|
||
|
|
createdDate: IsoDateTimeString;
|
||
|
|
lastModifiedDate: IsoDateTimeString;
|
||
|
|
whmcsOrderId?: string;
|
||
|
|
itemsSummary: OrderItemSummary[];
|
||
|
|
}
|
||
|
|
|
||
|
|
// ============================================================================
|
||
|
|
// Detailed Order (for order details view)
|
||
|
|
// ============================================================================
|
||
|
|
|
||
|
|
export interface OrderDetails extends OrderSummary {
|
||
|
|
accountId?: string;
|
||
|
|
accountName?: string;
|
||
|
|
pricebook2Id?: string;
|
||
|
|
activationType?: string;
|
||
|
|
activationStatus?: string;
|
||
|
|
activationScheduledAt?: IsoDateTimeString;
|
||
|
|
activationErrorCode?: string;
|
||
|
|
activationErrorMessage?: string;
|
||
|
|
activatedDate?: IsoDateTimeString;
|
||
|
|
items: OrderItemDetails[];
|
||
|
|
}
|