onfido 2.8.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -4
- data/Gemfile +5 -4
- data/LICENSE +5 -7
- data/README.md +69 -51
- data/Rakefile +10 -0
- data/lib/onfido/api/default_api.rb +4233 -0
- data/lib/onfido/api_client.rb +431 -0
- data/lib/onfido/api_error.rb +58 -0
- data/lib/onfido/configuration.rb +420 -0
- data/lib/onfido/models/address.rb +422 -0
- data/lib/onfido/models/address_builder.rb +422 -0
- data/lib/onfido/models/address_shared.rb +415 -0
- data/lib/onfido/models/addresses_list.rb +216 -0
- data/lib/onfido/models/applicant.rb +390 -0
- data/lib/onfido/models/applicant_builder.rb +358 -0
- data/lib/onfido/models/applicant_create.rb +281 -0
- data/lib/onfido/models/applicant_request.rb +232 -0
- data/lib/onfido/models/applicant_response.rb +341 -0
- data/lib/onfido/models/applicant_shared.rb +246 -0
- data/lib/onfido/models/applicant_update.rb +267 -0
- data/lib/onfido/models/applicant_updater.rb +344 -0
- data/lib/onfido/models/applicants_list.rb +223 -0
- data/lib/onfido/models/check.rb +419 -0
- data/lib/onfido/models/check_builder.rb +360 -0
- data/lib/onfido/models/check_request.rb +301 -0
- data/lib/onfido/models/check_response.rb +350 -0
- data/lib/onfido/models/check_shared.rb +266 -0
- data/lib/onfido/models/checks_list.rb +223 -0
- data/lib/onfido/models/complete_task_builder.rb +221 -0
- data/lib/onfido/models/complete_task_data_builder.rb +106 -0
- data/lib/onfido/models/consent_item.rb +272 -0
- data/lib/onfido/models/consents_builder.rb +205 -0
- data/lib/onfido/models/country_codes.rb +289 -0
- data/lib/onfido/models/device_intelligence_breakdown.rb +223 -0
- data/lib/onfido/models/device_intelligence_breakdown_breakdown.rb +214 -0
- data/lib/onfido/models/device_intelligence_breakdown_breakdown_device.rb +215 -0
- data/lib/onfido/models/device_intelligence_breakdown_breakdown_device_breakdown.rb +232 -0
- data/lib/onfido/models/device_intelligence_breakdown_properties.rb +232 -0
- data/lib/onfido/models/device_intelligence_breakdown_properties_device.rb +468 -0
- data/lib/onfido/models/device_intelligence_breakdown_properties_geolocation.rb +257 -0
- data/lib/onfido/models/device_intelligence_breakdown_properties_ip.rb +245 -0
- data/lib/onfido/models/device_intelligence_report.rb +345 -0
- data/lib/onfido/models/document.rb +376 -0
- data/lib/onfido/models/document_breakdown.rb +286 -0
- data/lib/onfido/models/document_breakdown_age_validation.rb +224 -0
- data/lib/onfido/models/document_breakdown_age_validation_breakdown.rb +214 -0
- data/lib/onfido/models/document_breakdown_compromised_document.rb +224 -0
- data/lib/onfido/models/document_breakdown_compromised_document_breakdown.rb +223 -0
- data/lib/onfido/models/document_breakdown_data_comparison.rb +224 -0
- data/lib/onfido/models/document_breakdown_data_comparison_breakdown.rb +277 -0
- data/lib/onfido/models/document_breakdown_data_comparison_breakdown_issuing_country.rb +223 -0
- data/lib/onfido/models/document_breakdown_data_consistency.rb +224 -0
- data/lib/onfido/models/document_breakdown_data_consistency_breakdown.rb +295 -0
- data/lib/onfido/models/document_breakdown_data_validation.rb +224 -0
- data/lib/onfido/models/document_breakdown_data_validation_breakdown.rb +268 -0
- data/lib/onfido/models/document_breakdown_data_validation_breakdown_document_expiration.rb +224 -0
- data/lib/onfido/models/document_breakdown_data_validation_breakdown_expiry_date.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown.rb +241 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown_colour_picture.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown_conclusive_document_quality.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown_image_quality.rb +224 -0
- data/lib/onfido/models/document_breakdown_image_integrity_breakdown_supported_document.rb +224 -0
- data/lib/onfido/models/document_breakdown_issuing_authority.rb +224 -0
- data/lib/onfido/models/document_breakdown_issuing_authority_breakdown.rb +223 -0
- data/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_active_authentication.rb +224 -0
- data/lib/onfido/models/document_breakdown_issuing_authority_breakdown_nfc_passive_authentication.rb +224 -0
- data/lib/onfido/models/document_breakdown_police_record.rb +215 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown.rb +277 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_digital_tampering.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_face_detection.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_fonts.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_original_document_present.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_other.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_picture_face_integrity.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_security_features.rb +224 -0
- data/lib/onfido/models/document_breakdown_visual_authenticity_breakdown_template.rb +224 -0
- data/lib/onfido/models/document_cdq_reasons.rb +285 -0
- data/lib/onfido/models/document_iq_reasons.rb +305 -0
- data/lib/onfido/models/document_odp_reasons.rb +245 -0
- data/lib/onfido/models/document_properties.rb +461 -0
- data/lib/onfido/models/document_properties_address_lines.rb +259 -0
- data/lib/onfido/models/document_properties_barcode_inner.rb +367 -0
- data/lib/onfido/models/document_properties_document_classification.rb +232 -0
- data/lib/onfido/models/document_properties_document_numbers_inner.rb +223 -0
- data/lib/onfido/models/document_properties_driving_licence_information.rb +241 -0
- data/lib/onfido/models/document_properties_extracted_data.rb +394 -0
- data/lib/onfido/models/document_properties_nfc.rb +322 -0
- data/lib/onfido/models/document_report.rb +354 -0
- data/lib/onfido/models/document_response.rb +272 -0
- data/lib/onfido/models/document_shared.rb +301 -0
- data/lib/onfido/models/document_types.rb +64 -0
- data/lib/onfido/models/document_video_report.rb +354 -0
- data/lib/onfido/models/document_video_with_address_information_report.rb +354 -0
- data/lib/onfido/models/document_with_address_information_report.rb +354 -0
- data/lib/onfido/models/document_with_driver_verification_report.rb +354 -0
- data/lib/onfido/models/document_with_driver_verification_report_all_of_properties.rb +529 -0
- data/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_passenger_vehicle.rb +236 -0
- data/lib/onfido/models/document_with_driver_verification_report_all_of_properties_all_of_vehicle_class_details_inner.rb +245 -0
- data/lib/onfido/models/document_with_driving_licence_information_report.rb +354 -0
- data/lib/onfido/models/documents_list.rb +223 -0
- data/lib/onfido/models/error.rb +214 -0
- data/lib/onfido/models/error1.rb +224 -0
- data/lib/onfido/models/error_properties.rb +234 -0
- data/lib/onfido/models/error_properties1.rb +223 -0
- data/lib/onfido/models/extract_request.rb +222 -0
- data/lib/onfido/models/extraction.rb +233 -0
- data/lib/onfido/models/extraction_document_classification.rb +289 -0
- data/lib/onfido/models/extraction_extracted_data.rb +530 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown.rb +232 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_face_comparison.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_motion_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
- data/lib/onfido/models/facial_similarity_motion_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_motion_report.rb +354 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown.rb +232 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown.rb +214 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_face_comparison_breakdown_face_match_properties.rb +225 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown.rb +214 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_breakdown_visual_authenticity_breakdown_spoofing_detection_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown.rb +232 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_photo_fully_auto_report.rb +354 -0
- data/lib/onfido/models/facial_similarity_photo_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_photo_report.rb +354 -0
- data/lib/onfido/models/facial_similarity_video_breakdown.rb +232 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_face_comparison.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_face_detected.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_image_integrity_breakdown_source_integrity.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown.rb +223 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_liveness_detected.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_breakdown_visual_authenticity_breakdown_spoofing_detection.rb +224 -0
- data/lib/onfido/models/facial_similarity_video_properties.rb +215 -0
- data/lib/onfido/models/facial_similarity_video_report.rb +354 -0
- data/lib/onfido/models/id_number.rb +269 -0
- data/lib/onfido/models/id_photo.rb +289 -0
- data/lib/onfido/models/id_photo_response.rb +282 -0
- data/lib/onfido/models/id_photos_list.rb +223 -0
- data/lib/onfido/models/identity_enhanced_breakdown.rb +241 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown.rb +232 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_credit_agencies_properties.rb +214 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_telephone_database.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_address_breakdown_voting_register.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown.rb +223 -0
- data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_credit_agencies.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_date_of_birth_breakdown_voting_register.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_mortality.rb +215 -0
- data/lib/onfido/models/identity_enhanced_breakdown_sources.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown.rb +214 -0
- data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources.rb +224 -0
- data/lib/onfido/models/identity_enhanced_breakdown_sources_breakdown_total_sources_properties.rb +214 -0
- data/lib/onfido/models/identity_enhanced_properties.rb +227 -0
- data/lib/onfido/models/identity_enhanced_properties_matched_addresses_inner.rb +227 -0
- data/lib/onfido/models/identity_enhanced_report.rb +354 -0
- data/lib/onfido/models/india_pan_report.rb +354 -0
- data/lib/onfido/models/india_pan_report_all_of_breakdown.rb +214 -0
- data/lib/onfido/models/india_pan_report_all_of_breakdown_device.rb +214 -0
- data/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown.rb +223 -0
- data/lib/onfido/models/india_pan_report_all_of_breakdown_device_breakdown_pan_valid.rb +214 -0
- data/lib/onfido/models/india_pan_report_all_of_properties.rb +214 -0
- data/lib/onfido/models/india_pan_report_all_of_properties_device.rb +225 -0
- data/lib/onfido/models/known_faces_breakdown.rb +223 -0
- data/lib/onfido/models/known_faces_breakdown_image_integrity.rb +215 -0
- data/lib/onfido/models/known_faces_breakdown_previously_seen_faces.rb +215 -0
- data/lib/onfido/models/known_faces_properties.rb +217 -0
- data/lib/onfido/models/known_faces_properties_matches_inner.rb +255 -0
- data/lib/onfido/models/known_faces_report.rb +354 -0
- data/lib/onfido/models/live_photo.rb +289 -0
- data/lib/onfido/models/live_photo_response.rb +282 -0
- data/lib/onfido/models/live_photos_list.rb +223 -0
- data/lib/onfido/models/live_video.rb +287 -0
- data/lib/onfido/models/live_videos_list.rb +223 -0
- data/lib/onfido/models/location.rb +254 -0
- data/lib/onfido/models/location_builder.rb +254 -0
- data/lib/onfido/models/location_shared.rb +247 -0
- data/lib/onfido/models/motion_capture.rb +275 -0
- data/lib/onfido/models/motion_captures_list.rb +223 -0
- data/lib/onfido/models/photo_auto_reasons.rb +255 -0
- data/lib/onfido/models/photo_reasons.rb +255 -0
- data/lib/onfido/models/proof_of_address_breakdown.rb +232 -0
- data/lib/onfido/models/proof_of_address_breakdown_data_comparison.rb +224 -0
- data/lib/onfido/models/proof_of_address_breakdown_data_comparison_breakdown.rb +232 -0
- data/lib/onfido/models/proof_of_address_breakdown_document_classification.rb +224 -0
- data/lib/onfido/models/proof_of_address_breakdown_document_classification_breakdown.rb +214 -0
- data/lib/onfido/models/proof_of_address_breakdown_image_integrity.rb +224 -0
- data/lib/onfido/models/proof_of_address_breakdown_image_integrity_breakdown.rb +214 -0
- data/lib/onfido/models/proof_of_address_properties.rb +319 -0
- data/lib/onfido/models/proof_of_address_report.rb +354 -0
- data/lib/onfido/models/repeat_attempts_list.rb +292 -0
- data/lib/onfido/models/repeat_attempts_list_repeat_attempts_inner.rb +333 -0
- data/lib/onfido/models/report.rb +93 -0
- data/lib/onfido/models/report_document.rb +222 -0
- data/lib/onfido/models/report_name.rb +60 -0
- data/lib/onfido/models/report_result.rb +42 -0
- data/lib/onfido/models/report_shared.rb +329 -0
- data/lib/onfido/models/report_status.rb +44 -0
- data/lib/onfido/models/report_sub_result.rb +43 -0
- data/lib/onfido/models/reports_list.rb +223 -0
- data/lib/onfido/models/results_feedback.rb +279 -0
- data/lib/onfido/models/sdk_token.rb +229 -0
- data/lib/onfido/models/sdk_token_builder.rb +259 -0
- data/lib/onfido/models/sdk_token_request.rb +252 -0
- data/lib/onfido/models/sdk_token_response.rb +222 -0
- data/lib/onfido/models/task.rb +329 -0
- data/lib/onfido/models/task_item.rb +287 -0
- data/lib/onfido/models/timeline_file_reference.rb +239 -0
- data/lib/onfido/models/us_driving_licence_breakdown.rb +232 -0
- data/lib/onfido/models/us_driving_licence_breakdown_address.rb +224 -0
- data/lib/onfido/models/us_driving_licence_breakdown_address_breakdown.rb +259 -0
- data/lib/onfido/models/us_driving_licence_breakdown_document.rb +224 -0
- data/lib/onfido/models/us_driving_licence_breakdown_document_breakdown.rb +241 -0
- data/lib/onfido/models/us_driving_licence_breakdown_personal.rb +224 -0
- data/lib/onfido/models/us_driving_licence_breakdown_personal_breakdown.rb +322 -0
- data/lib/onfido/models/us_driving_licence_builder.rb +505 -0
- data/lib/onfido/models/us_driving_licence_report.rb +354 -0
- data/lib/onfido/models/us_driving_licence_shared.rb +499 -0
- data/lib/onfido/models/video_reasons.rb +245 -0
- data/lib/onfido/models/watchlist_aml_breakdown.rb +241 -0
- data/lib/onfido/models/watchlist_aml_breakdown_adverse_media.rb +215 -0
- data/lib/onfido/models/watchlist_aml_breakdown_legal_and_regulatory_warnings.rb +215 -0
- data/lib/onfido/models/watchlist_aml_breakdown_politically_exposed_person.rb +215 -0
- data/lib/onfido/models/watchlist_aml_breakdown_sanction.rb +215 -0
- data/lib/onfido/models/watchlist_aml_properties.rb +217 -0
- data/lib/onfido/models/watchlist_aml_report.rb +354 -0
- data/lib/onfido/models/watchlist_enhanced_breakdown.rb +241 -0
- data/lib/onfido/models/watchlist_enhanced_properties.rb +217 -0
- data/lib/onfido/models/watchlist_enhanced_report.rb +354 -0
- data/lib/onfido/models/watchlist_monitor.rb +342 -0
- data/lib/onfido/models/watchlist_monitor_builder.rb +292 -0
- data/lib/onfido/models/watchlist_monitor_match.rb +225 -0
- data/lib/onfido/models/watchlist_monitor_matches_list.rb +223 -0
- data/lib/onfido/models/watchlist_monitor_matches_updater.rb +227 -0
- data/lib/onfido/models/watchlist_monitor_response.rb +254 -0
- data/lib/onfido/models/watchlist_monitor_shared.rb +285 -0
- data/lib/onfido/models/watchlist_monitors_list.rb +223 -0
- data/lib/onfido/models/watchlist_peps_only_report.rb +354 -0
- data/lib/onfido/models/watchlist_sanctions_only_report.rb +354 -0
- data/lib/onfido/models/watchlist_standard_breakdown.rb +232 -0
- data/lib/onfido/models/watchlist_standard_properties.rb +217 -0
- data/lib/onfido/models/watchlist_standard_report.rb +354 -0
- data/lib/onfido/models/webhook.rb +304 -0
- data/lib/onfido/models/webhook_builder.rb +274 -0
- data/lib/onfido/models/webhook_create.rb +222 -0
- data/lib/onfido/models/webhook_event.rb +214 -0
- data/lib/onfido/models/webhook_event_payload.rb +273 -0
- data/lib/onfido/models/webhook_event_payload_object.rb +260 -0
- data/lib/onfido/models/webhook_event_type.rb +56 -0
- data/lib/onfido/models/webhook_resend.rb +216 -0
- data/lib/onfido/models/webhook_response.rb +252 -0
- data/lib/onfido/models/webhook_shared.rb +249 -0
- data/lib/onfido/models/webhook_update.rb +215 -0
- data/lib/onfido/models/webhook_updater.rb +267 -0
- data/lib/onfido/models/webhooks_list.rb +223 -0
- data/lib/onfido/models/webhooks_resend_item.rb +261 -0
- data/lib/onfido/models/workflow_run.rb +416 -0
- data/lib/onfido/models/workflow_run_builder.rb +316 -0
- data/lib/onfido/models/workflow_run_request.rb +217 -0
- data/lib/onfido/models/workflow_run_response.rb +317 -0
- data/lib/onfido/models/workflow_run_response_error.rb +226 -0
- data/lib/onfido/models/workflow_run_shared.rb +296 -0
- data/lib/onfido/models/workflow_run_shared_link.rb +290 -0
- data/lib/onfido/version.rb +12 -2
- data/lib/onfido/webhook_event_verifier.rb +20 -0
- data/lib/onfido.rb +309 -25
- data/onfido.gemspec +42 -33
- data/spec/integrations/address_picker_spec.rb +16 -0
- data/spec/integrations/applicant_spec.rb +73 -95
- data/spec/integrations/check_spec.rb +60 -41
- data/spec/integrations/document_spec.rb +28 -57
- data/spec/integrations/extraction_spec.rb +27 -12
- data/spec/integrations/id_photo_spec.rb +55 -0
- data/spec/integrations/live_photo_spec.rb +28 -45
- data/spec/integrations/live_video_spec.rb +33 -19
- data/spec/integrations/media/sample_driving_licence.png +0 -0
- data/spec/integrations/media/sample_photo.png +0 -0
- data/spec/integrations/motion_capture_spec.rb +30 -24
- data/spec/integrations/report_schema_spec.rb +45 -0
- data/spec/integrations/report_spec.rb +34 -25
- data/spec/integrations/sdk_token_spec.rb +12 -10
- data/spec/integrations/tasks_spec.rb +45 -0
- data/spec/integrations/watchlist_monitor_spec.rb +73 -0
- data/spec/integrations/webhook_spec.rb +40 -88
- data/spec/integrations/workflow_run_output_spec.rb +117 -0
- data/spec/integrations/workflow_run_spec.rb +67 -29
- data/spec/shared_contexts/with_applicant.rb +24 -0
- data/spec/shared_contexts/with_check.rb +18 -0
- data/spec/shared_contexts/with_document.rb +13 -0
- data/spec/shared_contexts/with_live_photo.rb +18 -0
- data/spec/shared_contexts/with_onfido.rb +14 -0
- data/spec/shared_contexts/with_workflow_run.rb +19 -0
- data/spec/spec_helper.rb +73 -11
- data/spec/webhook_event_verifier_spec.rb +29 -0
- metadata +367 -155
- data/.github/workflows/gem-push.yml +0 -31
- data/.github/workflows/ruby.yml +0 -25
- data/.gitignore +0 -19
- data/.rspec +0 -2
- data/.rubocop.yml +0 -13
- data/lib/onfido/api.rb +0 -65
- data/lib/onfido/errors/connection_error.rb +0 -6
- data/lib/onfido/errors/onfido_error.rb +0 -30
- data/lib/onfido/errors/request_error.rb +0 -6
- data/lib/onfido/errors/server_error.rb +0 -6
- data/lib/onfido/options.rb +0 -38
- data/lib/onfido/resource.rb +0 -153
- data/lib/onfido/resources/address.rb +0 -9
- data/lib/onfido/resources/applicant.rb +0 -29
- data/lib/onfido/resources/check.rb +0 -28
- data/lib/onfido/resources/document.rb +0 -28
- data/lib/onfido/resources/extraction.rb +0 -11
- data/lib/onfido/resources/live_photo.rb +0 -27
- data/lib/onfido/resources/live_video.rb +0 -17
- data/lib/onfido/resources/monitor.rb +0 -32
- data/lib/onfido/resources/motion_capture.rb +0 -21
- data/lib/onfido/resources/report.rb +0 -21
- data/lib/onfido/resources/sdk_token.rb +0 -10
- data/lib/onfido/resources/webhook.rb +0 -40
- data/lib/onfido/resources/workflow_run.rb +0 -17
- data/spec/integrations/address_spec.rb +0 -13
- data/spec/integrations/monitor_spec.rb +0 -100
- data/spec/integrations/resource_spec.rb +0 -106
- data/spec/onfido/api_spec.rb +0 -22
- data/spec/onfido/connection_error_spec.rb +0 -20
- data/spec/onfido/options_spec.rb +0 -39
- data/spec/onfido/request_error_spec.rb +0 -36
- data/spec/support/fake_onfido_api.rb +0 -283
- data/spec/support/fixtures/4xx_response.json +0 -14
- data/spec/support/fixtures/addresses.json +0 -24
- data/spec/support/fixtures/applicant.json +0 -28
- data/spec/support/fixtures/applicants.json +0 -12
- data/spec/support/fixtures/check.json +0 -12
- data/spec/support/fixtures/checks.json +0 -16
- data/spec/support/fixtures/document.json +0 -10
- data/spec/support/fixtures/documents.json +0 -23
- data/spec/support/fixtures/extraction.json +0 -23
- data/spec/support/fixtures/live_photo.json +0 -9
- data/spec/support/fixtures/live_photos.json +0 -22
- data/spec/support/fixtures/live_video.json +0 -23
- data/spec/support/fixtures/live_videos.json +0 -27
- data/spec/support/fixtures/monitor.json +0 -8
- data/spec/support/fixtures/monitor_matches.json +0 -12
- data/spec/support/fixtures/monitors.json +0 -12
- data/spec/support/fixtures/motion_capture.json +0 -9
- data/spec/support/fixtures/motion_captures.json +0 -13
- data/spec/support/fixtures/not_scheduled_for_deletion_error.json +0 -7
- data/spec/support/fixtures/report.json +0 -10
- data/spec/support/fixtures/reports.json +0 -24
- data/spec/support/fixtures/sdk_token.json +0 -3
- data/spec/support/fixtures/unexpected_error_format.json +0 -3
- data/spec/support/fixtures/webhook.json +0 -14
- data/spec/support/fixtures/webhooks.json +0 -31
- data/spec/support/fixtures/workflow_run.json +0 -20
- data/spec/support/fixtures/workflow_runs.json +0 -42
@@ -1,41 +1,50 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
include_context 'fake onfido api'
|
5
|
-
|
6
|
-
subject(:report) { onfido.report }
|
3
|
+
require_relative '../shared_contexts/with_check'
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
response = report.find(report_id)
|
5
|
+
describe Onfido::Report do
|
6
|
+
describe 'Report' do
|
7
|
+
include_context 'with check'
|
12
8
|
|
13
|
-
|
9
|
+
let(:sorted_reports) do
|
10
|
+
sort_reports(onfido_api.list_reports(check.id).reports)
|
14
11
|
end
|
15
|
-
|
12
|
+
let(:document_report_id) { sorted_reports[0].id }
|
13
|
+
let(:identity_report_id) { sorted_reports[1].id }
|
16
14
|
|
17
|
-
describe '#all' do
|
18
|
-
it 'lists all reports for an existing check' do
|
19
|
-
check_id = '8546921-123123-123123'
|
20
|
-
response = report.all(check_id)
|
21
15
|
|
22
|
-
|
16
|
+
def sort_reports(reports_list)
|
17
|
+
reports_list.sort_by { |report| report.name }
|
23
18
|
end
|
24
|
-
end
|
25
19
|
|
26
|
-
|
27
|
-
|
28
|
-
|
20
|
+
it 'lists reports' do
|
21
|
+
expect(sorted_reports[0].name).to eq Onfido::ReportName::DOCUMENT
|
22
|
+
expect(sorted_reports[1].name).to eq Onfido::ReportName::IDENTITY_ENHANCED
|
23
|
+
end
|
29
24
|
|
30
|
-
|
25
|
+
it 'finds a report' do
|
26
|
+
get_document_report = onfido_api.find_report(document_report_id)
|
27
|
+
get_identity_report = onfido_api.find_report(identity_report_id)
|
28
|
+
|
29
|
+
expect(get_document_report).to be_an_instance_of Onfido::DocumentReport
|
30
|
+
expect(get_document_report.id).to eq document_report_id
|
31
|
+
expect(get_document_report.name).to eq Onfido::ReportName::DOCUMENT
|
32
|
+
expect(get_document_report.status).to eq Onfido::ReportStatus::AWAITING_DATA
|
33
|
+
|
34
|
+
expect(get_identity_report).to be_an_instance_of Onfido::IdentityEnhancedReport
|
35
|
+
expect(get_identity_report.id).to eq identity_report_id
|
36
|
+
expect(get_identity_report.name).to eq Onfido::ReportName::IDENTITY_ENHANCED
|
37
|
+
expect(get_identity_report.status).to eq Onfido::ReportStatus::COMPLETE
|
38
|
+
expect(get_identity_report.breakdown.date_of_birth).to be_nil
|
39
|
+
expect(get_identity_report.breakdown.address).to be_nil
|
31
40
|
end
|
32
|
-
end
|
33
41
|
|
34
|
-
|
35
|
-
|
36
|
-
|
42
|
+
it 'resumes a report' do
|
43
|
+
onfido_api.resume_report(document_report_id)
|
44
|
+
end
|
37
45
|
|
38
|
-
|
46
|
+
it 'cancels a report' do
|
47
|
+
onfido_api.cancel_report(document_report_id)
|
39
48
|
end
|
40
49
|
end
|
41
50
|
end
|
@@ -1,18 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
include_context 'fake onfido api'
|
5
|
-
|
6
|
-
subject(:sdk_token) { onfido.sdk_token }
|
3
|
+
require_relative '../shared_contexts/with_applicant'
|
7
4
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
referrer = 'http://*.mywebsite.com/*'
|
5
|
+
describe Onfido::SdkToken do
|
6
|
+
describe 'SDK token' do
|
7
|
+
include_context 'with applicant'
|
12
8
|
|
13
|
-
|
9
|
+
it 'generates a SDK token' do
|
10
|
+
token_builder = Onfido::SdkTokenBuilder.new({
|
11
|
+
applicant_id: applicant_id,
|
12
|
+
referrer: 'https://*.example.com/example_page/*',
|
13
|
+
})
|
14
|
+
token = onfido_api.generate_sdk_token(token_builder)
|
14
15
|
|
15
|
-
expect(
|
16
|
+
expect(token).to be_an_instance_of Onfido::SdkToken
|
17
|
+
expect(token.token.size).to be > 0
|
16
18
|
end
|
17
19
|
end
|
18
20
|
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../shared_contexts/with_workflow_run'
|
4
|
+
|
5
|
+
describe Onfido::Task do
|
6
|
+
describe 'Tasks' do
|
7
|
+
include_context 'with workflow run'
|
8
|
+
|
9
|
+
it 'lists tasks' do
|
10
|
+
list_of_tasks = onfido_api.list_tasks(workflow_run_id)
|
11
|
+
|
12
|
+
expect(list_of_tasks).to_not be_nil
|
13
|
+
expect(list_of_tasks[0]).to be_an_instance_of Onfido::TaskItem
|
14
|
+
expect(list_of_tasks.size).to eq 2
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'finds a task' do
|
18
|
+
task = onfido_api.list_tasks(workflow_run_id)[0]
|
19
|
+
get_task = onfido_api.find_task(workflow_run_id, task.id)
|
20
|
+
|
21
|
+
expect(get_task).to_not be_nil
|
22
|
+
expect(get_task).to be_an_instance_of Onfido::Task
|
23
|
+
expect(get_task.id).to eq task.id
|
24
|
+
expect(get_task.task_def_id).to eq task.task_def_id
|
25
|
+
end
|
26
|
+
|
27
|
+
it 'completes a task' do
|
28
|
+
tasks = onfido_api.list_tasks(workflow_run_id)
|
29
|
+
profile_data_task_id = (tasks.select { |task| task.id.include? 'profile' })[0].id
|
30
|
+
|
31
|
+
complete_task_builder = Onfido::CompleteTaskBuilder.new({
|
32
|
+
data: Onfido::CompleteTaskDataBuilder.build({
|
33
|
+
first_name: 'Jane',
|
34
|
+
last_name: 'Doe',
|
35
|
+
})
|
36
|
+
})
|
37
|
+
|
38
|
+
onfido_api.complete_task(workflow_run_id, profile_data_task_id, complete_task_builder)
|
39
|
+
task_outputs = onfido_api.find_task(workflow_run_id, profile_data_task_id).output
|
40
|
+
|
41
|
+
expect(task_outputs[:first_name]).to eq 'Jane'
|
42
|
+
expect(task_outputs[:last_name]).to eq 'Doe'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../shared_contexts/with_applicant'
|
4
|
+
|
5
|
+
describe Onfido::WatchlistMonitor do
|
6
|
+
describe 'Watchlist monitor' do
|
7
|
+
include_context 'with applicant'
|
8
|
+
|
9
|
+
let(:watchlist_monitor_builder) do
|
10
|
+
Onfido::WatchlistMonitorBuilder.new({
|
11
|
+
applicant_id: applicant_id,
|
12
|
+
report_name: Onfido::ReportName::WATCHLIST_STANDARD
|
13
|
+
})
|
14
|
+
end
|
15
|
+
let(:watchlist_monitor) do
|
16
|
+
onfido_api.create_watchlist_monitor(watchlist_monitor_builder)
|
17
|
+
end
|
18
|
+
let!(:watchlist_monitor_id) { watchlist_monitor.id }
|
19
|
+
|
20
|
+
|
21
|
+
it 'creates a watchlist standard monitor' do
|
22
|
+
expect(watchlist_monitor).to be_an_instance_of Onfido::WatchlistMonitor
|
23
|
+
expect(watchlist_monitor.applicant_id).to eq applicant_id
|
24
|
+
expect(watchlist_monitor.report_name).to eq Onfido::ReportName::WATCHLIST_STANDARD
|
25
|
+
end
|
26
|
+
|
27
|
+
context 'AML monitor' do
|
28
|
+
let(:watchlist_monitor_builder) do
|
29
|
+
Onfido::WatchlistMonitorBuilder.new({
|
30
|
+
applicant_id: applicant_id,
|
31
|
+
report_name: Onfido::ReportName::WATCHLIST_AML
|
32
|
+
})
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'creates a watchlist AML monitor' do
|
36
|
+
expect(watchlist_monitor).to be_an_instance_of Onfido::WatchlistMonitor
|
37
|
+
expect(watchlist_monitor.applicant_id).to eq applicant_id
|
38
|
+
expect(watchlist_monitor.report_name).to eq Onfido::ReportName::WATCHLIST_AML
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it 'lists watchlist monitors' do
|
43
|
+
list_of_monitors = onfido_api.list_watchlist_monitors(applicant_id)
|
44
|
+
|
45
|
+
expect(list_of_monitors).to be_an_instance_of Onfido::WatchlistMonitorsList
|
46
|
+
expect(list_of_monitors.monitors.size).to be > 0
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'finds a watchlist monitor' do
|
50
|
+
get_watchlist_monitor = onfido_api.find_watchlist_monitor(watchlist_monitor_id)
|
51
|
+
|
52
|
+
expect(get_watchlist_monitor.id).to eq watchlist_monitor_id
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'deletes a watchlist monitor' do
|
56
|
+
onfido_api.delete_watchlist_monitor(watchlist_monitor_id)
|
57
|
+
end
|
58
|
+
|
59
|
+
it 'lists watchlist monitor matches' do
|
60
|
+
matches_list = onfido_api.list_watchlist_monitor_matches(watchlist_monitor_id)
|
61
|
+
|
62
|
+
expect(matches_list).to be_an_instance_of Onfido::WatchlistMonitorMatchesList
|
63
|
+
expect(matches_list.matches.size).to eq 0
|
64
|
+
end
|
65
|
+
|
66
|
+
it 'forces report creation' do
|
67
|
+
onfido_api.force_report_creation_from_watchlist_monitor(watchlist_monitor_id)
|
68
|
+
|
69
|
+
checks = onfido_api.list_checks(applicant_id).checks
|
70
|
+
expect(checks.size).to eq 2
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
@@ -1,110 +1,62 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
include_context 'fake onfido api'
|
5
|
-
|
6
|
-
subject(:webhook) { onfido.webhook }
|
7
|
-
|
8
|
-
describe '#create' do
|
9
|
-
let(:params) do
|
10
|
-
{
|
11
|
-
url: 'https://webhookendpoint.url',
|
12
|
-
enabled: true,
|
13
|
-
events: [
|
14
|
-
'report.completed',
|
15
|
-
'check.completed'
|
16
|
-
]
|
17
|
-
}
|
18
|
-
end
|
19
|
-
|
20
|
-
it 'creates the webhook' do
|
21
|
-
response = webhook.create(**params)
|
22
|
-
|
23
|
-
expect(response['id']).to_not be_nil
|
24
|
-
end
|
25
|
-
|
26
|
-
it 'responds with the right url' do
|
27
|
-
response = webhook.create(**params)
|
28
|
-
|
29
|
-
expect(response['url']).to eq params[:url]
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
describe '#find' do
|
34
|
-
it 'returns the webhook' do
|
35
|
-
webhook_id = 'fcb73186-0733-4f6f-9c57-d9d5ef979443'
|
36
|
-
|
37
|
-
response = webhook.find(webhook_id)
|
3
|
+
require_relative '../shared_contexts/with_onfido'
|
38
4
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
describe '#destroy' do
|
44
|
-
it 'removes the webhook' do
|
45
|
-
webhook_id = 'fcb73186-0733-4f6f-9c57-d9d5ef979443'
|
46
|
-
expect { webhook.destroy(webhook_id) }.not_to raise_error
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
describe '#all' do
|
51
|
-
it 'returns all the registered webhooks' do
|
52
|
-
response = webhook.all
|
5
|
+
describe Onfido::Webhook do
|
6
|
+
describe 'Webhook' do
|
7
|
+
include_context 'with onfido'
|
53
8
|
|
54
|
-
|
9
|
+
let(:webhook_builder) do
|
10
|
+
Onfido::WebhookBuilder.new({
|
11
|
+
url: 'https://example.com',
|
12
|
+
events: ['check.completed', 'report.completed'],
|
13
|
+
})
|
55
14
|
end
|
56
15
|
|
57
|
-
|
58
|
-
|
16
|
+
let(:webhook) { onfido_api.create_webhook(webhook_builder) }
|
17
|
+
let(:webhook_id) { webhook.id }
|
59
18
|
|
60
|
-
|
61
|
-
expect(
|
19
|
+
it 'creates a webhook' do
|
20
|
+
expect(webhook).to be_an_instance_of Onfido::Webhook
|
21
|
+
expect(webhook_id).to_not be_nil
|
22
|
+
expect(webhook.url).to eq 'https://example.com'
|
23
|
+
expect(webhook.events).to eq ['check.completed', 'report.completed']
|
62
24
|
end
|
63
|
-
end
|
64
25
|
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
26
|
+
it 'updates a webhook' do
|
27
|
+
webhook_updater = Onfido::WebhookUpdater.new({
|
28
|
+
url: 'https://example.co.uk',
|
29
|
+
events: ['check.completed'],
|
30
|
+
})
|
69
31
|
|
70
|
-
|
71
|
-
|
72
|
-
'
|
32
|
+
updated_webhook = onfido_api.update_webhook(webhook_id, webhook_updater)
|
33
|
+
expect(updated_webhook.id).to eq webhook_id
|
34
|
+
expect(updated_webhook.url).to eq 'https://example.co.uk'
|
35
|
+
expect(updated_webhook.events).to eq ['check.completed']
|
73
36
|
end
|
74
|
-
let(:token) { 'very_secret_token' }
|
75
37
|
|
76
|
-
it
|
38
|
+
it 'lists webhooks' do
|
39
|
+
list_of_webhooks = onfido_api.list_webhooks()
|
77
40
|
|
78
|
-
|
79
|
-
|
80
|
-
's21fd54ew2w1f5d15642132f3d7727ff9a32a7c87072ce514df1f6d3228bec'
|
81
|
-
end
|
82
|
-
it { is_expected.to be(false) }
|
41
|
+
expect(list_of_webhooks).to be_an_instance_of Onfido::WebhooksList
|
42
|
+
expect(list_of_webhooks.webhooks.size).to be > 0
|
83
43
|
end
|
84
44
|
|
85
|
-
|
86
|
-
|
87
|
-
specify { expect { valid? }.to raise_error(ArgumentError) }
|
88
|
-
end
|
45
|
+
it 'finds a webhook' do
|
46
|
+
get_webhook = onfido_api.find_webhook(webhook_id)
|
89
47
|
|
90
|
-
|
91
|
-
|
92
|
-
it { is_expected.to be(false) }
|
48
|
+
expect(get_webhook).to be_an_instance_of(Onfido::Webhook)
|
49
|
+
expect(get_webhook.id).to eq webhook_id
|
93
50
|
end
|
94
51
|
|
95
|
-
|
96
|
-
|
97
|
-
specify { expect { valid? }.to raise_error(ArgumentError) }
|
98
|
-
end
|
52
|
+
it 'deletes a webhook' do
|
53
|
+
onfido_api.delete_webhook(webhook_id)
|
99
54
|
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
context 'with a nil request body' do
|
106
|
-
let(:request_body) { nil }
|
107
|
-
specify { expect { valid? }.to raise_error(ArgumentError) }
|
55
|
+
expect {
|
56
|
+
onfido_api.find_webhook(webhook_id)
|
57
|
+
}.to raise_error(Onfido::ApiError) { |e|
|
58
|
+
expect(e.code).to eq(404)
|
59
|
+
}
|
108
60
|
end
|
109
61
|
end
|
110
62
|
end
|
@@ -0,0 +1,117 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../shared_contexts/with_document'
|
4
|
+
require_relative '../shared_contexts/with_live_photo'
|
5
|
+
require_relative '../shared_contexts/with_workflow_run'
|
6
|
+
|
7
|
+
describe Onfido::WorkflowRun do
|
8
|
+
describe 'Workflow run outputs' do
|
9
|
+
include_context 'with workflow run'
|
10
|
+
|
11
|
+
context 'workflow with profile data as output' do
|
12
|
+
let(:workflow_id) { 'd27e510b-27a8-44c3-a3cc-bf4c0648a4ba' }
|
13
|
+
|
14
|
+
let(:profile_data) do
|
15
|
+
{
|
16
|
+
country_residence: 'GBR',
|
17
|
+
first_name: 'First',
|
18
|
+
last_name: 'Last',
|
19
|
+
dob: '2000-01-01',
|
20
|
+
email: 'first.last@gmail.com',
|
21
|
+
phone_number: '+351911111111',
|
22
|
+
nationality: 'GBR',
|
23
|
+
phone_number_consent_granted: true,
|
24
|
+
address: {
|
25
|
+
country: 'GBR',
|
26
|
+
line1: '123rd Street',
|
27
|
+
line2: '2nd Floor',
|
28
|
+
line3: '23',
|
29
|
+
town: 'London',
|
30
|
+
postcode: 'S2 2DF',
|
31
|
+
}
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'returns profile data as output' do
|
36
|
+
tasks = onfido_api.list_tasks(workflow_run_id)
|
37
|
+
profile_data_task_id = (tasks.select { |task| task.id.include? 'profile' })[0].id
|
38
|
+
|
39
|
+
complete_task_builder = Onfido::CompleteTaskBuilder.new({
|
40
|
+
data: Onfido::CompleteTaskDataBuilder.build(profile_data)
|
41
|
+
})
|
42
|
+
onfido_api.complete_task(workflow_run_id, profile_data_task_id, complete_task_builder)
|
43
|
+
|
44
|
+
workflow_run_outputs = onfido_api.find_workflow_run(workflow_run_id).output
|
45
|
+
|
46
|
+
expect(workflow_run_outputs[:profile_capture_data]).to eq profile_data
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'workflow run with document and facial similarity reports as output' do
|
51
|
+
include_context 'with document'
|
52
|
+
include_context 'with live photo'
|
53
|
+
|
54
|
+
let(:workflow_id) { '5025d9fd-7842-4805-bce1-a7bfd7131b4e' }
|
55
|
+
let(:profile_data) { { first_name: 'Jane', last_name: 'Doe' } }
|
56
|
+
|
57
|
+
it 'returns document and facial similarity reports' do
|
58
|
+
tasks = onfido_api.list_tasks(workflow_run_id)
|
59
|
+
profile_data_task_id = (tasks.select { |task| task.id.include? 'profile' })[0].id
|
60
|
+
|
61
|
+
complete_profile_task_builder = Onfido::CompleteTaskBuilder.new({
|
62
|
+
data: Onfido::CompleteTaskDataBuilder.build(profile_data)
|
63
|
+
})
|
64
|
+
onfido_api.complete_task(
|
65
|
+
workflow_run_id,
|
66
|
+
profile_data_task_id,
|
67
|
+
complete_profile_task_builder,
|
68
|
+
)
|
69
|
+
|
70
|
+
tasks = onfido_api.list_tasks(workflow_run_id)
|
71
|
+
document_capture_task_id = (tasks.select { |task| task.id.include? 'document_photo' })[0].id
|
72
|
+
|
73
|
+
complete_document_capture_task_builder = Onfido::CompleteTaskBuilder.new(
|
74
|
+
data: Onfido::CompleteTaskDataBuilder.build([{ id: document_id }])
|
75
|
+
)
|
76
|
+
onfido_api.complete_task(
|
77
|
+
workflow_run_id,
|
78
|
+
document_capture_task_id,
|
79
|
+
complete_document_capture_task_builder,
|
80
|
+
)
|
81
|
+
|
82
|
+
tasks = onfido_api.list_tasks(workflow_run_id)
|
83
|
+
live_photo_capture_task_id = (tasks.select { |task| task.id.include? 'face_photo' })[0].id
|
84
|
+
|
85
|
+
complete_live_photo_capture_task_request = Onfido::CompleteTaskBuilder.new(
|
86
|
+
data: Onfido::CompleteTaskDataBuilder.build([{ id: live_photo_id }])
|
87
|
+
)
|
88
|
+
onfido_api.complete_task(
|
89
|
+
workflow_run_id,
|
90
|
+
live_photo_capture_task_id,
|
91
|
+
complete_live_photo_capture_task_request,
|
92
|
+
)
|
93
|
+
|
94
|
+
workflow_run = repeat_request_until_status_changes('approved') do
|
95
|
+
onfido_api.find_workflow_run(workflow_run_id)
|
96
|
+
end
|
97
|
+
|
98
|
+
document_report_output = workflow_run.output[:doc]
|
99
|
+
facial_similarity_report_output = workflow_run.output[:selfie]
|
100
|
+
|
101
|
+
expect(document_report_output[:breakdown]).to_not be_nil
|
102
|
+
expect(document_report_output[:properties]).to_not be_nil
|
103
|
+
expect(document_report_output[:repeat_attempts]).to_not be_nil
|
104
|
+
expect(document_report_output[:result]).to_not be_nil
|
105
|
+
expect(document_report_output[:status]).to_not be_nil
|
106
|
+
expect(document_report_output[:sub_result]).to_not be_nil
|
107
|
+
expect(document_report_output[:uuid]).to_not be_nil
|
108
|
+
|
109
|
+
expect(facial_similarity_report_output[:breakdown]).to_not be_nil
|
110
|
+
expect(facial_similarity_report_output[:properties]).to_not be_nil
|
111
|
+
expect(facial_similarity_report_output[:result]).to_not be_nil
|
112
|
+
expect(facial_similarity_report_output[:status]).to_not be_nil
|
113
|
+
expect(facial_similarity_report_output[:uuid]).to_not be_nil
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
@@ -1,46 +1,84 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
include_context 'fake onfido api'
|
3
|
+
require_relative '../shared_contexts/with_workflow_run'
|
5
4
|
|
6
|
-
|
5
|
+
describe Onfido::WorkflowRun do
|
6
|
+
describe 'Workflow run' do
|
7
|
+
include_context 'with workflow run'
|
7
8
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
end
|
9
|
+
it 'creates a workflow run' do
|
10
|
+
expect(workflow_run).to be_an_instance_of Onfido::WorkflowRun
|
11
|
+
expect(workflow_run.applicant_id).to eq applicant_id
|
12
|
+
expect(workflow_run.status).to eq 'awaiting_input'
|
13
|
+
end
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
15
|
+
context 'workflow run with custom inputs' do
|
16
|
+
let(:workflow_id) { '45092b29-f220-479e-aa6f-a6f989baac4c' }
|
17
|
+
let(:workflow_run_builder) do
|
18
|
+
Onfido::WorkflowRunBuilder.new({
|
19
|
+
applicant_id: applicant_id,
|
20
|
+
workflow_id: workflow_id,
|
21
|
+
custom_data: {
|
22
|
+
age: 18,
|
23
|
+
is_employed: false
|
24
|
+
}
|
25
|
+
})
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'creates a workflow run with custom inputs' do
|
29
|
+
expect(workflow_run).to be_an_instance_of Onfido::WorkflowRun
|
30
|
+
expect(workflow_run.workflow_id).to eq workflow_id
|
31
|
+
expect(workflow_run.status).to eq 'approved'
|
22
32
|
end
|
23
33
|
end
|
24
34
|
|
25
|
-
it '
|
26
|
-
|
27
|
-
|
35
|
+
it 'lists workflow runs' do
|
36
|
+
list_of_workflow_runs = onfido_api.list_workflow_runs()
|
37
|
+
|
38
|
+
expect(list_of_workflow_runs[0]).to be_an_instance_of Onfido::WorkflowRun
|
39
|
+
expect(list_of_workflow_runs.size).to be > 0
|
28
40
|
end
|
29
|
-
end
|
30
41
|
|
31
|
-
|
32
|
-
|
33
|
-
response = workflow_run.find(workflow_run_id)
|
42
|
+
it 'finds a workflow run' do
|
43
|
+
get_workflow_run = onfido_api.find_workflow_run(workflow_run_id)
|
34
44
|
|
35
|
-
expect(
|
45
|
+
expect(get_workflow_run).to be_an_instance_of Onfido::WorkflowRun
|
46
|
+
expect(get_workflow_run.id).to eq workflow_run_id
|
36
47
|
end
|
37
|
-
end
|
38
48
|
|
39
|
-
|
40
|
-
|
41
|
-
|
49
|
+
it 'downloads evidence file' do
|
50
|
+
file = onfido_api.download_signed_evidence_file(workflow_run_id)
|
51
|
+
|
52
|
+
expect(file.size).to be > 0
|
53
|
+
end
|
54
|
+
|
55
|
+
context 'with start -> approved workflow' do
|
56
|
+
let(:workflow_id) { '221f9d24-cf72-4762-ac4a-01bf3ccc09dd' }
|
57
|
+
|
58
|
+
it 'generates a timeline file' do
|
59
|
+
repeat_request_until_status_changes('approved') do
|
60
|
+
onfido_api.find_workflow_run(workflow_run_id)
|
61
|
+
end
|
62
|
+
|
63
|
+
workflow_timeline_file_data = onfido_api.create_timeline_file(workflow_run_id)
|
64
|
+
|
65
|
+
expect(workflow_timeline_file_data).to be_an_instance_of Onfido::TimelineFileReference
|
66
|
+
expect(workflow_timeline_file_data.workflow_timeline_file_id).to_not be_nil
|
67
|
+
expect(workflow_timeline_file_data.href).to_not be_nil
|
68
|
+
end
|
69
|
+
|
70
|
+
it 'finds a timeline file' do
|
71
|
+
repeat_request_until_status_changes('approved') do
|
72
|
+
onfido_api.find_workflow_run(workflow_run_id)
|
73
|
+
end
|
42
74
|
|
43
|
-
|
75
|
+
timeline_file_id = onfido_api.create_timeline_file(workflow_run_id).workflow_timeline_file_id
|
76
|
+
file = repeat_request_unti_http_code_changes do
|
77
|
+
onfido_api.find_timeline_file(workflow_run_id, timeline_file_id)
|
78
|
+
end
|
79
|
+
|
80
|
+
expect(file.size).to be > 0
|
81
|
+
end
|
44
82
|
end
|
45
83
|
end
|
46
84
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../shared_contexts/with_onfido'
|
4
|
+
|
5
|
+
RSpec.shared_context 'with applicant', shared_context: :metadata do
|
6
|
+
include_context 'with onfido'
|
7
|
+
|
8
|
+
let(:applicant_id) do
|
9
|
+
applicant = onfido_api.create_applicant(default_applicant_body)
|
10
|
+
|
11
|
+
applicant.id
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:default_applicant_body) do
|
15
|
+
{
|
16
|
+
'first_name' => 'Test',
|
17
|
+
'last_name' => 'Applicant',
|
18
|
+
'location' => {
|
19
|
+
'ip_address' => '127.0.0.1',
|
20
|
+
'country_of_residence' => 'GBR'
|
21
|
+
}
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../shared_contexts/with_document'
|
4
|
+
|
5
|
+
RSpec.shared_context 'with check', shared_context: :metadata do
|
6
|
+
include_context 'with document'
|
7
|
+
|
8
|
+
let(:check_builder) do
|
9
|
+
Onfido::CheckBuilder.new({
|
10
|
+
applicant_id: applicant_id,
|
11
|
+
document_ids: [document_id],
|
12
|
+
report_names: [Onfido::ReportName::DOCUMENT, Onfido::ReportName::IDENTITY_ENHANCED],
|
13
|
+
})
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:check) { onfido_api.create_check(check_builder) }
|
17
|
+
let!(:check_id) { check.id }
|
18
|
+
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require_relative '../shared_contexts/with_applicant'
|
4
|
+
|
5
|
+
RSpec.shared_context 'with document', shared_context: :metadata do
|
6
|
+
include_context 'with applicant'
|
7
|
+
|
8
|
+
let(:document_file_name) { 'sample_driving_licence.png' }
|
9
|
+
let(:document_file) { File.open("spec/integrations/media/#{document_file_name}") }
|
10
|
+
|
11
|
+
let(:document) { onfido_api.upload_document('passport', applicant_id, document_file) }
|
12
|
+
let!(:document_id) { document.id }
|
13
|
+
end
|