Skip to content

Commit

Permalink
fix(offerSubscriptionDetail): responding External Service details (#75)
Browse files Browse the repository at this point in the history
  • Loading branch information
tfjanjua committed Oct 29, 2024
1 parent 803d98b commit 853a561
Show file tree
Hide file tree
Showing 21 changed files with 165 additions and 351 deletions.
78 changes: 39 additions & 39 deletions docs/api/apps-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2168,7 +2168,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/AppProviderSubscriptionDetailData'
$ref: '#/components/schemas/OfferProviderSubscriptionDetailData'
'403':
description: User's company does not provide the app.
content:
Expand Down Expand Up @@ -2828,44 +2828,6 @@ components:
description: the technicalUser Profile
additionalProperties: false
description: Response for the app creation
AppProviderSubscriptionDetailData:
type: object
properties:
id:
type: string
format: uuid
offerSubscriptionStatus:
$ref: '#/components/schemas/OfferSubscriptionStatusId'
name:
type: string
nullable: true
customer:
type: string
bpn:
type: string
nullable: true
contact:
type: array
items:
type: string
technicalUserData:
type: array
items:
$ref: '#/components/schemas/SubscriptionTechnicalUserData'
connectorData:
type: array
items:
$ref: '#/components/schemas/SubscriptionAssignedConnectorData'
tenantUrl:
type: string
nullable: true
appInstanceId:
type: string
processStepTypeId:
$ref: '#/components/schemas/ProcessStepTypeId'
externalService:
$ref: '#/components/schemas/SubscriptionExternalServiceData'
additionalProperties: false
AppRequestModel:
type: object
properties:
Expand Down Expand Up @@ -3435,6 +3397,44 @@ components:
message:
type: string
additionalProperties: false
OfferProviderSubscriptionDetailData:
type: object
properties:
id:
type: string
format: uuid
offerSubscriptionStatus:
$ref: '#/components/schemas/OfferSubscriptionStatusId'
name:
type: string
nullable: true
customer:
type: string
bpn:
type: string
nullable: true
contact:
type: array
items:
type: string
technicalUserData:
type: array
items:
$ref: '#/components/schemas/SubscriptionTechnicalUserData'
connectorData:
type: array
items:
$ref: '#/components/schemas/SubscriptionAssignedConnectorData'
tenantUrl:
type: string
nullable: true
appInstanceId:
type: string
processStepTypeId:
$ref: '#/components/schemas/ProcessStepTypeId'
externalService:
$ref: '#/components/schemas/SubscriptionExternalServiceData'
additionalProperties: false
OfferSorting:
enum:
- DateAsc
Expand Down
84 changes: 58 additions & 26 deletions docs/api/services-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ paths:
content:
application/json:
schema:
$ref: '#/components/schemas/ProviderSubscriptionDetailData'
$ref: '#/components/schemas/OfferProviderSubscriptionDetailData'
'403':
description: User's company does not provide the service.
content:
Expand Down Expand Up @@ -2031,6 +2031,44 @@ components:
items:
type: string
additionalProperties: false
OfferProviderSubscriptionDetailData:
type: object
properties:
id:
type: string
format: uuid
offerSubscriptionStatus:
$ref: '#/components/schemas/OfferSubscriptionStatusId'
name:
type: string
nullable: true
customer:
type: string
bpn:
type: string
nullable: true
contact:
type: array
items:
type: string
technicalUserData:
type: array
items:
$ref: '#/components/schemas/SubscriptionTechnicalUserData'
connectorData:
type: array
items:
$ref: '#/components/schemas/SubscriptionAssignedConnectorData'
tenantUrl:
type: string
nullable: true
appInstanceId:
type: string
processStepTypeId:
$ref: '#/components/schemas/ProcessStepTypeId'
externalService:
$ref: '#/components/schemas/SubscriptionExternalServiceData'
additionalProperties: false
OfferSorting:
enum:
- DateAsc
Expand Down Expand Up @@ -2211,31 +2249,6 @@ components:
- RETRIGGER_SELF_DESCRIPTION_CONNECTOR_CREATION
- RETRIGGER_SELF_DESCRIPTION_COMPANY_CREATION
type: string
ProviderSubscriptionDetailData:
type: object
properties:
id:
type: string
format: uuid
offerSubscriptionStatus:
$ref: '#/components/schemas/OfferSubscriptionStatusId'
name:
type: string
nullable: true
customer:
type: string
bpn:
type: string
nullable: true
contact:
type: array
items:
type: string
technicalUserData:
type: array
items:
$ref: '#/components/schemas/SubscriptionTechnicalUserData'
additionalProperties: false
ServiceData:
type: object
properties:
Expand Down Expand Up @@ -2766,6 +2779,25 @@ components:
status:
$ref: '#/components/schemas/OfferSubscriptionStatusId'
additionalProperties: false
SubscriptionExternalServiceData:
type: object
properties:
trusted_issuer:
type: string
participant_id:
type: string
nullable: true
iatp_id:
type: string
nullable: true
did_resolver:
type: string
decentralIdentityManagementAuthUrl:
type: string
decentralIdentityManagementServiceUrl:
type: string
nullable: true
additionalProperties: false
SubscriptionStatusSorting:
enum:
- CompanyNameAsc
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,8 @@ public IAsyncEnumerable<AgreementData> GetAppAgreement(Guid appId) =>
_offerService.GetOfferDocumentContentAsync(appId, documentId, _settings.AppImageDocumentTypeIds, OfferTypeId.APP, cancellationToken);

/// <inheritdoc />
public Task<AppProviderSubscriptionDetailData> GetSubscriptionDetailForProvider(Guid appId, Guid subscriptionId) =>
_offerService.GetAppSubscriptionDetailsForProviderAsync(appId, subscriptionId, OfferTypeId.APP, _settings.CompanyAdminRoles, new WalletConfigData(_settings.IssuerDid, _settings.BpnDidResolverUrl, _settings.DecentralIdentityManagementAuthUrl));
public Task<OfferProviderSubscriptionDetailData> GetSubscriptionDetailForProvider(Guid appId, Guid subscriptionId) =>
_offerService.GetOfferSubscriptionDetailsForProviderAsync(appId, subscriptionId, OfferTypeId.APP, _settings.CompanyAdminRoles, new WalletConfigData(_settings.IssuerDid, _settings.BpnDidResolverUrl, _settings.DecentralIdentityManagementAuthUrl));

/// <inheritdoc />
public Task<SubscriberSubscriptionDetailData> GetSubscriptionDetailForSubscriber(Guid appId, Guid subscriptionId) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public interface IAppsBusinessLogic
/// <param name="appId">Id of the app</param>
/// <param name="subscriptionId">Id of the subscription</param>
/// <returns>Returns the details of the subscription</returns>
Task<AppProviderSubscriptionDetailData> GetSubscriptionDetailForProvider(Guid appId, Guid subscriptionId);
Task<OfferProviderSubscriptionDetailData> GetSubscriptionDetailForProvider(Guid appId, Guid subscriptionId);

/// <summary>
/// Gets the information for the subscription
Expand Down
4 changes: 2 additions & 2 deletions src/marketplace/Apps.Service/Controllers/AppsController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -381,11 +381,11 @@ public async Task<FileResult> GetAppDocumentContentAsync([FromRoute] Guid appId,
[Authorize(Roles = "app_management")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("{appId}/subscription/{subscriptionId}/provider")]
[ProducesResponseType(typeof(AppProviderSubscriptionDetailData), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(OfferProviderSubscriptionDetailData), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status403Forbidden)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[PublicUrl(CompanyRoleId.APP_PROVIDER)]
public Task<AppProviderSubscriptionDetailData> GetSubscriptionDetailForProvider([FromRoute] Guid appId, [FromRoute] Guid subscriptionId) =>
public Task<OfferProviderSubscriptionDetailData> GetSubscriptionDetailForProvider([FromRoute] Guid appId, [FromRoute] Guid subscriptionId) =>
_appsBusinessLogic.GetSubscriptionDetailForProvider(appId, subscriptionId);

/// <summary>
Expand Down
12 changes: 1 addition & 11 deletions src/marketplace/Offers.Library/Service/IOfferService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -213,16 +213,6 @@ Task CreateOrUpdateOfferSubscriptionAgreementConsentAsync(Guid subscriptionId,
/// <param name="technicalUserProfileClient">Client to get the technicalUserProfiles</param>
Task UpdateTechnicalUserProfiles(Guid offerId, OfferTypeId offerTypeId, IEnumerable<TechnicalUserProfileData> data, string technicalUserProfileClient);

/// <summary>
/// Gets the information for the subscription for the provider
/// </summary>
/// <param name="offerId">Id of the offer</param>
/// <param name="subscriptionId">Id of the subscription</param>
/// <param name="offerTypeId">Offer type</param>
/// <param name="contactUserRoles">The roles of the users that will be listed as contact</param>
/// <returns>Returns the details of the subscription</returns>
Task<ProviderSubscriptionDetailData> GetSubscriptionDetailsForProviderAsync(Guid offerId, Guid subscriptionId, OfferTypeId offerTypeId, IEnumerable<UserRoleConfig> contactUserRoles);

/// <summary>
/// Gets the information for the subscription for the subscriber
/// </summary>
Expand Down Expand Up @@ -254,7 +244,7 @@ Task CreateOrUpdateOfferSubscriptionAgreementConsentAsync(Guid subscriptionId,
/// <param name="contactUserRoles">The roles of the users that will be listed as contact</param>
/// <param name="walletData">The information for the external service data</param>
/// <returns>Returns the details of the subscription</returns>
Task<AppProviderSubscriptionDetailData> GetAppSubscriptionDetailsForProviderAsync(Guid offerId, Guid subscriptionId, OfferTypeId offerTypeId, IEnumerable<UserRoleConfig> contactUserRoles, WalletConfigData walletData);
Task<OfferProviderSubscriptionDetailData> GetOfferSubscriptionDetailsForProviderAsync(Guid offerId, Guid subscriptionId, OfferTypeId offerTypeId, IEnumerable<UserRoleConfig> contactUserRoles, WalletConfigData walletData);

/// <summary>
/// Unsubscribe the Offer subscription by subscriptionId
Expand Down
10 changes: 3 additions & 7 deletions src/marketplace/Offers.Library/Service/OfferService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -788,16 +788,12 @@ public async Task UpdateTechnicalUserProfiles(Guid offerId, OfferTypeId offerTyp
}

/// <inheritdoc />
public Task<ProviderSubscriptionDetailData> GetSubscriptionDetailsForProviderAsync(Guid offerId, Guid subscriptionId, OfferTypeId offerTypeId, IEnumerable<UserRoleConfig> contactUserRoles) =>
GetOfferSubscriptionDetailsInternal(offerId, subscriptionId, offerTypeId, contactUserRoles, OfferCompanyRole.Provider, portalRepositories.GetInstance<IOfferSubscriptionsRepository>().GetSubscriptionDetailsForProviderAsync);

/// <inheritdoc />
public async Task<AppProviderSubscriptionDetailData> GetAppSubscriptionDetailsForProviderAsync(Guid offerId, Guid subscriptionId, OfferTypeId offerTypeId, IEnumerable<UserRoleConfig> contactUserRoles, WalletConfigData walletData)
public async Task<OfferProviderSubscriptionDetailData> GetOfferSubscriptionDetailsForProviderAsync(Guid offerId, Guid subscriptionId, OfferTypeId offerTypeId, IEnumerable<UserRoleConfig> contactUserRoles, WalletConfigData walletData)
{
var data = await GetOfferSubscriptionDetailsInternal(offerId, subscriptionId, offerTypeId, contactUserRoles, OfferCompanyRole.Provider, portalRepositories.GetInstance<IOfferSubscriptionsRepository>().GetAppSubscriptionDetailsForProviderAsync)
var data = await GetOfferSubscriptionDetailsInternal(offerId, subscriptionId, offerTypeId, contactUserRoles, OfferCompanyRole.Provider, portalRepositories.GetInstance<IOfferSubscriptionsRepository>().GetOfferSubscriptionDetailsForProviderAsync)
.ConfigureAwait(ConfigureAwaitOptions.None);

return new AppProviderSubscriptionDetailData(
return new OfferProviderSubscriptionDetailData(
data.Id,
data.OfferSubscriptionStatus,
data.Name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ public interface IServiceBusinessLogic
/// <param name="serviceId">Id of the app</param>
/// <param name="subscriptionId">Id of the subscription</param>
/// <returns>Returns the details of the subscription</returns>
Task<ProviderSubscriptionDetailData> GetSubscriptionDetailForProvider(Guid serviceId, Guid subscriptionId);
Task<OfferProviderSubscriptionDetailData> GetSubscriptionDetailForProvider(Guid serviceId, Guid subscriptionId);

/// <summary>
/// Gets the information for the subscription
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ private static IEnumerable<OfferStatusId> GetOfferStatusIds(ServiceStatusIdFilte
}

/// <inheritdoc />
public Task<ProviderSubscriptionDetailData> GetSubscriptionDetailForProvider(Guid serviceId, Guid subscriptionId) =>
_offerService.GetSubscriptionDetailsForProviderAsync(serviceId, subscriptionId, OfferTypeId.SERVICE, _settings.CompanyAdminRoles);
public Task<OfferProviderSubscriptionDetailData> GetSubscriptionDetailForProvider(Guid serviceId, Guid subscriptionId) =>
_offerService.GetOfferSubscriptionDetailsForProviderAsync(serviceId, subscriptionId, OfferTypeId.SERVICE, _settings.CompanyAdminRoles, new WalletConfigData(_settings.IssuerDid, _settings.BpnDidResolverUrl, _settings.DecentralIdentityManagementAuthUrl));

/// <inheritdoc />
public Task<SubscriberSubscriptionDetailData> GetSubscriptionDetailForSubscriber(Guid serviceId, Guid subscriptionId) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,11 @@ public async Task<FileResult> GetServiceDocumentContentAsync([FromRoute] Guid se
[Authorize(Roles = "service_management")]
[Authorize(Policy = PolicyTypes.ValidCompany)]
[Route("{serviceId}/subscription/{subscriptionId}/provider")]
[ProducesResponseType(typeof(ProviderSubscriptionDetailData), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(OfferProviderSubscriptionDetailData), StatusCodes.Status200OK)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status403Forbidden)]
[ProducesResponseType(typeof(ErrorResponse), StatusCodes.Status404NotFound)]
[PublicUrl(CompanyRoleId.SERVICE_PROVIDER)]
public Task<ProviderSubscriptionDetailData> GetSubscriptionDetailForProvider([FromRoute] Guid serviceId, [FromRoute] Guid subscriptionId) =>
public Task<OfferProviderSubscriptionDetailData> GetSubscriptionDetailForProvider([FromRoute] Guid serviceId, [FromRoute] Guid subscriptionId) =>
_serviceBusinessLogic.GetSubscriptionDetailForProvider(serviceId, subscriptionId);

/// <summary>
Expand Down
9 changes: 9 additions & 0 deletions src/marketplace/Services.Service/ServiceSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ public class ServiceSettings
[Required]
[DistinctValues("x => x.ClientId")]
public IEnumerable<UserRoleConfig> DimUserRoles { get; set; } = null!;

[Required(AllowEmptyStrings = true)]
public string DecentralIdentityManagementAuthUrl { get; set; } = null!;

[Required(AllowEmptyStrings = true)]
public string IssuerDid { get; set; } = null!;

[Required(AllowEmptyStrings = true)]
public string BpnDidResolverUrl { get; set; } = null!;
}

public static class ServiceSettingsExtension
Expand Down
3 changes: 3 additions & 0 deletions src/marketplace/Services.Service/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
},
"Services": {
"BasePortalAddress": "https://portal.example.org",
"DecentralIdentityManagementAuthUrl": "",
"IssuerDid": "",
"BpnDidResolverUrl": "",
"ServiceOverviewAddress": "https://portal.example.org",
"CatenaAdminRoles": [],
"ServiceAccountRoles": [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,6 @@ public record SubscriptionTechnicalUserData(
IEnumerable<string> Permissions
);

/// <summary>
/// Detail data for a offer subscription
/// </summary>
/// <param name="Id">Id of the Offer</param>
/// <param name="OfferSubscriptionStatus">Status of the offer subscription</param>
/// <param name="Name">Name of the Offer</param>
/// <param name="Customer">Name of the company subscribing the offer</param>
/// <param name="Bpn">When called from /provider bpn of the company subscribing the offer, otherwise the provider company's bpn</param>
/// <param name="Contact">When called from /provider the company admins of the subscribing company, otherwise the salesmanagers of the offer provider</param>
/// <param name="TechnicalUserData">Information about the technical user</param>
public record ProviderSubscriptionDetailData(
Guid Id,
OfferSubscriptionStatusId OfferSubscriptionStatus,
string? Name,
string Customer,
string? Bpn,
IEnumerable<string> Contact,
IEnumerable<SubscriptionTechnicalUserData> TechnicalUserData
);

/// <summary>
/// Detail data for a offer subscription
/// </summary>
Expand All @@ -61,7 +41,7 @@ IEnumerable<SubscriptionTechnicalUserData> TechnicalUserData
/// <param name="TechnicalUserData">Information about the technical user</param>
/// <param name="TenantUrl">Url of Tenant</param>
/// <param name="AppInstanceId">Id of the app instance</param>
public record AppProviderSubscriptionDetailData(
public record OfferProviderSubscriptionDetailData(
Guid Id,
OfferSubscriptionStatusId OfferSubscriptionStatus,
string? Name,
Expand Down Expand Up @@ -127,7 +107,7 @@ public record SubscriptionAssignedConnectorData(
/// <param name="TechnicalUserData">Information about the technical user</param>
/// <param name="TenantUrl">Url of Tenant</param>
/// <param name="AppInstanceId">Id of the app instance</param>
public record AppProviderSubscriptionDetail(
public record OfferProviderSubscriptionDetail(
Guid Id,
OfferSubscriptionStatusId OfferSubscriptionStatus,
string? Name,
Expand Down
Loading

0 comments on commit 853a561

Please sign in to comment.