From 410fc355d0ba8d99fab78850a1cde7c3f2534315 Mon Sep 17 00:00:00 2001 From: peggy-quartech Date: Tue, 29 Apr 2025 10:40:46 -0700 Subject: [PATCH 1/3] change --- src/Spd.Manager.Licence/BizMemberContract.cs | 2 +- .../Controllers/OrgController.cs | 21 +++++++++++++++++++ .../Spd.Presentation.Dynamics.csproj | 1 + .../ControllingMemberInvite/Contract.cs | 2 +- .../ControllingMemberInviteRepository.cs | 6 ++++-- 5 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/Spd.Manager.Licence/BizMemberContract.cs b/src/Spd.Manager.Licence/BizMemberContract.cs index 081312d327..33d8c7083c 100644 --- a/src/Spd.Manager.Licence/BizMemberContract.cs +++ b/src/Spd.Manager.Licence/BizMemberContract.cs @@ -16,7 +16,7 @@ public interface IBizMemberManager public Task Handle(VerifyBizStakeholderInviteCommand command, CancellationToken ct); } -public record BizStakeholderNewInviteCommand(Guid BizContactId, Guid UserId, string HostUrl, StakeholderAppInviteTypeCode InviteTypeCode = StakeholderAppInviteTypeCode.New) : IRequest; +public record BizStakeholderNewInviteCommand(Guid BizContactId, Guid? UserId, string HostUrl, StakeholderAppInviteTypeCode InviteTypeCode = StakeholderAppInviteTypeCode.New) : IRequest; public record VerifyBizStakeholderInviteCommand(string InviteEncryptedCode) : IRequest; public record GetBizMembersQuery(Guid BizId, Guid? AppId = null) : IRequest; public record GetNonSwlBizMemberCommand(Guid BizContactId) : IRequest; diff --git a/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs b/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs index 5160855dda..08a82435c1 100644 --- a/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs +++ b/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs @@ -1,8 +1,10 @@ using MediatR; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using Spd.Manager.Licence; using Spd.Manager.Screening; using Spd.Utilities.Shared; +using System.ComponentModel.DataAnnotations; using System.Configuration; namespace Spd.Presentation.Dynamics.Controllers; @@ -46,4 +48,23 @@ public async Task GetOrgInvitationLinkAsync( return await _mediator.Send(new OrgInvitationLinkCreateCommand(orgId, $"{screeningHostUrl}{screeningOrgPath}"), ct); } + + /// + /// Create stakeholder (controlling member, biz manager) crc invitation for this biz contact + /// Example: http://localhost:5114/api/business-stakeholder-invitation/{bizContactId} + /// + /// + /// + /// + [Route("api/business-stakeholder-invitation/{bizContactId}")] + [HttpGet] + public async Task CreateBizStakeHolderCrcAppInvitation([FromRoute][Required] Guid bizContactId, + [FromQuery] StakeholderAppInviteTypeCode inviteType = StakeholderAppInviteTypeCode.New) + { + string? hostUrl = _configuration.GetValue("HostUrl"); + if (hostUrl == null) + throw new ConfigurationErrorsException("HostUrl is not set correctly in configuration."); + var inviteCreateCmd = new BizStakeholderNewInviteCommand(bizContactId, null, hostUrl, inviteType); + return await _mediator.Send(inviteCreateCmd); + } } diff --git a/src/Spd.Presentation.Dynamics/Spd.Presentation.Dynamics.csproj b/src/Spd.Presentation.Dynamics/Spd.Presentation.Dynamics.csproj index 12c8843082..4e3e24d30b 100644 --- a/src/Spd.Presentation.Dynamics/Spd.Presentation.Dynamics.csproj +++ b/src/Spd.Presentation.Dynamics/Spd.Presentation.Dynamics.csproj @@ -14,6 +14,7 @@ + diff --git a/src/Spd.Resource.Repository/ControllingMemberInvite/Contract.cs b/src/Spd.Resource.Repository/ControllingMemberInvite/Contract.cs index 423ca8c41a..f0d61a727a 100644 --- a/src/Spd.Resource.Repository/ControllingMemberInvite/Contract.cs +++ b/src/Spd.Resource.Repository/ControllingMemberInvite/Contract.cs @@ -46,7 +46,7 @@ public record ControllingMemberInvite public string? MiddleName2 { get; set; } public string? EmailAddress { get; set; } public Guid BizId { get; set; } - public Guid CreatedByUserId { get; set; } + public Guid? CreatedByUserId { get; set; } public Guid BizContactId { get; set; } public ControllingMemberAppInviteTypeEnum InviteTypeCode { get; set; } = ControllingMemberAppInviteTypeEnum.New; } diff --git a/src/Spd.Resource.Repository/ControllingMemberInvite/ControllingMemberInviteRepository.cs b/src/Spd.Resource.Repository/ControllingMemberInvite/ControllingMemberInviteRepository.cs index ae3a6c492b..b94abc923f 100644 --- a/src/Spd.Resource.Repository/ControllingMemberInvite/ControllingMemberInviteRepository.cs +++ b/src/Spd.Resource.Repository/ControllingMemberInvite/ControllingMemberInviteRepository.cs @@ -44,7 +44,9 @@ public async Task ManageAsync(ControllingMemberInviteCmd cmd, CancellationToken public async Task CreateControllingMemberInviteAsync(ControllingMemberInviteCreateCmd createInviteCmd, CancellationToken ct) { - spd_portaluser? user = await _dynaContext.GetUserById(createInviteCmd.CreatedByUserId, ct); + spd_portaluser? user = null; + if (createInviteCmd.CreatedByUserId != null) + user = await _dynaContext.GetUserById((Guid)createInviteCmd.CreatedByUserId, ct); account? biz = await _dynaContext.GetOrgById(createInviteCmd.BizId, ct); spd_businesscontact? bizContact = await _dynaContext.GetBizContactById(createInviteCmd.BizContactId, ct); spd_portalinvitation invitation = _mapper.Map(createInviteCmd); @@ -52,7 +54,7 @@ public async Task CreateControllingMemberInviteAsync(ControllingMemberInviteCrea invitation.spd_invitationlink = $"{createInviteCmd.HostUrl}{SpdConstants.BizPortalControllingMemberInviteLink}{encryptedInviteId}"; _dynaContext.AddTospd_portalinvitations(invitation); _dynaContext.SetLink(invitation, nameof(spd_portalinvitation.spd_OrganizationId), biz); - _dynaContext.SetLink(invitation, nameof(spd_portalinvitation.spd_InvitedBy), user); + if (user != null) _dynaContext.SetLink(invitation, nameof(spd_portalinvitation.spd_InvitedBy), user); _dynaContext.SetLink(invitation, nameof(spd_portalinvitation.spd_BusinessContact), bizContact); spd_servicetype? servicetype = _dynaContext.LookupServiceType(ServiceTypeEnum.SECURITY_BUSINESS_LICENCE_CONTROLLING_MEMBER_CRC.ToString()); if (servicetype != null) From 182118bb68e7b8d52fdb73bf059a3c948c083ac3 Mon Sep 17 00:00:00 2001 From: peggy-quartech Date: Tue, 29 Apr 2025 11:26:03 -0700 Subject: [PATCH 2/3] setting --- src/Spd.Presentation.Dynamics/Controllers/OrgController.cs | 3 ++- src/Spd.Presentation.Dynamics/appsettings.json | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs b/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs index 08a82435c1..47459423ff 100644 --- a/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs +++ b/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs @@ -61,7 +61,8 @@ public async Task GetOrgInvitationLinkAsync( public async Task CreateBizStakeHolderCrcAppInvitation([FromRoute][Required] Guid bizContactId, [FromQuery] StakeholderAppInviteTypeCode inviteType = StakeholderAppInviteTypeCode.New) { - string? hostUrl = _configuration.GetValue("HostUrl"); + string? hostUrl = _configuration.GetValue("LicensingHostUrl"); + string? licensingStakeHolderInvitePath = _configuration.GetValue("LicensingBizStakeHolderInvitationPath"); if (hostUrl == null) throw new ConfigurationErrorsException("HostUrl is not set correctly in configuration."); var inviteCreateCmd = new BizStakeholderNewInviteCommand(bizContactId, null, hostUrl, inviteType); diff --git a/src/Spd.Presentation.Dynamics/appsettings.json b/src/Spd.Presentation.Dynamics/appsettings.json index 1647e012c2..f5010c2133 100644 --- a/src/Spd.Presentation.Dynamics/appsettings.json +++ b/src/Spd.Presentation.Dynamics/appsettings.json @@ -12,6 +12,7 @@ "ScreeningAppPaymentPath": "api/crrpa/payment-secure-link", "LicensingAppPaymentPath": "api/licensing/payment-secure-link", "ScreeningOrgInvitationPath": "crrp/invitation-link-bceid", + "LicensingBizStakeHolderInvitationPath": "", "PayBC": { "DirectRefund": { "AuthenticationSettings": { From 32229e517b3e3e1229307ee71237e5018772e034 Mon Sep 17 00:00:00 2001 From: peggy-quartech Date: Tue, 29 Apr 2025 11:45:53 -0700 Subject: [PATCH 3/3] remove the no-use code --- src/Spd.Presentation.Dynamics/Controllers/OrgController.cs | 1 - src/Spd.Presentation.Dynamics/appsettings.json | 1 - 2 files changed, 2 deletions(-) diff --git a/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs b/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs index 47459423ff..22e211d891 100644 --- a/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs +++ b/src/Spd.Presentation.Dynamics/Controllers/OrgController.cs @@ -62,7 +62,6 @@ public async Task CreateBizStakeHolderCrcAppIn [FromQuery] StakeholderAppInviteTypeCode inviteType = StakeholderAppInviteTypeCode.New) { string? hostUrl = _configuration.GetValue("LicensingHostUrl"); - string? licensingStakeHolderInvitePath = _configuration.GetValue("LicensingBizStakeHolderInvitationPath"); if (hostUrl == null) throw new ConfigurationErrorsException("HostUrl is not set correctly in configuration."); var inviteCreateCmd = new BizStakeholderNewInviteCommand(bizContactId, null, hostUrl, inviteType); diff --git a/src/Spd.Presentation.Dynamics/appsettings.json b/src/Spd.Presentation.Dynamics/appsettings.json index f5010c2133..1647e012c2 100644 --- a/src/Spd.Presentation.Dynamics/appsettings.json +++ b/src/Spd.Presentation.Dynamics/appsettings.json @@ -12,7 +12,6 @@ "ScreeningAppPaymentPath": "api/crrpa/payment-secure-link", "LicensingAppPaymentPath": "api/licensing/payment-secure-link", "ScreeningOrgInvitationPath": "crrp/invitation-link-bceid", - "LicensingBizStakeHolderInvitationPath": "", "PayBC": { "DirectRefund": { "AuthenticationSettings": {