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 @@ -72,6 +72,11 @@ interface ImageAnalyticsPayload {
*
*/
failedImageResubmission: boolean;

/**
* Image file name
*/
fileName?: string;
}

interface AcuantImageAnalyticsPayload extends ImageAnalyticsPayload {
Expand Down Expand Up @@ -408,8 +413,8 @@ function AcuantCapture(
source: 'upload',
size: nextValue.size,
failedImageResubmission: hasFailed,
fileName: nextValue.name,
});

trackEvent(
name === 'selfie' ? 'idv_selfie_image_added' : `IdV: ${name} image added`,
analyticsPayload,
Expand Down
47 changes: 42 additions & 5 deletions spec/forms/idv/api_image_upload_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,26 @@
let(:back_image) { DocAuthImageFixtures.document_back_image_multipart }
let(:selfie_image) { nil }
let(:liveness_checking_required) { false }
let(:front_image_file_name) { 'front.jpg' }
let(:back_image_file_name) { 'back.jpg' }
let(:selfie_image_file_name) { 'selfie.jpg' }
let(:front_image_metadata) do
{ width: 40, height: 40, mimeType: 'image/png', source: 'upload' }
{
width: 40,
height: 40,
mimeType: 'image/png',
source: 'upload',
fileName: front_image_file_name,
}
end
let(:back_image_metadata) do
{ width: 20, height: 20, mimeType: 'image/png', source: 'upload' }
{
width: 20,
height: 20,
mimeType: 'image/png',
source: 'upload',
fileName: back_image_file_name,
}
end
let(:selfie_image_metadata) { nil }
let!(:document_capture_session) { DocumentCaptureSession.create!(user: create(:user)) }
Expand Down Expand Up @@ -110,18 +125,36 @@

context 'images sourced by acuant sdk' do
let(:front_image_metadata) do
{ width: 40, height: 40, mimeType: 'image/png', source: 'acuant' }
{
width: 40,
height: 40,
mimeType: 'image/png',
source: 'acuant',
fileName: front_image_file_name,
}
end
let(:back_image_metadata) do
{ width: 20, height: 20, mimeType: 'image/png', source: 'acuant' }
{
width: 20,
height: 20,
mimeType: 'image/png',
source: 'acuant',
fileName: back_image_file_name,
}
end
it 'is valid' do
expect(form.valid?).to eq(true)
end

context 'selfie is uploaded' do
let(:selfie_image_metadata) do
{ width: 40, height: 40, mimeType: 'image/png', source: 'upload' }
{
width: 40,
height: 40,
mimeType: 'image/png',
source: 'upload',
fileName: selfie_image_file_name,
}
end
it 'is invalid' do
expect(form.valid?).to eq(false)
Expand Down Expand Up @@ -183,12 +216,14 @@
mimeType: 'image/png',
source: 'upload',
width: 20,
fileName: back_image_file_name,
},
front: {
height: 40,
mimeType: 'image/png',
source: 'upload',
width: 40,
fileName: front_image_file_name,
},
},
image_metrics: nil,
Expand Down Expand Up @@ -294,12 +329,14 @@
mimeType: 'image/png',
source: 'upload',
width: 20,
fileName: back_image_file_name,
},
front: {
height: 40,
mimeType: 'image/png',
source: 'upload',
width: 40,
fileName: front_image_file_name,
},
selfie: {
height: 10,
Expand Down