From f4918b8a7919814fec75067e79efdc9c47b3b65f Mon Sep 17 00:00:00 2001 From: barsa Date: Tue, 24 Feb 2026 14:54:38 +0900 Subject: [PATCH] refactor: update WHMCS phone country code handling and schema validation - Modify the phoneCountryCode assignment in the WHMCS mapper to ensure it is always a string when present. - Change the phonecc type in the WHMCS raw types schema to use numberLike for improved type safety and validation consistency. --- packages/domain/customer/providers/whmcs/mapper.ts | 2 +- packages/domain/customer/providers/whmcs/raw.types.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/domain/customer/providers/whmcs/mapper.ts b/packages/domain/customer/providers/whmcs/mapper.ts index 2fef2657..9a01d49e 100644 --- a/packages/domain/customer/providers/whmcs/mapper.ts +++ b/packages/domain/customer/providers/whmcs/mapper.ts @@ -56,7 +56,7 @@ function normalizeAddress(client: WhmcsRawClient): Address | undefined { country: client.country ?? null, countryCode: client.countrycode ?? null, phoneNumber: client.phonenumberformatted ?? client.phonenumber ?? null, - phoneCountryCode: client.phonecc ?? null, + phoneCountryCode: client.phonecc == null ? null : String(client.phonecc), }); const hasValues = Object.values(address).some(v => v !== undefined && v !== null && v !== ""); diff --git a/packages/domain/customer/providers/whmcs/raw.types.ts b/packages/domain/customer/providers/whmcs/raw.types.ts index edb7c334..3b91dd6a 100644 --- a/packages/domain/customer/providers/whmcs/raw.types.ts +++ b/packages/domain/customer/providers/whmcs/raw.types.ts @@ -119,7 +119,7 @@ export const whmcsClientSchema = z postcode: z.string().optional(), country: z.string().optional(), countrycode: z.string().optional(), - phonecc: z.string().optional(), + phonecc: numberLike.optional(), phonenumber: z.string().optional(), phonenumberformatted: z.string().optional(), telephoneNumber: z.string().optional(),