2025-10-03 14:26:55 +09:00
|
|
|
/**
|
|
|
|
|
* Orders Domain - Contract
|
|
|
|
|
*
|
2025-10-08 10:33:33 +09:00
|
|
|
* Business types and provider-specific mapping types.
|
|
|
|
|
* Validated types are derived from schemas (see schema.ts).
|
2025-10-03 14:26:55 +09:00
|
|
|
*/
|
|
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
import type { SalesforceProductFieldMap } from "../catalog/contract";
|
|
|
|
|
import type { SalesforceAccountFieldMap } from "../customer/contract";
|
|
|
|
|
import type { UserIdMapping } from "../mappings/contract";
|
2025-10-03 14:26:55 +09:00
|
|
|
|
|
|
|
|
// ============================================================================
|
2025-10-08 10:33:33 +09:00
|
|
|
// Business Types (used internally, not validated at API boundary)
|
2025-10-03 14:26:55 +09:00
|
|
|
// ============================================================================
|
|
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
/**
|
|
|
|
|
* Order creation type used for order creation flows
|
|
|
|
|
*/
|
|
|
|
|
export type OrderCreationType = "Internet" | "SIM" | "VPN" | "Other";
|
2025-10-03 14:26:55 +09:00
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
/**
|
|
|
|
|
* Order status (string literal for flexibility)
|
|
|
|
|
*/
|
|
|
|
|
export type OrderStatus = string;
|
2025-10-03 14:26:55 +09:00
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
/**
|
|
|
|
|
* Order type (string literal for flexibility)
|
|
|
|
|
*/
|
|
|
|
|
export type OrderType = string;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* User mapping for order creation (subset of UserIdMapping)
|
|
|
|
|
*/
|
|
|
|
|
export type UserMapping = Pick<UserIdMapping, "userId" | "whmcsClientId" | "sfAccountId">;
|
2025-10-03 14:26:55 +09:00
|
|
|
|
|
|
|
|
// ============================================================================
|
2025-10-08 10:33:33 +09:00
|
|
|
// Salesforce Field Mapping (Provider-Specific, Not Validated)
|
2025-10-03 14:26:55 +09:00
|
|
|
// ============================================================================
|
|
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
export interface SalesforceOrderMnpFieldMap {
|
|
|
|
|
application: string;
|
|
|
|
|
reservationNumber: string;
|
|
|
|
|
expiryDate: string;
|
|
|
|
|
phoneNumber: string;
|
|
|
|
|
mvnoAccountNumber: string;
|
|
|
|
|
portingDateOfBirth: string;
|
|
|
|
|
portingFirstName: string;
|
|
|
|
|
portingLastName: string;
|
|
|
|
|
portingFirstNameKatakana: string;
|
|
|
|
|
portingLastNameKatakana: string;
|
|
|
|
|
portingGender: string;
|
2025-10-03 14:26:55 +09:00
|
|
|
}
|
|
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
export interface SalesforceOrderBillingFieldMap {
|
|
|
|
|
street: string;
|
|
|
|
|
city: string;
|
|
|
|
|
state: string;
|
|
|
|
|
postalCode: string;
|
|
|
|
|
country: string;
|
2025-10-03 14:26:55 +09:00
|
|
|
}
|
|
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
export interface SalesforceOrderFieldMap {
|
|
|
|
|
orderType: string;
|
|
|
|
|
activationType: string;
|
|
|
|
|
activationScheduledAt: string;
|
|
|
|
|
activationStatus: string;
|
|
|
|
|
internetPlanTier: string;
|
|
|
|
|
installationType: string;
|
|
|
|
|
weekendInstall: string;
|
|
|
|
|
accessMode: string;
|
|
|
|
|
hikariDenwa: string;
|
|
|
|
|
vpnRegion: string;
|
|
|
|
|
simType: string;
|
|
|
|
|
eid: string;
|
|
|
|
|
simVoiceMail: string;
|
|
|
|
|
simCallWaiting: string;
|
|
|
|
|
mnp: SalesforceOrderMnpFieldMap;
|
|
|
|
|
whmcsOrderId: string;
|
|
|
|
|
lastErrorCode?: string;
|
|
|
|
|
lastErrorMessage?: string;
|
|
|
|
|
lastAttemptAt?: string;
|
|
|
|
|
addressChanged: string;
|
|
|
|
|
billing: SalesforceOrderBillingFieldMap;
|
|
|
|
|
}
|
2025-10-03 14:26:55 +09:00
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
export interface SalesforceOrderItemFieldMap {
|
|
|
|
|
billingCycle: string;
|
|
|
|
|
whmcsServiceId: string;
|
|
|
|
|
}
|
2025-10-03 14:26:55 +09:00
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
export interface SalesforceFieldMap {
|
|
|
|
|
account: SalesforceAccountFieldMap;
|
|
|
|
|
product: SalesforceProductFieldMap;
|
|
|
|
|
order: SalesforceOrderFieldMap;
|
|
|
|
|
orderItem: SalesforceOrderItemFieldMap;
|
2025-10-03 14:26:55 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ============================================================================
|
2025-10-08 10:33:33 +09:00
|
|
|
// Re-export Types from Schema (Schema-First Approach)
|
2025-10-03 14:26:55 +09:00
|
|
|
// ============================================================================
|
|
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
export type {
|
|
|
|
|
// Fulfillment order types
|
|
|
|
|
FulfillmentOrderProduct,
|
|
|
|
|
FulfillmentOrderItem,
|
|
|
|
|
FulfillmentOrderDetails,
|
|
|
|
|
// Order item types
|
|
|
|
|
OrderItemSummary,
|
|
|
|
|
OrderItemDetails,
|
|
|
|
|
// Order types
|
|
|
|
|
OrderSummary,
|
|
|
|
|
OrderDetails,
|
|
|
|
|
// Query and creation types
|
|
|
|
|
OrderQueryParams,
|
|
|
|
|
OrderConfigurationsAddress,
|
|
|
|
|
OrderConfigurations,
|
|
|
|
|
CreateOrderRequest,
|
|
|
|
|
OrderBusinessValidation,
|
|
|
|
|
SfOrderIdParam,
|
|
|
|
|
} from './schema';
|