Skip to content

Commit

Permalink
Fix Zip failed error missing information (#396)
Browse files Browse the repository at this point in the history
  • Loading branch information
MMContis authored Feb 6, 2024
1 parent 53dfd93 commit 5401f4e
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -211,8 +211,7 @@ extension RequestsViewController {
}

private func zipFailed(error: ZipFailedError) {
let alert = UIAlertController(title: Localizable.Zipper.Error.alertTitle, message: error.title, preferredStyle: .alert)

let alert = UIAlertController(title: Localizable.Zipper.Error.alertTitle, message: error.description, preferredStyle: .alert)
if error.isRetry {
let retryAction = UIAlertAction(title: Localizable.Common.tryAgain, style: .default) { [weak self] _ in
self?.eventHandler?.handleEvent(.zipFailedReTry(type: error.type))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"location_error_message" = "Geräteortung fehlgeschlagen";

// Zipper
"zipper_error_kyc_invalid" = "KYC-Objekt ist ungültig wegen:";
"zipper_error_kyc_invalid" = "KYC-Objekt ist ungültig wegen : ";
"zipper_error_zip_foundation_not_imported" = "ZIPFoundation Framework wurde nicht in das Projekt importiert.";
"zipper_error_zip_exceed_max_size" = "ZIP-Datei überschreitet die maximale Dateigröße, bitte überprüfen Sie die API-Dokumentation.";
"zipper_error_cannot_create_zip" = "ZIP kann nicht erstellt werden.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"location_error_message" = "Device location failed";

// Zipper
"zipper_error_kyc_invalid" = "KYC object is not valid because of:";
"zipper_error_kyc_invalid" = "KYC object is not valid because of : ";
"zipper_error_zip_foundation_not_imported" = "ZIPFoundation framework in not imported into project";
"zipper_error_zip_exceed_max_size" = "ZIP file exceeding the maximum file size, please check the API documentation";
"zipper_error_cannot_create_zip" = "Cannot create the Zip";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"location_error_message" = "Error de ubicación del dispositivo";

// Zipper
"zipper_error_kyc_invalid" = "El objeto KYC no es válido, debido a:";
"zipper_error_kyc_invalid" = "El objeto KYC no es válido, debido a : ";
"zipper_error_zip_foundation_not_imported" = "ZIPFoundation framework no importado en el proyecto";
"zipper_error_zip_exceed_max_size" = "El archivo ZIP excede el tamaño máximo de archivo, revisa la documentación de la API";
"zipper_error_cannot_create_zip" = "No se puede crear el zip";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"location_error_message" = "Échec de la localisation de l’appareil";

// Zipper
"zipper_error_kyc_invalid" = "L’objet KYC n’est pas valide, en raison de :";
"zipper_error_kyc_invalid" = "L’objet KYC n’est pas valide, en raison de : ";
"zipper_error_zip_foundation_not_imported" = "Le cadre ZIPFoundation n’est pas importé dans le projet";
"zipper_error_zip_exceed_max_size" = "Fichier ZIP dépassant la taille maximale du fichier, veuillez consulter la documentation de l’API";
"zipper_error_cannot_create_zip" = "Impossible de créer le Zip";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"location_error_message" = "Localizzazione del dispositivo non riuscita";

// Zipper
"zipper_error_kyc_invalid" = "L'oggetto KYC non è valido a causa di:";
"zipper_error_kyc_invalid" = "L'oggetto KYC non è valido a causa di : ";
"zipper_error_zip_foundation_not_imported" = "ZIPFoundation Framework non è stato importato nel progetto.";
"zipper_error_zip_exceed_max_size" = "Il file ZIP supera la dimensione massima del file, controlla la documentazione API.";
"zipper_error_cannot_create_zip" = "ZIP non può essere creato.";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,37 @@ extension KYCZipService {
errorMessage.append("\n Contacts: \(errors.map { $0 })")
}

if result.contains(.invalidSecondaryDocument) {

let secondaryDocuments = KYCContainer.shared.kycInfo.secondaryDocuments
for doc in secondaryDocuments {
let errors = Set<SecondaryDocument.SecondaryDocumentValidationError>(doc.validate())
errorMessage.append("\n Secondary Document: \(errors.map { $0 })")
}
}

if result.contains(.invalidDocumentsToSign) {

let documents = KYCContainer.shared.kycInfo.documentsToSign
for doc in documents {
let errors = Set<FourthlineKYC.QESAttachment.QESAttachmentValidationError>(doc.validate())
errorMessage.append("\n Document To Sign: \(errors.map { $0 })")
}
}

if result.contains(.invalidTaxInfo),
let taxInfo = KYCContainer.shared.kycInfo.taxInfo {

let errors = Set<FourthlineKYC.TaxInfo.TaxInfoValidationError>(taxInfo.validate())
errorMessage.append("\n Tax Info: \(errors.map { $0 })")
}

if result.contains(.invalidMetadata) {
let metadata = KYCContainer.shared.kycInfo.metadata
let errors = Set<DeviceMetadata.DeviceMetadataValidationError>(metadata.validate())
errorMessage.append("\n DeviceMetadata: \(errors.map { $0 })")
}
return errorMessage
return errorMessage.isEmpty ? Localizable.Zipper.Error.unknown : errorMessage
}

static func zipErrorType(for zipperError: ZipperError) -> KYCZipErrorType {
Expand Down

0 comments on commit 5401f4e

Please sign in to comment.