-
Notifications
You must be signed in to change notification settings - Fork 1
Fix #1364: Use database onboarding process configuration instead of properties #1435
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
Changes from 7 commits
0967380
55c3562
17f4607
3462c1a
f1a7b4c
dc33f8b
ea39297
0808cbd
6d60bfc
ad23e29
afc4349
6b5783e
01a1d51
e1e8f5c
73958f0
5cd5a5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -21,6 +21,7 @@ | |
| import lombok.Builder; | ||
|
|
||
| import java.util.List; | ||
| import java.util.Set; | ||
|
|
||
| /** | ||
| * Configuration response. | ||
|
|
@@ -45,8 +46,30 @@ public record ConfigurationResponse( | |
|
|
||
| @Builder | ||
| public record Documents( | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @banterCZ @kober32 please check these changes in the endpoint. It is according to the structure mentioned in #1435 (comment)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I am fine, let's wait for @kober32 review. |
||
| @Schema(description = "Number of required documents to submit.", requiredMode = Schema.RequiredMode.REQUIRED, minimum = "1") | ||
| int requiredDocumentsCount, | ||
|
|
||
| @Schema(description = "Number of required documents to submit. It is sum of all unique values from `mandatory`, `primary` and `secondary` sets.", requiredMode = Schema.RequiredMode.REQUIRED, minimum = "1") | ||
michal-rozehnal-w marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| int requiredTotalDocumentsCount, | ||
|
|
||
| @Schema(description = "Number of required `primary` documents to submit.", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| int requiredPrimaryDocumentsCount, | ||
|
|
||
| @Schema( | ||
| description = "Document types that must be always provided for successful verification.", | ||
| requiredMode = Schema.RequiredMode.REQUIRED, | ||
| defaultValue = "[]") | ||
| Set<DocumentType> mandatory, | ||
|
|
||
| @Schema( | ||
| description = "Primary document types. Minimum number of documents from this set for successful verification is set in `requiredPrimaryDocumentsCount`.", | ||
| requiredMode = Schema.RequiredMode.REQUIRED, | ||
| defaultValue = "[]") | ||
| Set<DocumentType> primary, | ||
|
|
||
| @Schema(description = "Secondary document types which are allowed for verification.", | ||
| requiredMode = Schema.RequiredMode.REQUIRED, | ||
| defaultValue = "all values from `DocumentType` enum") | ||
| Set<DocumentType> secondary, | ||
michal-rozehnal-w marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| List<Document> items | ||
| ) { | ||
| } | ||
|
|
@@ -57,9 +80,6 @@ public record Document( | |
| @Schema(description = "Document type.", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| DocumentType type, | ||
|
|
||
| @Schema(description = "Whether the document is mandatory.", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| boolean mandatory, | ||
|
|
||
| @Schema(description = "Number of document sides.", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| byte sideCount | ||
| ) { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,3 @@ | ||
| INSERT INTO es_onboarding_process_configuration (id, process_type, config) VALUES | ||
| (1, 'reactivation', '{"enabled":true,"activationType":"CODE","otpForIdentification":true,"otpForIdentityVerification":true,"documents":{"requiredDocumentsCount":2,"items":[{"type":"ID_CARD","sideCount":2,"mandatory":true},{"type":"DRIVING_LICENCE","sideCount":1,"mandatory":false}]}}'), | ||
| (1, 'reactivation', '{"enabled":true,"activationType":"CODE","otpForIdentification":true,"otpForIdentityVerification":true,"documents":{"requiredTotalDocumentsCount":2,"requiredPrimaryDocumentsCount":"1","mandatory":["ID_CARD"],"primary":["PASSPORT"],"secondary":["DRIVING_LICENCE"],"items":[{"type":"ID_CARD","sideCount":2},{"type":"DRIVING_LICENCE","sideCount":1}]}}'), | ||
michal-rozehnal-w marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| (2, 'onboarding', '{}'); | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| /* | ||
| * PowerAuth Enrollment Server | ||
| * Copyright (C) 2025 Wultra s.r.o. | ||
| * | ||
| * This program is free software: you can redistribute it and/or modify | ||
| * it under the terms of the GNU Affero General Public License as published | ||
| * by the Free Software Foundation, either version 3 of the License, or | ||
| * (at your option) any later version. | ||
| * | ||
| * This program is distributed in the hope that it will be useful, | ||
| * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| * GNU Affero General Public License for more details. | ||
| * | ||
| * You should have received a copy of the GNU Affero General Public License | ||
| * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| */ | ||
|
|
||
| package com.wultra.app.onboardingserver.impl.service; | ||
|
|
||
| import com.wultra.app.onboardingserver.common.database.OnboardingProcessRepository; | ||
| import com.wultra.app.onboardingserver.common.database.entity.OnboardingProcessConfigurationEntity; | ||
| import com.wultra.app.onboardingserver.common.database.entity.OnboardingProcessConfigurationValue; | ||
| import lombok.AllArgsConstructor; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * TODO | ||
michal-rozehnal-w marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * | ||
| * @author Michal Rozehnal, michal.rozehnal@wultra.com | ||
| */ | ||
| @Service | ||
| @AllArgsConstructor | ||
| public class OnboardingProcessConfigurationService { | ||
|
|
||
| private final OnboardingProcessRepository onboardingProcessRepository; | ||
|
|
||
| public OnboardingProcessConfigurationValue findConfigByProcessId(final String processId) { | ||
| final var onboardingProcess = onboardingProcessRepository.findById(processId) | ||
| .orElseThrow(() -> new IllegalArgumentException("Onboarding process not found for id: " + processId)); | ||
|
|
||
| return Optional.ofNullable(onboardingProcess.getProcessConfiguration()) | ||
michal-rozehnal-w marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| .map(OnboardingProcessConfigurationEntity::getConfiguration) | ||
| .orElseThrow(() -> new IllegalArgumentException("Onboarding process configuration not found for process id: " + processId)); | ||
| } | ||
michal-rozehnal-w marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| } | ||
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.