Skip to content

Commit

Permalink
feat(app& service): extend subscriptionStatus endpoint (#234)
Browse files Browse the repository at this point in the history
add subscription id to subscriptionStatus endpoint

---------

Refs: CPLP3178
Reviewed-By: Phil Schneider <[email protected]>
  • Loading branch information
VPrasannaK94 authored Aug 25, 2023
1 parent d564882 commit eb7eb64
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,5 @@ public record OfferSubscriptionStatusDetailData(
[property: JsonPropertyName("name")] string? OfferName,
[property: JsonPropertyName("provider")] string Provider,
[property: JsonPropertyName("status")] OfferSubscriptionStatusId OfferSubscriptionStatusId,
[property: JsonPropertyName("subscriptionId")] Guid OfferSubscriptionId,
[property: JsonPropertyName("image")] Guid? DocumentId);
1 change: 1 addition & 0 deletions src/marketplace/Offers.Library/Service/OfferService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,7 @@ private async Task<IEnumerable<Guid>> ValidateRoleData(IEnumerable<UserRoleConfi
item.OfferName,
item.Provider,
item.OfferSubscriptionStatusId,
item.OfferSubscriptionId,
item.DocumentId == Guid.Empty ? null : item.DocumentId)));
}
return await Pagination.CreateResponseAsync(page, size, 15, GetCompanySubscribedOfferSubscriptionStatusesData).ConfigureAwait(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ public record OfferSubscriptionStatusData(
[property: JsonPropertyName("name")] string? OfferName,
[property: JsonPropertyName("provider")] string Provider,
[property: JsonPropertyName("status")] OfferSubscriptionStatusId OfferSubscriptionStatusId,
[property: JsonPropertyName("subscriptionId")] Guid OfferSubscriptionId,
[property: JsonPropertyName("image")] Guid? DocumentId
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,6 +318,7 @@ public void AttachAndModifyAppSubscriptionDetail(Guid detailId, Guid subscriptio
os.Offer!.Name,
os.Offer.Provider,
os.OfferSubscriptionStatusId,
os.Id,
os.Offer.Documents
.Where(document =>
document.DocumentTypeId == documentTypeId &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2415,11 +2415,11 @@ public async Task GetCompanySubscribedOfferSubscriptionStatusesForUserAsync_Retu
// Assert
result.Meta.NumberOfElements.Should().Be(5);
result.Content.Should().HaveCount(5).And.Satisfy(
x => x.OfferId == data[0].OfferId && x.OfferName == data[0].OfferName && x.Provider == data[0].Provider && x.OfferSubscriptionStatusId == data[0].OfferSubscriptionStatusId && x.DocumentId == data[0].DocumentId,
x => x.OfferId == data[1].OfferId && x.OfferName == data[1].OfferName && x.Provider == data[1].Provider && x.OfferSubscriptionStatusId == data[1].OfferSubscriptionStatusId && x.DocumentId == data[1].DocumentId,
x => x.OfferId == data[2].OfferId && x.OfferName == data[2].OfferName && x.Provider == data[2].Provider && x.OfferSubscriptionStatusId == data[2].OfferSubscriptionStatusId && x.DocumentId == data[2].DocumentId,
x => x.OfferId == data[3].OfferId && x.OfferName == data[3].OfferName && x.Provider == data[3].Provider && x.OfferSubscriptionStatusId == data[3].OfferSubscriptionStatusId && x.DocumentId == data[3].DocumentId,
x => x.OfferId == data[4].OfferId && x.OfferName == data[4].OfferName && x.Provider == data[4].Provider && x.OfferSubscriptionStatusId == data[4].OfferSubscriptionStatusId && x.DocumentId == data[4].DocumentId
x => x.OfferId == data[0].OfferId && x.OfferName == data[0].OfferName && x.Provider == data[0].Provider && x.OfferSubscriptionStatusId == data[0].OfferSubscriptionStatusId && x.OfferSubscriptionId == data[0].OfferSubscriptionId && x.DocumentId == data[0].DocumentId,
x => x.OfferId == data[1].OfferId && x.OfferName == data[1].OfferName && x.Provider == data[1].Provider && x.OfferSubscriptionStatusId == data[1].OfferSubscriptionStatusId && x.OfferSubscriptionId == data[1].OfferSubscriptionId && x.DocumentId == data[1].DocumentId,
x => x.OfferId == data[2].OfferId && x.OfferName == data[2].OfferName && x.Provider == data[2].Provider && x.OfferSubscriptionStatusId == data[2].OfferSubscriptionStatusId && x.OfferSubscriptionId == data[2].OfferSubscriptionId && x.DocumentId == data[2].DocumentId,
x => x.OfferId == data[3].OfferId && x.OfferName == data[3].OfferName && x.Provider == data[3].Provider && x.OfferSubscriptionStatusId == data[3].OfferSubscriptionStatusId && x.OfferSubscriptionId == data[3].OfferSubscriptionId && x.DocumentId == data[3].DocumentId,
x => x.OfferId == data[4].OfferId && x.OfferName == data[4].OfferName && x.Provider == data[4].Provider && x.OfferSubscriptionStatusId == data[4].OfferSubscriptionStatusId && x.OfferSubscriptionId == data[4].OfferSubscriptionId && x.DocumentId == data[4].DocumentId
);
A.CallTo(() => _offerSubscriptionsRepository.GetOwnCompanySubscribedOfferSubscriptionStatusesUntrackedAsync(_identity.CompanyId, offerTypeId, documentTypeId))
.MustHaveHappenedOnceExactly();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -812,11 +812,13 @@ public async Task GetOwnCompanySubscribedOfferSubscriptionStatusesUntrackedAsync
x.OfferSubscriptionStatusId == OfferSubscriptionStatusId.ACTIVE &&
x.OfferName == "Trace-X" &&
x.Provider == "Catena-X" &&
x.OfferSubscriptionId == new Guid("ed4de48d-fd4b-4384-a72f-ecae3c6cc5ba") &&
x.DocumentId == new Guid("e020787d-1e04-4c0b-9c06-bd1cd44724b1"),
x => x.OfferId == new Guid("ac1cf001-7fbc-1f2f-817f-bce0572c0007") &&
x.OfferSubscriptionStatusId == OfferSubscriptionStatusId.PENDING &&
x.OfferName == "Trace-X" &&
x.Provider == "Catena-X" &&
x.OfferSubscriptionId == new Guid("e8886159-9258-44a5-88d8-f5735a197a09") &&
x.DocumentId == new Guid("e020787d-1e04-4c0b-9c06-bd1cd44724b1")
);
break;
Expand All @@ -828,11 +830,13 @@ public async Task GetOwnCompanySubscribedOfferSubscriptionStatusesUntrackedAsync
x.OfferSubscriptionStatusId == OfferSubscriptionStatusId.ACTIVE &&
x.OfferName == "SDE with EDC" &&
x.Provider == "Service Provider" &&
x.OfferSubscriptionId == new Guid("3de6a31f-a5d1-4f60-aa3a-4b1a769becbf") &&
x.DocumentId == Guid.Empty,
x => x.OfferId == new Guid("a16e73b9-5277-4b69-9f8d-3b227495dfae") &&
x.OfferSubscriptionStatusId == OfferSubscriptionStatusId.ACTIVE &&
x.OfferName == "Service Test 123" &&
x.Provider == "Service Provider" &&
x.OfferSubscriptionId == new Guid("e80b5f5c-3a16-480b-b82e-1cc06a71fddc") &&
x.DocumentId == Guid.Empty
);
break;
Expand Down

0 comments on commit eb7eb64

Please sign in to comment.