Skip to content

Commit 54e9bb8

Browse files
authored
Merge pull request #286 from companieshouse/NCS-761-add-new-params-to-task-endpoints
NCS-761 Add new parameters to the task endpoints
2 parents f5ec7dc + b24e214 commit 54e9bb8

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/services/confirmation-statement/service.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ export default class {
135135
return resource;
136136
}
137137

138-
public async getStatementOfCapital (companyNumber: string): Promise<Resource<StatementOfCapital> | ApiErrorResponse> {
139-
const url: string = `${this.getConfirmationStatementUrl(companyNumber)}/statement-of-capital`;
138+
public async getStatementOfCapital (transactionId: string, confirmationStatementId: string): Promise<Resource<StatementOfCapital> | ApiErrorResponse> {
139+
const url: string = `${this.getConfirmationStatementUrlIncTransactionId(transactionId)}/${confirmationStatementId}/statement-of-capital`;
140140
const resp: HttpResponse = await this.client.httpGet(url);
141141

142142
if (resp.status >= 400) {
@@ -170,8 +170,8 @@ export default class {
170170
return resource;
171171
}
172172

173-
public async getRegisterLocations (companyNumber: string): Promise<Resource<RegisterLocation[]> | ApiErrorResponse> {
174-
const url = `${this.getConfirmationStatementUrl(companyNumber)}/register-locations`;
173+
public async getRegisterLocations (transactionId: string, confirmationStatementId: string): Promise<Resource<RegisterLocation[]> | ApiErrorResponse> {
174+
const url = `${this.getConfirmationStatementUrlIncTransactionId(transactionId)}/${confirmationStatementId}/register-locations`;
175175
const resp: HttpResponse = await this.client.httpGet(url);
176176

177177
if (resp.status >= 400) {
@@ -185,8 +185,8 @@ export default class {
185185
return resource;
186186
}
187187

188-
public async getPersonsOfSignificantControl (companyNumber: string): Promise<Resource<PersonOfSignificantControl[]> | ApiErrorResponse> {
189-
const url = `${this.getConfirmationStatementUrl(companyNumber)}/persons-of-significant-control`;
188+
public async getPersonsOfSignificantControl (transactionId: string, confirmationStatementId: string): Promise<Resource<PersonOfSignificantControl[]> | ApiErrorResponse> {
189+
const url = `${this.getConfirmationStatementUrlIncTransactionId(transactionId)}/${confirmationStatementId}/persons-of-significant-control`;
190190
const resp: HttpResponse = await this.client.httpGet(url);
191191

192192
if (resp.status >= 400) {

test/services/confirmation-statement/confirmation.statement.spec.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ describe("statement of capital data GET", () => {
218218
it("should return statement of capital object", async () => {
219219
sinon.stub(mockValues.requestClient, "httpGet").resolves(mockValues.mockGetStatementOfCapital[200]);
220220
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
221-
const data: Resource<StatementOfCapital> = await csService.getStatementOfCapital(COMPANY_NUMBER) as Resource<StatementOfCapital>;
221+
const data: Resource<StatementOfCapital> = await csService.getStatementOfCapital(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID) as Resource<StatementOfCapital>;
222222

223223
expect(data.httpStatusCode).to.equal(200);
224224
expect(data.resource.classOfShares).to.equal(mockValues.mockStatementOfCapital.class_of_shares);
@@ -227,7 +227,7 @@ describe("statement of capital data GET", () => {
227227
it("should not return statement of capital object", async () => {
228228
sinon.stub(mockValues.requestClient, "httpGet").resolves(mockValues.mockGetStatementOfCapital[404]);
229229
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
230-
const data: ApiErrorResponse = await csService.getStatementOfCapital(COMPANY_NUMBER);
230+
const data: ApiErrorResponse = await csService.getStatementOfCapital(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID);
231231

232232
expect(data.httpStatusCode).to.equal(404);
233233
expect(data.errors[0]).to.equal("No statement of capital data found");
@@ -267,7 +267,7 @@ describe("persons with significant control GET", () => {
267267
it("should return a list of persons with significant control", async () => {
268268
sinon.stub(mockValues.requestClient, "httpGet").resolves(mockGetPersonsOfSignificantControl[200]);
269269
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
270-
const data: Resource<PersonOfSignificantControl[]> = await csService.getPersonsOfSignificantControl(COMPANY_NUMBER) as Resource<PersonOfSignificantControl[]>;
270+
const data: Resource<PersonOfSignificantControl[]> = await csService.getPersonsOfSignificantControl(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID) as Resource<PersonOfSignificantControl[]>;
271271
expect(data.httpStatusCode).to.equal(200);
272272
expect(data.resource[0].nameElements.surname).to.equal("Smith");
273273
expect(data.resource[0].nameElements.middleName).to.be.undefined;
@@ -282,7 +282,7 @@ describe("persons with significant control GET", () => {
282282
it("should not map missing address or names", async () => {
283283
sinon.stub(mockValues.requestClient, "httpGet").resolves({ status: 200, body: mockValues.mockPscNoNameNoAddress });
284284
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
285-
const data: Resource<PersonOfSignificantControl[]> = await csService.getPersonsOfSignificantControl(COMPANY_NUMBER) as Resource<PersonOfSignificantControl[]>;
285+
const data: Resource<PersonOfSignificantControl[]> = await csService.getPersonsOfSignificantControl(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID) as Resource<PersonOfSignificantControl[]>;
286286
expect(data.httpStatusCode).to.equal(200);
287287
expect(data.resource[0].nameElements).to.be.undefined;
288288
expect(data.resource[0].address).to.be.undefined;
@@ -293,7 +293,7 @@ describe("persons with significant control GET", () => {
293293
it("should return error 500 - Internal server error", async () => {
294294
sinon.stub(mockValues.requestClient, "httpGet").resolves(mockGetPersonsOfSignificantControl[500]);
295295
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
296-
const data: ApiErrorResponse = await csService.getPersonsOfSignificantControl(COMPANY_NUMBER) as ApiErrorResponse;
296+
const data: ApiErrorResponse = await csService.getPersonsOfSignificantControl(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID) as ApiErrorResponse;
297297
expect(data.httpStatusCode).to.equal(500);
298298
expect(data.errors[0]).to.equal("Internal server error");
299299
});
@@ -323,7 +323,7 @@ describe("Register Location GET", () => {
323323
it("should return a list of registers and their locations", async () => {
324324
sinon.stub(mockValues.requestClient, "httpGet").resolves(mockGetRegisterLocations[200]);
325325
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
326-
const data: Resource<RegisterLocation[]> = await csService.getRegisterLocations(COMPANY_NUMBER) as Resource<RegisterLocation[]>;
326+
const data: Resource<RegisterLocation[]> = await csService.getRegisterLocations(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID) as Resource<RegisterLocation[]>;
327327
expect(data.httpStatusCode).to.equal(200);
328328
expect(data.resource[0].registerTypeDesc).to.equal("Reg Type Desc 1");
329329
expect(data.resource[0].sailAddress.addressLine1).to.equal("20 Any road");
@@ -333,7 +333,7 @@ describe("Register Location GET", () => {
333333
it("should return a 500 error - Internal server error", async () => {
334334
sinon.stub(mockValues.requestClient, "httpGet").resolves(mockGetRegisterLocations[500]);
335335
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
336-
const data: ApiErrorResponse = await csService.getRegisterLocations(COMPANY_NUMBER) as ApiErrorResponse;
336+
const data: ApiErrorResponse = await csService.getRegisterLocations(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID) as ApiErrorResponse;
337337
expect(data.httpStatusCode).to.equal(500);
338338
expect(data.errors[0]).to.equal("Internal server error");
339339
});

0 commit comments

Comments
 (0)