Skip to content

Commit 42cd06b

Browse files
authored
Merge pull request #279 from companieshouse/NCS-761-change-shareholder-endpoint
NCS-761 Change shareholder endpoint
2 parents e813875 + 55a77b3 commit 42cd06b

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/services/confirmation-statement/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,8 +200,8 @@ export default class {
200200
return resource;
201201
}
202202

203-
public async getShareholders (companyNumber: string): Promise<Resource<Shareholder[]> | ApiErrorResponse> {
204-
const url = `${this.getConfirmationStatementUrl(companyNumber)}/shareholders`;
203+
public async getShareholders (transactionId: string, confirmationStatementId: string): Promise<Resource<Shareholder[]> | ApiErrorResponse> {
204+
const url = `${this.getConfirmationStatementUrlIncTransactionId(transactionId)}/${confirmationStatementId}/shareholders`;
205205
const resp: HttpResponse = await this.client.httpGet(url);
206206

207207
if (resp.status >= 400) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ describe("Shareholder GET", () => {
303303
it("should return a list of shareholder", async () => {
304304
sinon.stub(mockValues.requestClient, "httpGet").resolves(mockGetShareholder[200]);
305305
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
306-
const data: Resource<Shareholder[]> = await csService.getShareholders(COMPANY_NUMBER) as Resource<Shareholder[]>;
306+
const data: Resource<Shareholder[]> = await csService.getShareholders(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID) as Resource<Shareholder[]>;
307307
expect(data.httpStatusCode).to.equal(200);
308308
expect(data.resource[0].surname).to.equal("Lewis");
309309
expect(data.resource[0].foreName2).to.undefined;
@@ -313,7 +313,7 @@ describe("Shareholder GET", () => {
313313
it("should return a 500 error - Internal server error", async () => {
314314
sinon.stub(mockValues.requestClient, "httpGet").resolves(mockGetShareholder[500]);
315315
const csService: ConfirmationStatementService = new ConfirmationStatementService(mockValues.requestClient);
316-
const data: ApiErrorResponse = await csService.getShareholders(COMPANY_NUMBER) as ApiErrorResponse;
316+
const data: ApiErrorResponse = await csService.getShareholders(TRANSACTION_ID, CONFIRMATION_STATEMENT_ID) as ApiErrorResponse;
317317
expect(data.httpStatusCode).to.equal(500);
318318
expect(data.errors[0]).to.equal("Internal server error");
319319
});

0 commit comments

Comments
 (0)