Skip to content

Commit

Permalink
Merge pull request #754 from companieshouse/LP-537-support-general-pa…
Browse files Browse the repository at this point in the history
…rtner-person-data

Lp 537 support general partner person data
  • Loading branch information
vschot authored Feb 27, 2025
2 parents e764219 + b950f74 commit 42d3c9e
Show file tree
Hide file tree
Showing 4 changed files with 555 additions and 401 deletions.
18 changes: 17 additions & 1 deletion src/services/limited-partnerships/service.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HttpResponse, IHttpClient } from "../../http";
import { LimitedPartnership, LimitedPartnershipResourceCreated, LimitedPartnershipIncorporation } from "./types";
import { LimitedPartnership, LimitedPartnershipResourceCreated, LimitedPartnershipIncorporation, GeneralPartner } from "./types";
import Resource, { ApiErrorResponse } from "../resource";

export default class LimitedPartnershipsService {
Expand Down Expand Up @@ -74,4 +74,20 @@ export default class LimitedPartnershipsService {
resource: { ...response.body }
};
}

/*
* Calls to general partner endpoints
*/

public async postGeneralPartner (
transactionId: string,
body: GeneralPartner): Promise<Resource<LimitedPartnershipResourceCreated> | ApiErrorResponse> {
const URL = `/transactions/${transactionId}/limited-partnership/general-partner`;
const response: HttpResponse = await this.client.httpPost(URL, body);

return {
httpStatusCode: response.status,
resource: { ...response.body }
};
}
}
25 changes: 25 additions & 0 deletions src/services/limited-partnerships/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,31 @@ export interface LimitedPartnership {
};
}

export interface GeneralPartner {
data?: {
country?: string,
date_effective_from?: string,
date_of_birth?: string,
etag?: string,
forename?: string,
former_names?: string,
governing_law?: string,
kind?: string,
legal_entity_register_name?: string,
legal_entity_registration_location?: string,
legal_form?: string,
nationality1?: string,
nationality2?: string,
not_disqualified_statement_checked?: boolean,
principal_office_address?: Address,
registered_company_number?: string,
resignation_date?: string,
service_address?: Address,
surname?: string,
usual_residential_address?: Address
}
}

/**
* The data structure returned by the API when a new Limited Partnership resource has
* successfully been created.
Expand Down
58 changes: 57 additions & 1 deletion test/services/limited-partnerships/limited.partnerships.mock.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import {
NameEndingType,
PartnershipType,
Jurisdiction,
Term
Term,
GeneralPartner
} from "../../../src/services/limited-partnerships";

export const requestClient = new RequestClient({
Expand Down Expand Up @@ -43,6 +44,55 @@ export const LIMITED_PARTNERSHIP_OBJECT_MOCK: LimitedPartnership = {
}
};

export const GENERAL_PARTNER_OBJECT_MOCK: GeneralPartner = {
data: {
country: "England",
date_effective_from: "2005-02-04",
date_of_birth: "2000-05-01",
etag: "",
forename: "John",
former_names: "Mary",
governing_law: "British Government",
kind: "",
legal_entity_register_name: "Entity Name",
legal_entity_registration_location: "UK",
legal_form: "",
nationality1: "English",
nationality2: "French",
not_disqualified_statement_checked: true,
principal_office_address: {
premises: "22",
address_line_1: "Some Street",
address_line_2: "Some Line 2",
locality: "Some Locality",
region: "Some Region",
country: "Some Country",
postal_code: "SC12 1WE"
},
registered_company_number: "223456",
resignation_date: "",
service_address: {
premises: "10",
address_line_1: "This Street",
address_line_2: "This Line 2",
locality: "This Locality",
region: "This Region",
country: "This Country",
postal_code: "SC45 1XF"
},
surname: "Doe",
usual_residential_address: {
premises: "25",
address_line_1: "That Street",
address_line_2: "That Line 2",
locality: "That Locality",
region: "That Region",
country: "That Country",
postal_code: "SC15 1N2"
}
}
}

export const LIMITED_PARTNERSHIP_INCORPORATION_OBJECT_MOCK: LimitedPartnershipIncorporation = {
etag: "",
kind: ""
Expand Down Expand Up @@ -99,3 +149,9 @@ export const mockGetLimitedPartnershipIncorporationResponse = {
export const mockGetLimitedPartnershipIncorporationResponseWithSub = {
200: { status: 200, body: LIMITED_PARTNERSHIP_INCORPORATION_OBJECT_MOCK_WITH_SUB }
}

export const mockPostGeneralPartnerResponse = {
201: { status: 201, body: mockLimitedPartnershipCreatedResource },
400: { status: 400, body: { error: BAD_REQUEST } },
401: { status: 401, body: { error: UNAUTHORISED } }
};
Loading

0 comments on commit 42d3c9e

Please sign in to comment.