-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
25 changed files
with
265 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Migration from 1.5.x to 1.6.x | ||
|
||
This guide contains instructions for migration from PowerAuth Enrollment Server version `1.5.x` to version `1.6.0`. | ||
|
||
No migration steps nor database changes are required. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
docs/onboarding/PowerAuth-Enrollment-Onboarding-Server-1.6.0.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# Migration from 1.5.x to 1.6.x | ||
|
||
This guide contains instructions for migration from PowerAuth Enrollment Onboarding Server version `1.5.x` to version `1.6.0`. | ||
|
||
No migration steps nor database changes are required. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...m/wultra/app/onboardingserver/common/EnrollmentServerOnboardingCommonTestApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/* | ||
* PowerAuth Enrollment Server | ||
* Copyright (C) 2023 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.common; | ||
|
||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
|
||
@SpringBootApplication | ||
public class EnrollmentServerOnboardingCommonTestApplication { | ||
} |
65 changes: 65 additions & 0 deletions
65
...st/java/com/wultra/app/onboardingserver/common/database/DocumentResultRepositoryTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
/* | ||
* PowerAuth Enrollment Server | ||
* Copyright (C) 2023 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.common.database; | ||
|
||
|
||
import com.wultra.app.onboardingserver.common.database.entity.DocumentResultEntity; | ||
import com.wultra.app.onboardingserver.common.database.entity.DocumentVerificationEntity; | ||
import jakarta.transaction.Transactional; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest; | ||
import org.springframework.test.context.ActiveProfiles; | ||
import org.springframework.test.context.jdbc.Sql; | ||
|
||
import static org.assertj.core.api.Assertions.assertThat; | ||
|
||
/** | ||
* Test for {@link DocumentResultRepository}. | ||
* | ||
* @author Jan Pesek, [email protected] | ||
*/ | ||
@DataJpaTest | ||
@ActiveProfiles("test") | ||
@Transactional | ||
class DocumentResultRepositoryTest { | ||
|
||
@Autowired | ||
private DocumentResultRepository tested; | ||
|
||
@Test | ||
@Sql | ||
void testStreamAllInProgressDocumentSubmits() { | ||
assertThat(tested.streamAllInProgressDocumentSubmits("mock")) | ||
.extracting(DocumentResultEntity::getDocumentVerification) | ||
.extracting(DocumentVerificationEntity::getProviderName) | ||
.containsOnly("mock") | ||
.hasSize(1); | ||
} | ||
|
||
@Test | ||
@Sql | ||
void testStreamAllInProgressDocumentSubmitVerifications() { | ||
assertThat(tested.streamAllInProgressDocumentSubmitVerifications("mock")) | ||
.extracting(DocumentResultEntity::getDocumentVerification) | ||
.extracting(DocumentVerificationEntity::getProviderName) | ||
.containsOnly("mock") | ||
.hasSize(1); | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
enrollment-server-onboarding-common/src/test/resources/application-test.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
spring.datasource.url=jdbc:h2:mem:testdb;DB_CLOSE_ON_EXIT=FALSE | ||
spring.datasource.username=sa | ||
spring.datasource.password=password | ||
spring.datasource.driver-class-name=org.h2.Driver | ||
spring.jpa.hibernate.ddl-auto=create |
12 changes: 12 additions & 0 deletions
12
...abase/DocumentResultRepositoryTest.testStreamAllInProgressDocumentSubmitVerifications.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Documents that have been already submitted and data were extracted (multiple providers). | ||
INSERT INTO es_identity_verification(id, activation_id, user_id, process_id, status, phase, timestamp_created, timestamp_last_updated) VALUES | ||
('v3', 'a3', 'u3', 'p3', 'IN_PROGRESS', 'DOCUMENT_UPLOAD', now(), now()), | ||
('v4', 'a4', 'u4', 'p4', 'IN_PROGRESS', 'DOCUMENT_UPLOAD', now(), now()); | ||
|
||
INSERT INTO es_document_verification(id, provider_name, activation_id, identity_verification_id, verification_id, type, status, filename, used_for_verification, timestamp_created, timestamp_last_updated) VALUES | ||
('d3', 'foreign', 'a3', 'v3', 'verification1', 'ID_CARD', 'UPLOAD_IN_PROGRESS', 'f3', true, now(), now()), | ||
('d4', 'mock', 'a4', 'v4', 'verification2', 'ID_CARD', 'UPLOAD_IN_PROGRESS', 'f4', true, now(), now()); | ||
|
||
INSERT INTO es_document_result(id, document_verification_id, phase, extracted_data, timestamp_created) VALUES | ||
(3, 'd3', 'UPLOAD', '{extracted_data}', now()), | ||
(4, 'd4', 'UPLOAD', '{extracted_data}', now()); |
12 changes: 12 additions & 0 deletions
12
...r/common/database/DocumentResultRepositoryTest.testStreamAllInProgressDocumentSubmits.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
-- Documents that have not been submitted yet (multiple providers). | ||
INSERT INTO es_identity_verification(id, activation_id, user_id, process_id, status, phase, timestamp_created, timestamp_last_updated) VALUES | ||
('v1', 'a1', 'u1', 'p1', 'IN_PROGRESS', 'DOCUMENT_UPLOAD', now(), now()), | ||
('v2', 'a2', 'u2', 'p2', 'IN_PROGRESS', 'DOCUMENT_UPLOAD', now(), now()); | ||
|
||
INSERT INTO es_document_verification(id, provider_name, activation_id, identity_verification_id, type, status, filename, used_for_verification, timestamp_created, timestamp_last_updated) VALUES | ||
('d1', 'foreign', 'a1', 'v1', 'ID_CARD', 'UPLOAD_IN_PROGRESS', 'f1', true, now(), now()), | ||
('d2', 'mock', 'a2', 'v2', 'ID_CARD', 'UPLOAD_IN_PROGRESS', 'f2', true, now(), now()); | ||
|
||
INSERT INTO es_document_result(id, document_verification_id, phase, timestamp_created) VALUES | ||
(1, 'd1', 'UPLOAD', now()), | ||
(2, 'd2', 'UPLOAD', now()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,8 @@ | |
import com.wultra.app.onboardingserver.common.database.entity.DocumentVerificationEntity; | ||
import com.wultra.app.enrollmentserver.model.enumeration.DocumentStatus; | ||
import com.wultra.app.enrollmentserver.model.integration.OwnerId; | ||
import com.wultra.app.onboardingserver.configuration.IdentityVerificationConfig; | ||
import lombok.AllArgsConstructor; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
@@ -37,6 +39,7 @@ | |
* @author Lukas Lukovsky, [email protected] | ||
*/ | ||
@Service | ||
@AllArgsConstructor | ||
public class DocumentProcessingBatchService { | ||
|
||
private static final Logger logger = LoggerFactory.getLogger(DocumentProcessingBatchService.class); | ||
|
@@ -45,26 +48,15 @@ public class DocumentProcessingBatchService { | |
|
||
private final DocumentProcessingService documentProcessingService; | ||
|
||
/** | ||
* Service constructor. | ||
* @param documentResultRepository Document verification result repository. | ||
* @param documentProcessingService Document processing service. | ||
*/ | ||
@Autowired | ||
public DocumentProcessingBatchService( | ||
DocumentResultRepository documentResultRepository, | ||
DocumentProcessingService documentProcessingService) { | ||
this.documentResultRepository = documentResultRepository; | ||
this.documentProcessingService = documentProcessingService; | ||
} | ||
private final IdentityVerificationConfig identityVerificationConfig; | ||
|
||
/** | ||
* Checks in progress document submits on current provider status and data result | ||
*/ | ||
@Transactional | ||
public void checkInProgressDocumentSubmits() { | ||
AtomicInteger countFinished = new AtomicInteger(0); | ||
try (Stream<DocumentResultEntity> stream = documentResultRepository.streamAllInProgressDocumentSubmits()) { | ||
try (Stream<DocumentResultEntity> stream = documentResultRepository.streamAllInProgressDocumentSubmits(identityVerificationConfig.getDocumentVerificationProvider())) { | ||
stream.forEach(docResult -> { | ||
DocumentVerificationEntity docVerification = docResult.getDocumentVerification(); | ||
final OwnerId ownerId = new OwnerId(); | ||
|
Oops, something went wrong.