Skip to content
Merged
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 @@ -62,7 +62,13 @@ internal class ReportActionRequestEventsUseCase @Inject constructor(
verifyGuid,
metadata,
)
is ActionRequest.ConfirmIdentityActionRequest -> ConfirmationCalloutEvent(startTime, projectId, selectedGuid, sessionId)
is ActionRequest.ConfirmIdentityActionRequest -> ConfirmationCalloutEvent(
createdAt = startTime,
projectId = projectId,
selectedGuid = selectedGuid,
sessionId = sessionId,
metadata = metadata
)
is ActionRequest.EnrolLastBiometricActionRequest -> EnrolmentLastBiometricsCalloutEvent(
startTime,
projectId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ internal data class ApiCalloutPayload(
ApiConfirmationCallout(
domainPayload.selectedGuid,
domainPayload.sessionId,
domainPayload.metadata,
),
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@ import androidx.annotation.Keep
internal data class ApiConfirmationCallout(
val selectedGuid: String,
val sessionId: String,
val metadata: String?,
) : ApiCallout(ApiCalloutType.Confirmation)
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,8 @@ fun verifyCalloutConfirmationApiModel(json: JSONObject) {
assertThat(json.getString("type")).isEqualTo("Confirmation")
assertThat(json.getString("selectedGuid")).isNotNull()
assertThat(json.getString("sessionId")).isNotNull()
assertThat(json.length()).isEqualTo(3)
assertThat(json.getString("metadata")).isNotNull()
assertThat(json.length()).isEqualTo(4)
}

fun validateAlertScreenEventApiModel(json: JSONObject) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,11 @@ fun createVerificationCallbackEventV2() = VerificationCallbackEvent(
)

fun createConfirmationCalloutEvent() = ConfirmationCalloutEvent(
CREATED_AT,
DEFAULT_PROJECT_ID,
GUID1,
GUID2,
createdAt = CREATED_AT,
projectId = DEFAULT_PROJECT_ID,
selectedGuid = GUID1,
sessionId = GUID2,
metadata = DEFAULT_METADATA,
)

fun createEnrolmentCalloutEvent(projectId: String = DEFAULT_PROJECT_ID) = EnrolmentCalloutEvent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,17 @@ data class ConfirmationCalloutEvent(
projectId: String,
selectedGuid: String,
sessionId: String,
metadata: String?,
) : this(
UUID.randomUUID().toString(),
ConfirmationCalloutPayload(createdAt, EVENT_VERSION, projectId, selectedGuid, sessionId),
ConfirmationCalloutPayload(
createdAt = createdAt,
eventVersion = EVENT_VERSION,
projectId = projectId,
selectedGuid = selectedGuid,
sessionId = sessionId,
metadata = metadata
),
CALLOUT_CONFIRMATION,
)

Expand All @@ -40,6 +48,7 @@ data class ConfirmationCalloutEvent(
val projectId: String,
val selectedGuid: String,
val sessionId: String,
val metadata: String?,
override val endedAt: Timestamp? = null,
override val type: EventType = CALLOUT_CONFIRMATION,
) : EventPayload() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,13 @@ class EventPayloadTest {
createdAt = CREATED_AT,
score = CallbackComparisonScore(GUID1, 1, AppMatchConfidence.NONE),
),
ConfirmationCalloutEvent(CREATED_AT, DEFAULT_PROJECT_ID, GUID1, GUID2),
ConfirmationCalloutEvent(
createdAt = CREATED_AT,
projectId = DEFAULT_PROJECT_ID,
selectedGuid = GUID1,
sessionId = GUID2,
metadata = DEFAULT_METADATA
),
EnrolmentCalloutEvent(
createdAt = CREATED_AT,
projectId = DEFAULT_PROJECT_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import com.google.common.truth.Truth.assertThat
import com.simprints.infra.events.event.domain.models.EventType.CALLOUT_CONFIRMATION
import com.simprints.infra.events.event.domain.models.callout.ConfirmationCalloutEvent.Companion.EVENT_VERSION
import com.simprints.infra.events.sampledata.SampleDefaults.CREATED_AT
import com.simprints.infra.events.sampledata.SampleDefaults.DEFAULT_METADATA
import com.simprints.infra.events.sampledata.SampleDefaults.DEFAULT_PROJECT_ID
import com.simprints.infra.events.sampledata.SampleDefaults.GUID1
import com.simprints.infra.events.sampledata.SampleDefaults.GUID2
Expand All @@ -14,7 +15,13 @@ import org.junit.Test
class ConfirmationCalloutEventTest {
@Test
fun create_ConfirmationCalloutEvent() {
val event = ConfirmationCalloutEvent(CREATED_AT, DEFAULT_PROJECT_ID, GUID1, GUID2)
val event = ConfirmationCalloutEvent(
createdAt = CREATED_AT,
projectId = DEFAULT_PROJECT_ID,
selectedGuid = GUID1,
sessionId = GUID2,
metadata = DEFAULT_METADATA
)

assertThat(event.id).isNotNull()
assertThat(event.type).isEqualTo(CALLOUT_CONFIRMATION)
Expand All @@ -25,6 +32,7 @@ class ConfirmationCalloutEventTest {
assertThat(projectId).isEqualTo(DEFAULT_PROJECT_ID)
assertThat(selectedGuid).isEqualTo(GUID1)
assertThat(sessionId).isEqualTo(GUID2)
assertThat(metadata).isEqualTo(DEFAULT_METADATA)
}
}
}