use of com.hyperwallet.clientsdk.model.HyperwalletVerificationDocument in project mirakl-hyperwallet-connector by paypal.
the class KYCBusinessStakeholderDocumentInfoModelToProofOfIdentityHyperwalletVerificationDocumentStrategy method execute.
/**
* {@inheritDoc}
*/
@Override
public HyperwalletVerificationDocument execute(final KYCDocumentBusinessStakeHolderInfoModel source) {
final String countryIsoCode = source.getCountryIsoCode();
// @formatter:off
final Map<String, String> uploadFiles = source.getIdentityDocuments().stream().collect(Collectors.toMap(kycDocumentModel -> source.getProofOfIdentity().name().toLowerCase() + '_' + kycDocumentModel.getDocumentSide().name().toLowerCase(), kycDocumentModel -> kycDocumentModel.getFile().getAbsolutePath()));
// @formatter:on
final HyperwalletVerificationDocument hyperwalletVerificationDocument = new HyperwalletVerificationDocument();
hyperwalletVerificationDocument.setType(source.getProofOfIdentity().name());
hyperwalletVerificationDocument.setCountry(countryIsoCode);
hyperwalletVerificationDocument.setCategory(KYCDocumentCategoryEnum.IDENTIFICATION.name());
hyperwalletVerificationDocument.setUploadFiles(uploadFiles);
return hyperwalletVerificationDocument;
}
use of com.hyperwallet.clientsdk.model.HyperwalletVerificationDocument in project mirakl-hyperwallet-connector by paypal.
the class KYCDocumentInfoModelToProofOAddressHyperwalletVerificationDocumentStrategy method execute.
@Override
public HyperwalletVerificationDocument execute(final KYCDocumentSellerInfoModel source) {
// @formatter:off
final Map<String, String> uploadFiles = source.getAddressDocuments().stream().collect(Collectors.toMap(kycDocumentModel -> source.getProofOfAddress().name().toLowerCase() + '_' + kycDocumentModel.getDocumentSide().name().toLowerCase(), kycDocumentModel -> kycDocumentModel.getFile().getAbsolutePath()));
// @formatter:on
final HyperwalletVerificationDocument hyperwalletVerificationDocument = new HyperwalletVerificationDocument();
hyperwalletVerificationDocument.setType(source.getProofOfAddress().name());
hyperwalletVerificationDocument.setCategory(KYCDocumentCategoryEnum.ADDRESS.name());
hyperwalletVerificationDocument.setUploadFiles(uploadFiles);
return hyperwalletVerificationDocument;
}
use of com.hyperwallet.clientsdk.model.HyperwalletVerificationDocument in project mirakl-hyperwallet-connector by paypal.
the class KYCDocumentInfoModelToProofOfBusinessHyperwalletVerificationDocumentStrategy method execute.
/**
* {@inheritDoc}
*/
@Override
public HyperwalletVerificationDocument execute(final KYCDocumentSellerInfoModel source) {
// @formatter:off
final Map<String, String> uploadFiles = source.getProofOfBusinessDocuments().stream().collect(Collectors.toMap(kycDocumentModel -> source.getProofOfBusiness().name().toLowerCase() + '_' + kycDocumentModel.getDocumentSide().name().toLowerCase(), kycDocumentModel -> kycDocumentModel.getFile().getAbsolutePath()));
// @formatter:on
final HyperwalletVerificationDocument hyperwalletVerificationDocument = new HyperwalletVerificationDocument();
hyperwalletVerificationDocument.setType(source.getProofOfBusiness().name());
hyperwalletVerificationDocument.setCategory(KYCDocumentCategoryEnum.BUSINESS.name());
hyperwalletVerificationDocument.setUploadFiles(uploadFiles);
return hyperwalletVerificationDocument;
}
use of com.hyperwallet.clientsdk.model.HyperwalletVerificationDocument in project mirakl-hyperwallet-connector by paypal.
the class KYCDocumentInfoModelToProofOfIdentityHyperwalletVerificationDocumentStrategy method execute.
@Override
public HyperwalletVerificationDocument execute(final KYCDocumentSellerInfoModel source) {
final String countryIsoCode = source.getCountryIsoCode();
// @formatter:off
final Map<String, String> uploadFiles = source.getIdentityDocuments().stream().collect(Collectors.toMap(kycDocumentModel -> source.getProofOfIdentity().name().toLowerCase() + '_' + kycDocumentModel.getDocumentSide().name().toLowerCase(), kycDocumentModel -> kycDocumentModel.getFile().getAbsolutePath()));
// @formatter:on
final HyperwalletVerificationDocument hyperwalletVerificationDocument = new HyperwalletVerificationDocument();
hyperwalletVerificationDocument.setType(source.getProofOfIdentity().name());
hyperwalletVerificationDocument.setCountry(countryIsoCode);
hyperwalletVerificationDocument.setCategory(KYCDocumentCategoryEnum.IDENTIFICATION.name());
hyperwalletVerificationDocument.setUploadFiles(uploadFiles);
return hyperwalletVerificationDocument;
}
use of com.hyperwallet.clientsdk.model.HyperwalletVerificationDocument in project mirakl-hyperwallet-connector by paypal.
the class HyperwalletBusinessStakeholderExtractServiceMockImpl method callHyperwalletAPI.
/**
* {@inheritDoc}
*/
@Override
protected KYCDocumentBusinessStakeHolderInfoModel callHyperwalletAPI(final Map.Entry<KYCDocumentBusinessStakeHolderInfoModel, List<HyperwalletVerificationDocument>> entry) {
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = entry.getKey();
final List<HyperwalletVerificationDocument> hyperwalletVerificationDocuments = entry.getValue();
final String postURL = HYPERWALLET_PUSH_DOCUMENTS.replace("{userToken}", kycDocumentBusinessStakeHolderInfoModel.getUserToken()).replace("{bstToken}", kycDocumentBusinessStakeHolderInfoModel.getToken());
try {
if (checkFailingFiles(hyperwalletVerificationDocuments)) {
throw new HyperwalletException("Something bad happened");
}
Gson gsonConverter = new Gson();
restTemplate.postForObject(getMockServerUrl() + postURL, gsonConverter.toJson(entry.getValue()), Object.class);
log.info("Pushed successfully to mockserver documents [{}] for shopId [{}]", kycDocumentBusinessStakeHolderInfoModel.getIdentityDocuments().stream().map(KYCDocumentModel::getDocumentFieldName).collect(Collectors.joining(",")), kycDocumentBusinessStakeHolderInfoModel.getClientUserId());
return kycDocumentBusinessStakeHolderInfoModel.toBuilder().sentToHyperwallet(true).build();
} catch (HyperwalletException ex) {
log.error("Error uploading document to hyperwallet: [{}]", HyperwalletLoggingErrorsUtil.stringify(ex));
getKycMailNotificationUtil().sendPlainTextEmail("Issue detected pushing documents into Hyperwallet", String.format("Something went wrong pushing documents to Hyperwallet for shop Id [%s] and business stakeholder number [%s]%n%s", kycDocumentBusinessStakeHolderInfoModel.getClientUserId(), kycDocumentBusinessStakeHolderInfoModel.getBusinessStakeholderMiraklNumber(), HyperwalletLoggingErrorsUtil.stringify(ex)));
return kycDocumentBusinessStakeHolderInfoModel;
}
}
Aggregations