diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/playbook/DefaultPlaybook.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/playbook/DefaultPlaybook.kt index a678e0686faa1ad1c067a43d7b140350094eb199..a8e4a0367ce5d2ea4ea5c2c57de2fd9bebca5daa 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/playbook/DefaultPlaybook.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/playbook/DefaultPlaybook.kt @@ -101,7 +101,8 @@ class DefaultPlaybook @Inject constructor( keyList = data.temporaryExposureKeys, consentToFederation = data.consentToFederation, visitedCountries = data.visitedCountries, - checkIns = data.checkIns + checkIns = data.checkIns, + submissionType = data.submissionType ) submissionServer.submitPayload(serverSubmissionData) coroutineScope.launch { followUpPlaybooks() } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/playbook/Playbook.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/playbook/Playbook.kt index b46a6dda6ad0c9bd3cf8d502a40df4ae2a6e81c7..6c62d63bdff3eff1a5e856f1d97962373430cef4 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/playbook/Playbook.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/playbook/Playbook.kt @@ -3,6 +3,7 @@ package de.rki.coronawarnapp.playbook import de.rki.coronawarnapp.coronatest.server.CoronaTestResult import de.rki.coronawarnapp.coronatest.server.VerificationKeyType import de.rki.coronawarnapp.server.protocols.external.exposurenotification.TemporaryExposureKeyExportOuterClass +import de.rki.coronawarnapp.server.protocols.internal.SubmissionPayloadOuterClass.SubmissionPayload import de.rki.coronawarnapp.server.protocols.internal.pt.CheckInOuterClass /** @@ -38,6 +39,7 @@ interface Playbook { val temporaryExposureKeys: List<TemporaryExposureKeyExportOuterClass.TemporaryExposureKey>, val consentToFederation: Boolean, val visitedCountries: List<String>, - val checkIns: List<CheckInOuterClass.CheckIn> + val checkIns: List<CheckInOuterClass.CheckIn>, + val submissionType: SubmissionPayload.SubmissionType ) } diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/server/SubmissionServer.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/server/SubmissionServer.kt index 7cebbdf7c47da0a05826031335945fb6d012a86e..659420754555dd7db17772ec8ce2f9f66b3966f2 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/server/SubmissionServer.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/server/SubmissionServer.kt @@ -30,7 +30,8 @@ class SubmissionServer @Inject constructor( val keyList: List<TemporaryExposureKey>, val consentToFederation: Boolean, val visitedCountries: List<String>, - val checkIns: List<CheckInOuterClass.CheckIn> + val checkIns: List<CheckInOuterClass.CheckIn>, + val submissionType: SubmissionPayload.SubmissionType ) suspend fun submitPayload( @@ -69,6 +70,7 @@ class SubmissionServer @Inject constructor( .setConsentToFederation(data.consentToFederation) .addAllVisitedCountries(data.visitedCountries) .addAllCheckIns(data.checkIns) + .setSubmissionType(data.submissionType) .build() api.submitPayload( diff --git a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/task/SubmissionTask.kt b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/task/SubmissionTask.kt index 85f17678359c8ef09b11ae6427017d2ff3c819a6..d95c9e4ad988c3f3c98bca38667d247a194a8c9d 100644 --- a/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/task/SubmissionTask.kt +++ b/Corona-Warn-App/src/main/java/de/rki/coronawarnapp/submission/task/SubmissionTask.kt @@ -12,6 +12,7 @@ import de.rki.coronawarnapp.playbook.Playbook import de.rki.coronawarnapp.presencetracing.checkins.CheckInRepository import de.rki.coronawarnapp.presencetracing.checkins.CheckInsTransformer import de.rki.coronawarnapp.presencetracing.checkins.common.completedCheckIns +import de.rki.coronawarnapp.server.protocols.internal.SubmissionPayloadOuterClass.SubmissionPayload.SubmissionType import de.rki.coronawarnapp.submission.SubmissionSettings import de.rki.coronawarnapp.submission.Symptoms import de.rki.coronawarnapp.submission.auto.AutoSubmission @@ -162,7 +163,8 @@ class SubmissionTask @Inject constructor( temporaryExposureKeys = transformedKeys, consentToFederation = true, visitedCountries = getSupportedCountries(), - checkIns = transformedCheckIns + checkIns = transformedCheckIns, + submissionType = coronaTest.type.toSubmissionType() ) checkCancel() @@ -260,3 +262,8 @@ class SubmissionTask @Inject constructor( private const val TAG: String = "SubmissionTask" } } + +private fun CoronaTest.Type.toSubmissionType() = when (this) { + CoronaTest.Type.PCR -> SubmissionType.SUBMISSION_TYPE_PCR_TEST + CoronaTest.Type.RAPID_ANTIGEN -> SubmissionType.SUBMISSION_TYPE_RAPID_TEST +} diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/http/playbook/DefaultPlaybookTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/http/playbook/DefaultPlaybookTest.kt index cdd16544d8379ca907355ca249c0bf964f5b3875..a53afe27f038d67591615b4e90e9765cc6f99c4e 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/http/playbook/DefaultPlaybookTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/http/playbook/DefaultPlaybookTest.kt @@ -7,6 +7,7 @@ import de.rki.coronawarnapp.exception.TanPairingException import de.rki.coronawarnapp.exception.http.BadRequestException import de.rki.coronawarnapp.playbook.DefaultPlaybook import de.rki.coronawarnapp.playbook.Playbook +import de.rki.coronawarnapp.server.protocols.internal.SubmissionPayloadOuterClass.SubmissionPayload.SubmissionType import de.rki.coronawarnapp.submission.server.SubmissionServer import io.kotest.assertions.throwables.shouldThrow import io.kotest.matchers.shouldBe @@ -87,7 +88,8 @@ class DefaultPlaybookTest : BaseTest() { temporaryExposureKeys = listOf(), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) ) @@ -109,7 +111,8 @@ class DefaultPlaybookTest : BaseTest() { temporaryExposureKeys = listOf(), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) ) } catch (e: Exception) { @@ -129,7 +132,8 @@ class DefaultPlaybookTest : BaseTest() { temporaryExposureKeys = listOf(), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) ) } catch (e: Exception) { @@ -150,7 +154,8 @@ class DefaultPlaybookTest : BaseTest() { temporaryExposureKeys = listOf(), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) ) } @@ -263,7 +268,8 @@ class DefaultPlaybookTest : BaseTest() { temporaryExposureKeys = listOf(), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) ) } diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/submission/server/SubmissionServerTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/submission/server/SubmissionServerTest.kt index d20cb37bafa6ce162736c4f25282fe36d7a7b820..c2a1da1429564077b46aa0a842109d70ab969a47 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/submission/server/SubmissionServerTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/submission/server/SubmissionServerTest.kt @@ -9,6 +9,7 @@ import de.rki.coronawarnapp.appconfig.PresenceTracingConfigContainer import de.rki.coronawarnapp.http.HttpModule import de.rki.coronawarnapp.server.protocols.external.exposurenotification.TemporaryExposureKeyExportOuterClass import de.rki.coronawarnapp.server.protocols.internal.SubmissionPayloadOuterClass +import de.rki.coronawarnapp.server.protocols.internal.SubmissionPayloadOuterClass.SubmissionPayload.SubmissionType import de.rki.coronawarnapp.server.protocols.internal.pt.CheckInOuterClass import de.rki.coronawarnapp.server.protocols.internal.v2.PresenceTracingParametersOuterClass.PresenceTracingPlausibleDeniabilityParameters.NumberOfFakeCheckInsFunctionParameters import de.rki.coronawarnapp.server.protocols.internal.v2.RiskCalculationParametersOuterClass @@ -105,7 +106,8 @@ class SubmissionServerTest : BaseTest() { keyList = listOf(googleKeyList), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = listOf(checkIn) + checkIns = listOf(checkIn), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) server.submitPayload(submissionData) @@ -174,7 +176,8 @@ class SubmissionServerTest : BaseTest() { keyList = listOf(googleKeyList), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = listOf(checkIn) + checkIns = listOf(checkIn), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) server.submitPayload(submissionData) @@ -236,7 +239,8 @@ class SubmissionServerTest : BaseTest() { keyList = listOf(googleKeyList), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) webServer.enqueue(MockResponse().setBody("{}")) server.submitPayload(submissionData) diff --git a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/submission/task/SubmissionTaskTest.kt b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/submission/task/SubmissionTaskTest.kt index db488d6baf44c6e360b26e399cced531bfa15238..81300aaa5438d57928007af973011618fa347232 100644 --- a/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/submission/task/SubmissionTaskTest.kt +++ b/Corona-Warn-App/src/test/java/de/rki/coronawarnapp/submission/task/SubmissionTaskTest.kt @@ -13,6 +13,7 @@ import de.rki.coronawarnapp.presencetracing.checkins.CheckIn import de.rki.coronawarnapp.presencetracing.checkins.CheckInRepository import de.rki.coronawarnapp.presencetracing.checkins.CheckInsTransformer import de.rki.coronawarnapp.server.protocols.external.exposurenotification.TemporaryExposureKeyExportOuterClass +import de.rki.coronawarnapp.server.protocols.internal.SubmissionPayloadOuterClass.SubmissionPayload.SubmissionType import de.rki.coronawarnapp.submission.SubmissionSettings import de.rki.coronawarnapp.submission.Symptoms import de.rki.coronawarnapp.submission.auto.AutoSubmission @@ -83,6 +84,7 @@ class SubmissionTaskTest : BaseTest() { every { isSubmitted } returns false every { registrationToken } returns "regtoken" every { identifier } returns "coronatest-identifier" + every { type } returns CoronaTest.Type.PCR } ) ) @@ -216,7 +218,8 @@ class SubmissionTaskTest : BaseTest() { temporaryExposureKeys = listOf(transformedKey), consentToFederation = true, visitedCountries = listOf("NL"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) ) @@ -283,7 +286,8 @@ class SubmissionTaskTest : BaseTest() { temporaryExposureKeys = listOf(transformedKey), consentToFederation = true, visitedCountries = listOf("NL"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) ) } @@ -327,7 +331,8 @@ class SubmissionTaskTest : BaseTest() { temporaryExposureKeys = listOf(transformedKey), consentToFederation = true, visitedCountries = listOf("DE"), - checkIns = emptyList() + checkIns = emptyList(), + submissionType = SubmissionType.SUBMISSION_TYPE_PCR_TEST ) ) }