use of com.mirakl.client.mmp.domain.common.FileWrapper in project mirakl-hyperwallet-connector by paypal.
the class AbstractMiraklSelectedDocumentsStrategy method downloadDocument.
private KYCDocumentModel downloadDocument(final Pair<String, MiraklDownloadShopsDocumentsRequest> fieldNameAndDocumentIdPair) {
final MiraklDownloadShopsDocumentsRequest miraklDownloadShopsDocumentsRequest = fieldNameAndDocumentIdPair.getValue();
final String fieldName = fieldNameAndDocumentIdPair.getKey();
final String documentId = miraklDownloadShopsDocumentsRequest.getDocumentIds().stream().findAny().orElse(null);
try {
log.info("Trying to download file with id [{}]", documentId);
final FileWrapper fileWrapper = miraklApiClient.downloadShopsDocuments(miraklDownloadShopsDocumentsRequest);
log.info("Document with id [{}] downloaded", documentId);
return KYCDocumentModel.builder().file(fileWrapper.getFile()).documentFieldName(fieldName).build();
} catch (MiraklException e) {
log.error("Something went wrong trying to download document with id [{}]", documentId);
log.error(e.getMessage(), e);
}
return null;
}
Aggregations