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.
This commit is contained in:
barsa 2026-02-24 14:54:38 +09:00
parent 1156398caa
commit f4918b8a79
2 changed files with 2 additions and 2 deletions

View File

@ -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 !== "");

View File

@ -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(),