Skip to content

Commit

Permalink
DP-1126 - Expose supplier and buyer information in the organisation d…
Browse files Browse the repository at this point in the history
…etails endpoint (#1207)

* Removed Footer_AboutUs from Welsh file also

* Added supplier and buyer information in the organisation details endpoint

* Moved BuyerInformation inside Details

* corrected test labels

* Corrected unit tests

* Corrected Unit tests and reverted back translations

* corrected translations file

* corrected resource file

* Restore TRanslations file

* Removed exclamation sign

* remove unsed namespaces
shilpigoel-goaco authored Jan 30, 2025
1 parent a4dfe04 commit 99c1d43
Showing 34 changed files with 78 additions and 54 deletions.
Original file line number Diff line number Diff line change
@@ -85,7 +85,7 @@ [ organisation ]
name: "Org name",
type: Organisation.WebApiClient.OrganisationType.Organisation,
roles: [Organisation.WebApiClient.PartyRole.Supplier, Organisation.WebApiClient.PartyRole.Tenderer],
details: new Details(approval: null, pendingRoles: [])
details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null)
)
);

2 changes: 1 addition & 1 deletion Frontend/CO.CDP.OrganisationApp.Tests/FormsEngineTests.cs
Original file line number Diff line number Diff line change
@@ -359,7 +359,7 @@ public async Task GetFormSectionAsync_ShouldFetchChoicesFromCustomChoiceProvider
null
));
_organisationClientMock.Setup(c => c.GetOrganisationAsync(organisationId))
.ReturnsAsync(new Organisation.WebApiClient.Organisation(additionalIdentifiers: [], addresses: [], contactPoint: null, id: organisationId, identifier: null, name: "User's current organisation", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: [])));
.ReturnsAsync(new Organisation.WebApiClient.Organisation(additionalIdentifiers: [], addresses: [], contactPoint: null, id: organisationId, identifier: null, name: "User's current organisation", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null)));
_userInfoServiceMock.Setup(u => u.GetOrganisationId()).Returns(organisationId);
_tempDataServiceMock.Setup(t => t.Peek<SectionQuestionsResponse>(sessionKey))
.Returns((SectionQuestionsResponse?)null);
Original file line number Diff line number Diff line change
@@ -171,7 +171,7 @@ private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationCl
type: AddressType.Postal),
];

return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: addresses, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: null, name: null, type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: addresses, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: null, name: null, type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}

private ConsortiumChangeAddressModel GivenOrganisationAddressModel()
Original file line number Diff line number Diff line change
@@ -145,7 +145,7 @@ public async Task OnGet_ValidSession_ReturnsConsortiumDetailsAsync()

private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel(Guid? id)
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: new ContactPoint("Main Contact", "contact@test.com", "123456789", null), id: id ?? Guid.NewGuid(), identifier: null, name: null, type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: new ContactPoint("Main Contact", "contact@test.com", "123456789", null), id: id ?? Guid.NewGuid(), identifier: null, name: null, type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}

private ConsortiumChangeEmailModel GivenConsortiumChangeEmailModel()
Original file line number Diff line number Diff line change
@@ -98,6 +98,6 @@ public async Task OnGet_ValidSession_ReturnsConsortiumDetailsAsync()

private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel(Guid? id)
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: null, name: "Test Org", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: null, name: "Test Org", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}
}
Original file line number Diff line number Diff line change
@@ -98,7 +98,7 @@ public async Task OnPost_RemovesTempData_WhenConfirmSupplierIsFalse()
.Returns(sharecode);

_model.ConfirmSupplier = false;

var result = await _model.OnPost();

result.Should().BeOfType<RedirectToPageResult>().Which.PageName.Should().Be("ConsortiumOverview");
@@ -118,6 +118,6 @@ public async Task OnPost_RedirectsToPageNotFound_WhenOrganisationDoesNotExist()

private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel()
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _consortiumId, identifier: null, name: "Test Consortium", type: CDP.Organisation.WebApiClient.OrganisationType.InformalConsortium, roles: [], details: new CO.CDP.Organisation.WebApiClient.Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _consortiumId, identifier: null, name: "Test Consortium", type: CDP.Organisation.WebApiClient.OrganisationType.InformalConsortium, roles: [], details: new CO.CDP.Organisation.WebApiClient.Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}
}
Original file line number Diff line number Diff line change
@@ -79,7 +79,7 @@ public void WhenEmailAddressIsInvalid_ShouldRaiseEmailAddressValidationError()
var results = ModelValidationHelper.Validate(model, validationContext);

results.Any(c => c.MemberNames.Contains("EmailAddress")).Should().BeTrue();

results.Where(c => c.MemberNames.Contains("EmailAddress")).First()
.ErrorMessage.Should().Be(StaticTextResource.Global_Email_Invalid_ErrorMessage);
}
@@ -95,7 +95,7 @@ public void WhenEmailAddressIsValid_ShouldNotRaiseEmailAddressValidationError()
results.Any(c => c.MemberNames.Contains("EmailAddress")).Should().BeFalse();
}



[Fact]
public void OnGet_ValidSession_ReturnsConsortiumDetails()
@@ -193,7 +193,7 @@ public async Task OnPost_OnSuccess_RedirectsToOrganisationOverView()
.Which.PageName.Should().Be("ConsortiumOverview");
}

private ConsortiumDetails DummyConsortiumDetails(string consortiumName = "Consortium 1",
private ConsortiumDetails DummyConsortiumDetails(string consortiumName = "Consortium 1",
string consortiumEmailAddress = "test@example.com")
{
var consortiumDetails = new ConsortiumDetails
@@ -213,7 +213,7 @@ private ConsortiumEmailModel GivenConsortiumEmailModel()
}
private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel()
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _consortiumId, identifier: null, name: "Test Org", type: CDP.Organisation.WebApiClient.OrganisationType.InformalConsortium, roles: [], details: new Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _consortiumId, identifier: null, name: "Test Org", type: CDP.Organisation.WebApiClient.OrganisationType.InformalConsortium, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}
private ConsortiumEmailModel GivenConsortiumEmailDetailModel()
{
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ public async Task OnPost_ShouldReturnPage_WhenModelStateIsInvalid()
[Fact]
public async Task OnPost_ShouldReturnPage_WhenSharecodeAlreadyExists()
{
var supplierInfo = GetSupplierInfo();
var supplierInfo = GetSupplierInfo();
var parties = new OrganisationParties(new List<OrganisationParty>
{
new OrganisationParty(supplierInfo.Id, "Consortium 1", new OrganisationPartyShareCode(DateTimeOffset.Now, "EXISTING_CODE"))
@@ -114,7 +114,7 @@ public async Task OnPost_ShouldRedirectToConfirmSupplier_WhenSharecodeIsValid()

private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel()
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _consortiumId, identifier: null, name: "Test Consortium", type: CDP.Organisation.WebApiClient.OrganisationType.InformalConsortium, roles: [], details: new CO.CDP.Organisation.WebApiClient.Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _consortiumId, identifier: null, name: "Test Consortium", type: CDP.Organisation.WebApiClient.OrganisationType.InformalConsortium, roles: [], details: new CO.CDP.Organisation.WebApiClient.Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}

private static DataSharing.WebApiClient.SupplierInformation GetSupplierInfo()
Original file line number Diff line number Diff line change
@@ -108,9 +108,9 @@ public async Task OnGet_SetsFlashMessage_WhenSharecodeExists()
string.Format(StaticTextResource.Consortium_ConsortiumOverview_Success_Heading, sharecode.SharecodeOrganisationName),
null, null, null, null), Times.Once);
}

private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel()
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _consortiumId, identifier: null, name: "Test Consortium", type: CDP.Organisation.WebApiClient.OrganisationType.InformalConsortium, roles: [], details: new CO.CDP.Organisation.WebApiClient.Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _consortiumId, identifier: null, name: "Test Consortium", type: CDP.Organisation.WebApiClient.OrganisationType.InformalConsortium, roles: [], details: new CO.CDP.Organisation.WebApiClient.Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using Castle.Components.DictionaryAdapter;
using CO.CDP.Organisation.WebApiClient;
using CO.CDP.OrganisationApp.Models;
using CO.CDP.OrganisationApp.Pages.MoU;
@@ -115,10 +116,8 @@ private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationCl
name: "Test Org",
type: OrganisationType.Organisation,
roles: [],
details: new Details(
approval: null,
pendingRoles: pendingRoles ?? []
));
details: new Details(approval: null, buyerInformation: null, pendingRoles: pendingRoles ?? [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null)
);
}

}
Original file line number Diff line number Diff line change
@@ -145,7 +145,7 @@ public async Task OnGet_ValidSession_ReturnsOrganisationDetailsAsync()

private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel(Guid? id)
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: new ContactPoint("Main Contact", "contact@test.com", "123456789", null), id: id ?? Guid.NewGuid(), identifier: null, name: null, type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: new ContactPoint("Main Contact", "contact@test.com", "123456789", null), id: id ?? Guid.NewGuid(), identifier: null, name: null, type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}

private OrganisationEmailModel GivenOrganisationEmailModel()
Original file line number Diff line number Diff line change
@@ -110,6 +110,6 @@ private static WebApiClientOrganisation GivenOrganisationClientModel(Guid? id)
)
};

return new WebApiClientOrganisation(additionalIdentifiers: additionalIdentifiers, addresses: null, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: identifier, name: "Test Org", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new WebApiClientOrganisation(additionalIdentifiers: additionalIdentifiers, addresses: null, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: identifier, name: "Test Org", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}
}
Original file line number Diff line number Diff line change
@@ -158,12 +158,13 @@ private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationCl
additionalIdentifiers: additionalIdentifiers,
addresses: null,
contactPoint: null,
details: new Details(approval: null, pendingRoles: []),
details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null),
id: _organisationId,
identifier: identifier,
name: "Test Org",
roles: new List<PartyRole>(),
type: OrganisationType.Organisation);
type: OrganisationType.Organisation
);
}
private IList<ValidationResult> ValidateModel(object model)
{
Original file line number Diff line number Diff line change
@@ -103,7 +103,7 @@ public async Task OnGet_ValidSession_ReturnsOrganisationDetailsAsync()

private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel(Guid? id)
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: null, name: "Test Org", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: null, name: "Test Org", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}

private OrganisationNameModel GivenOrganisationNameModel()
Original file line number Diff line number Diff line change
@@ -94,6 +94,7 @@ private static CDP.Organisation.WebApiClient.Organisation OrganisationResponse(P
identifier: null!,
name: "Org name",
type: CDP.Organisation.WebApiClient.OrganisationType.Organisation,
roles: roles ?? []);
roles: roles ?? []
);
}
}
Original file line number Diff line number Diff line change
@@ -170,7 +170,7 @@ private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationCl
streetAddress: "1 street lane",
type: CDP.Organisation.WebApiClient.AddressType.Registered));

return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: addresses, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: null, name: null, type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: addresses, contactPoint: null, id: id ?? Guid.NewGuid(), identifier: null, name: null, type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}

private OrganisationRegisteredAddressModel GivenOrganisationAddressModel()
Original file line number Diff line number Diff line change
@@ -150,9 +150,7 @@ private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationCl
name: "Test Org",
type: OrganisationType.Organisation,
roles: [],
details: new Details(
approval: null,
pendingRoles: pendingRoles != null ? pendingRoles : []
));
details: new Details(approval: null, buyerInformation: null, pendingRoles: pendingRoles != null ? pendingRoles : [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null)
);
}
}
Original file line number Diff line number Diff line change
@@ -230,7 +230,7 @@ private RegistrationDetails DummyRegistrationDetails()

private static CO.CDP.Organisation.WebApiClient.Organisation GivenOrganisationClientModel()
{
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _organisationId, identifier: null, name: "Test Org", type: CDP.Organisation.WebApiClient.OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new CO.CDP.Organisation.WebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: _organisationId, identifier: null, name: "Test Org", type: CDP.Organisation.WebApiClient.OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}

private OrganisationDetailsSummaryModel GivenOrganisationDetailModel()
Original file line number Diff line number Diff line change
@@ -6,7 +6,7 @@ public static class OrganisationEntityFactory
{
public static OrganisationWebApiClient.Organisation GivenClientModel()
{
return new OrganisationWebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: Guid.NewGuid(), identifier: null, name: "Test Org", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, pendingRoles: []));
return new OrganisationWebApiClient.Organisation(additionalIdentifiers: null, addresses: null, contactPoint: null, id: Guid.NewGuid(), identifier: null, name: "Test Org", type: OrganisationType.Organisation, roles: [], details: new Details(approval: null, buyerInformation: null, pendingRoles: [], publicServiceMissionOrganization: null, scale: null, shelteredWorkshop: null, vcse: null));
}

public static ProblemDetails GivenProblemDetails(
Loading

0 comments on commit 99c1d43

Please sign in to comment.