Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(registration): make submit document type validation optional #853

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -548,14 +548,17 @@ public async Task<bool> SubmitRegistrationAsync(Guid applicationId)

if (GetAndValidateUpdateApplicationStatus(applicationUserData.CompanyApplicationStatusId, UpdateApplicationSteps.SubmitRegistration) != CompanyApplicationStatusId.SUBMITTED)
{
throw new UnexpectedConditionException("updateStatus should allways be SUBMITTED here");
throw new UnexpectedConditionException("updateStatus should always be SUBMITTED here");
}

portalRepositories.GetInstance<IDocumentRepository>().AttachAndModifyDocuments(
applicationUserData.DocumentDatas.Select(x => new ValueTuple<Guid, Action<Document>?, Action<Document>>(
x.DocumentId,
doc => doc.DocumentStatusId = x.StatusId,
doc => doc.DocumentStatusId = DocumentStatusId.LOCKED)));
if (applicationUserData.DocumentDatas != null && applicationUserData.DocumentDatas.Any())
{
portalRepositories.GetInstance<IDocumentRepository>().AttachAndModifyDocuments(
applicationUserData.DocumentDatas.Select(x => new ValueTuple<Guid, Action<Document>?, Action<Document>>(
x.DocumentId,
doc => doc.DocumentStatusId = x.StatusId,
doc => doc.DocumentStatusId = DocumentStatusId.LOCKED)));
}

var entries = await checklistService.CreateInitialChecklistAsync(applicationId);

Expand Down Expand Up @@ -642,7 +645,7 @@ private async ValueTask<CompanyApplicationUserEmailData> GetAndValidateCompanyDa
{
throw new ConflictException($"Agreement and Consent must not be empty");
}
if (!applicationUserData.DocumentDatas.Any())
if (!_settings.IsSubmitDocumentValidationOptional && !applicationUserData.DocumentDatas.Any())
{
throw new ConflictException($"At least one Document type Id must be [{string.Join(", ", docTypeIds)}]");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@ public class RegistrationSettings
[DistinctValues]
public IEnumerable<DocumentTypeId> SubmitDocumentTypeIds { get; set; } = null!;

/// <summary>
/// Is Submit DocumentType Validation Optional
/// </summary>
/// <value></value>
[Required]
[DistinctValues]
public bool IsSubmitDocumentValidationOptional { get; set; } = false;

/// <summary>
/// Url to the password resend of the portal
/// </summary>
Expand Down
3 changes: 2 additions & 1 deletion src/registration/Registration.Service/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
"DocumentTypeIds": [],
"RegistrationDocumentTypeIds": [],
"SubmitDocumentTypeIds": [],
"PasswordResendAddress": ""
"PasswordResendAddress": "",
"IsSubmitDocumentValidationOptional": false
},
"BpnAccess": {
"BaseAddress": ""
Expand Down
Loading
Loading