Skip to content

Commit 42d3c9e

Browse files
authored
Merge pull request #754 from companieshouse/LP-537-support-general-partner-person-data
Lp 537 support general partner person data
2 parents e764219 + b950f74 commit 42d3c9e

File tree

4 files changed

+555
-401
lines changed

4 files changed

+555
-401
lines changed

src/services/limited-partnerships/service.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { HttpResponse, IHttpClient } from "../../http";
2-
import { LimitedPartnership, LimitedPartnershipResourceCreated, LimitedPartnershipIncorporation } from "./types";
2+
import { LimitedPartnership, LimitedPartnershipResourceCreated, LimitedPartnershipIncorporation, GeneralPartner } from "./types";
33
import Resource, { ApiErrorResponse } from "../resource";
44

55
export default class LimitedPartnershipsService {
@@ -74,4 +74,20 @@ export default class LimitedPartnershipsService {
7474
resource: { ...response.body }
7575
};
7676
}
77+
78+
/*
79+
* Calls to general partner endpoints
80+
*/
81+
82+
public async postGeneralPartner (
83+
transactionId: string,
84+
body: GeneralPartner): Promise<Resource<LimitedPartnershipResourceCreated> | ApiErrorResponse> {
85+
const URL = `/transactions/${transactionId}/limited-partnership/general-partner`;
86+
const response: HttpResponse = await this.client.httpPost(URL, body);
87+
88+
return {
89+
httpStatusCode: response.status,
90+
resource: { ...response.body }
91+
};
92+
}
7793
}

src/services/limited-partnerships/types.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,31 @@ export interface LimitedPartnership {
1818
};
1919
}
2020

21+
export interface GeneralPartner {
22+
data?: {
23+
country?: string,
24+
date_effective_from?: string,
25+
date_of_birth?: string,
26+
etag?: string,
27+
forename?: string,
28+
former_names?: string,
29+
governing_law?: string,
30+
kind?: string,
31+
legal_entity_register_name?: string,
32+
legal_entity_registration_location?: string,
33+
legal_form?: string,
34+
nationality1?: string,
35+
nationality2?: string,
36+
not_disqualified_statement_checked?: boolean,
37+
principal_office_address?: Address,
38+
registered_company_number?: string,
39+
resignation_date?: string,
40+
service_address?: Address,
41+
surname?: string,
42+
usual_residential_address?: Address
43+
}
44+
}
45+
2146
/**
2247
* The data structure returned by the API when a new Limited Partnership resource has
2348
* successfully been created.

test/services/limited-partnerships/limited.partnerships.mock.ts

Lines changed: 57 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ import {
66
NameEndingType,
77
PartnershipType,
88
Jurisdiction,
9-
Term
9+
Term,
10+
GeneralPartner
1011
} from "../../../src/services/limited-partnerships";
1112

1213
export const requestClient = new RequestClient({
@@ -43,6 +44,55 @@ export const LIMITED_PARTNERSHIP_OBJECT_MOCK: LimitedPartnership = {
4344
}
4445
};
4546

47+
export const GENERAL_PARTNER_OBJECT_MOCK: GeneralPartner = {
48+
data: {
49+
country: "England",
50+
date_effective_from: "2005-02-04",
51+
date_of_birth: "2000-05-01",
52+
etag: "",
53+
forename: "John",
54+
former_names: "Mary",
55+
governing_law: "British Government",
56+
kind: "",
57+
legal_entity_register_name: "Entity Name",
58+
legal_entity_registration_location: "UK",
59+
legal_form: "",
60+
nationality1: "English",
61+
nationality2: "French",
62+
not_disqualified_statement_checked: true,
63+
principal_office_address: {
64+
premises: "22",
65+
address_line_1: "Some Street",
66+
address_line_2: "Some Line 2",
67+
locality: "Some Locality",
68+
region: "Some Region",
69+
country: "Some Country",
70+
postal_code: "SC12 1WE"
71+
},
72+
registered_company_number: "223456",
73+
resignation_date: "",
74+
service_address: {
75+
premises: "10",
76+
address_line_1: "This Street",
77+
address_line_2: "This Line 2",
78+
locality: "This Locality",
79+
region: "This Region",
80+
country: "This Country",
81+
postal_code: "SC45 1XF"
82+
},
83+
surname: "Doe",
84+
usual_residential_address: {
85+
premises: "25",
86+
address_line_1: "That Street",
87+
address_line_2: "That Line 2",
88+
locality: "That Locality",
89+
region: "That Region",
90+
country: "That Country",
91+
postal_code: "SC15 1N2"
92+
}
93+
}
94+
}
95+
4696
export const LIMITED_PARTNERSHIP_INCORPORATION_OBJECT_MOCK: LimitedPartnershipIncorporation = {
4797
etag: "",
4898
kind: ""
@@ -99,3 +149,9 @@ export const mockGetLimitedPartnershipIncorporationResponse = {
99149
export const mockGetLimitedPartnershipIncorporationResponseWithSub = {
100150
200: { status: 200, body: LIMITED_PARTNERSHIP_INCORPORATION_OBJECT_MOCK_WITH_SUB }
101151
}
152+
153+
export const mockPostGeneralPartnerResponse = {
154+
201: { status: 201, body: mockLimitedPartnershipCreatedResource },
155+
400: { status: 400, body: { error: BAD_REQUEST } },
156+
401: { status: 401, body: { error: UNAUTHORISED } }
157+
};

0 commit comments

Comments
 (0)