2025-10-08 10:33:33 +09:00
|
|
|
/**
|
|
|
|
|
* Billing Domain - Constants
|
2025-11-17 10:31:33 +09:00
|
|
|
*
|
2025-10-08 10:33:33 +09:00
|
|
|
* Domain constants for billing validation and business rules.
|
|
|
|
|
*/
|
|
|
|
|
|
2025-12-26 14:53:03 +09:00
|
|
|
import type { Currency } from "./schema.js";
|
2025-11-17 10:31:33 +09:00
|
|
|
|
|
|
|
|
// ============================================================================
|
|
|
|
|
// Currency Defaults
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Single fallback currency for both BFF and Portal when WHMCS currency data
|
|
|
|
|
* is unavailable. This ensures a single source of truth for default currency
|
|
|
|
|
* formatting behaviour.
|
|
|
|
|
*/
|
2025-12-26 14:53:03 +09:00
|
|
|
export const FALLBACK_CURRENCY: Currency = {
|
2025-11-17 10:31:33 +09:00
|
|
|
id: 1,
|
|
|
|
|
code: "JPY",
|
|
|
|
|
prefix: "¥",
|
|
|
|
|
suffix: "",
|
|
|
|
|
format: "1",
|
|
|
|
|
rate: "1.00000",
|
|
|
|
|
};
|
|
|
|
|
|
2025-10-08 10:33:33 +09:00
|
|
|
// ============================================================================
|
|
|
|
|
// Invoice Validation Constants
|
|
|
|
|
// ============================================================================
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Pagination limits for invoice queries
|
|
|
|
|
*/
|
|
|
|
|
export const INVOICE_PAGINATION = {
|
|
|
|
|
MIN_LIMIT: 1,
|
|
|
|
|
MAX_LIMIT: 100,
|
|
|
|
|
DEFAULT_LIMIT: 10,
|
|
|
|
|
DEFAULT_PAGE: 1,
|
|
|
|
|
} as const;
|
|
|
|
|
|
|
|
|
|
/**
|
2026-02-03 11:48:49 +09:00
|
|
|
* Valid statuses for WHMCS GetInvoices API filtering.
|
|
|
|
|
*
|
|
|
|
|
* WHMCS only supports these 5 statuses for list queries.
|
|
|
|
|
* Draft, Pending, Refunded exist on invoices but cannot be used as query filters.
|
|
|
|
|
*
|
|
|
|
|
* @see INVOICE_STATUS in contract.ts for all possible invoice statuses
|
2025-10-08 10:33:33 +09:00
|
|
|
*/
|
2026-02-03 11:48:49 +09:00
|
|
|
export const VALID_INVOICE_QUERY_STATUSES = [
|
2025-10-08 10:33:33 +09:00
|
|
|
"Paid",
|
|
|
|
|
"Unpaid",
|
|
|
|
|
"Cancelled",
|
|
|
|
|
"Overdue",
|
|
|
|
|
"Collections",
|
|
|
|
|
] as const;
|