Skip to content

Commit

Permalink
feat(APIM-609): companies house - extend returned fields
Browse files Browse the repository at this point in the history
  • Loading branch information
ttbarnes committed Dec 6, 2024
1 parent b0e349c commit 3a3dc97
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,16 @@ export type GetCompanyCompaniesHouseResponse = {
has_insolvency_history: boolean;
jurisdiction: string;
registered_office_address: {
organisation_name?: string;
address_line_1: string;
address_line_2?: string;
address_line_3?: string;
care_of?: string;
country: string;
locality: string;
organisation_name?: string;
postal_code: string;
country: string;
premises?: string;
region: string;
};
registered_office_is_in_dispute: boolean;
sic_codes: string[];
Expand Down
26 changes: 24 additions & 2 deletions src/modules/companies/companies.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,38 @@ export class CompaniesService {
const address = company.registered_office_address;

return {
accounts: {
accountingReferenceDate: company.accounts.accounting_reference_date,
lastAccounts: {
madeUpTo: company.accounts.last_accounts?.made_up_to,
periodEndOn: company.accounts.last_accounts?.period_end_on,
periodStartOn: company.accounts.last_accounts?.period_start_on,
type: company.accounts.last_accounts?.period_start_on,
},
nextAccounts: {
dueOn: company.accounts.next_accounts.due_on,
overdue: company.accounts.next_accounts.overdue,
periodEndOn: company.accounts.next_accounts.period_end_on,
periodStartOn: company.accounts.next_accounts.period_start_on,
},
nextDue: company.accounts.next_due,
nextMadeUpTo: company.accounts.next_made_up_to,
overdue: company.accounts.overdue,
},
companiesHouseRegistrationNumber: company.company_number,
companyName: company.company_name,
dateOfCreation: company.date_of_creation,
registeredAddress: {
organisationName: address?.organisation_name,
addressLine1: address?.address_line_1,
addressLine2: address?.address_line_2,
addressLine3: address?.address_line_3,
careOf: address?.care_of,
country: address?.country,
locality: address?.locality,
organisationName: address?.organisation_name,
postalCode: address?.postal_code,
country: address?.country,
premises: address?.premises,
region: address?.region,
},
industries: this.mapSicCodes(company.sic_codes, industryClasses),
};
Expand Down
53 changes: 44 additions & 9 deletions src/modules/companies/dto/get-company-response.dto.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,50 @@
class AccountsReferenceDate {
day: string;
month: string;
}

class AccountsLastAccounts {
madeUpTo: string;
periodEndOn: string;
periodStartOn: string;
type: string;
}

class AccountsNextAccounts {
dueOn: string;
overdue: boolean;
periodEndOn: string;
periodStartOn: string;
}

class Accounts {
accountingReferenceDate?: AccountsReferenceDate;
lastAccounts?: AccountsLastAccounts;
nextAccounts?: AccountsNextAccounts;
nextDue?: string;
nextMadeUpTo?: string;
overdue?: boolean;
}

class RegisteredAddress {
addressLine1?: string;
addressLine2?: string;
addressLine3?: string;
careOf?: string;
country?: string;
locality?: string;
organisationName?: string;
postalCode?: string;
premises?: string;
region?: string;
}

export class GetCompanyResponse {
accounts: Accounts;
companiesHouseRegistrationNumber: string;
companyName: string;
registeredAddress: {
organisationName?: string;
addressLine1?: string;
addressLine2?: string;
addressLine3?: string;
locality?: string;
postalCode?: string;
country?: string;
};
dateOfCreation: string;
registeredAddress: RegisteredAddress;
industries: Industry[];
}

Expand Down

0 comments on commit 3a3dc97

Please sign in to comment.