diff --git a/apps/bff/src/integrations/whmcs/services/whmcs-client.service.ts b/apps/bff/src/integrations/whmcs/services/whmcs-client.service.ts index 74b5fe80..072f5182 100644 --- a/apps/bff/src/integrations/whmcs/services/whmcs-client.service.ts +++ b/apps/bff/src/integrations/whmcs/services/whmcs-client.service.ts @@ -10,10 +10,7 @@ import type { WhmcsAddClientResponse, WhmcsValidateLoginResponse, } from "@customer-portal/domain/customer"; -import { - Providers as CustomerProviders, - type WhmcsClient, -} from "@customer-portal/domain/customer"; +import { Providers as CustomerProviders, type WhmcsClient } from "@customer-portal/domain/customer"; @Injectable() export class WhmcsClientService { diff --git a/apps/bff/src/integrations/whmcs/services/whmcs-subscription.service.ts b/apps/bff/src/integrations/whmcs/services/whmcs-subscription.service.ts index 06d660b0..4f69e441 100644 --- a/apps/bff/src/integrations/whmcs/services/whmcs-subscription.service.ts +++ b/apps/bff/src/integrations/whmcs/services/whmcs-subscription.service.ts @@ -85,7 +85,9 @@ export class WhmcsSubscriptionService { // Cache the result await this.cacheService.setSubscriptionsList(userId, result); - this.logger.log(`Fetched ${result.subscriptions.length} subscriptions for client ${clientId}`); + this.logger.log( + `Fetched ${result.subscriptions.length} subscriptions for client ${clientId}` + ); // Apply status filter if needed if (filters.status) { diff --git a/apps/bff/src/integrations/whmcs/whmcs.service.ts b/apps/bff/src/integrations/whmcs/whmcs.service.ts index c7126b01..30cb89b6 100644 --- a/apps/bff/src/integrations/whmcs/whmcs.service.ts +++ b/apps/bff/src/integrations/whmcs/whmcs.service.ts @@ -2,7 +2,12 @@ import { Injectable, Inject } from "@nestjs/common"; import type { Invoice, InvoiceList } from "@customer-portal/domain/billing"; import type { Subscription, SubscriptionList } from "@customer-portal/domain/subscriptions"; import type { PaymentMethodList, PaymentGatewayList } from "@customer-portal/domain/payments"; -import { Providers as CustomerProviders, type Address, type WhmcsClient } from "@customer-portal/domain/customer"; +import { + Providers as CustomerProviders, + addressSchema, + type Address, + type WhmcsClient, +} from "@customer-portal/domain/customer"; import { WhmcsConnectionOrchestratorService } from "./connection/services/whmcs-connection-orchestrator.service"; import { WhmcsInvoiceService, InvoiceFilters } from "./services/whmcs-invoice.service"; import { @@ -150,7 +155,7 @@ export class WhmcsService { */ async getClientAddress(clientId: number): Promise
{ const customer = await this.clientService.getClientDetails(clientId); - return (customer.address ?? {}) as Address; + return addressSchema.parse(customer.address ?? {}); } async updateClientAddress(clientId: number, address: Partial
): Promise { diff --git a/apps/bff/src/modules/orders/services/order-builder.service.ts b/apps/bff/src/modules/orders/services/order-builder.service.ts index 04c7e60c..c7a5c8e4 100644 --- a/apps/bff/src/modules/orders/services/order-builder.service.ts +++ b/apps/bff/src/modules/orders/services/order-builder.service.ts @@ -118,15 +118,13 @@ export class OrderBuilder { | undefined; const addressChanged = !!orderAddress; const addressToUse = orderAddress || address; - const address1 = typeof addressToUse?.address1 === "string" ? addressToUse.address1 : ""; const address2 = typeof addressToUse?.address2 === "string" ? addressToUse.address2 : ""; const fullStreet = [address1, address2].filter(Boolean).join(", "); orderFields.BillingStreet = fullStreet; orderFields.BillingCity = typeof addressToUse?.city === "string" ? addressToUse.city : ""; - orderFields.BillingState = - typeof addressToUse?.state === "string" ? addressToUse.state : ""; + orderFields.BillingState = typeof addressToUse?.state === "string" ? addressToUse.state : ""; orderFields.BillingPostalCode = typeof addressToUse?.postcode === "string" ? addressToUse.postcode : ""; orderFields.BillingCountry = diff --git a/apps/portal/src/features/account/views/ProfileContainer.tsx b/apps/portal/src/features/account/views/ProfileContainer.tsx index f2f893cb..389a87ae 100644 --- a/apps/portal/src/features/account/views/ProfileContainer.tsx +++ b/apps/portal/src/features/account/views/ProfileContainer.tsx @@ -178,9 +178,9 @@ export default function ProfileContainer() {

Personal Information

{!editingProfile && ( -