use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class NotificationsHyperwalletSDKEncryptedServiceImplTest method getHyperwalletInstance_shouldReturnAnHyperwalletInstanceWithEncryptedOption.
@Test
void getHyperwalletInstance_shouldReturnAnHyperwalletInstanceWithEncryptedOption() {
when(notificationsHyperwalletApiConfigMock.getUsername()).thenReturn(USER_NAME);
when(notificationsHyperwalletApiConfigMock.getPassword()).thenReturn(PASSWORD);
when(notificationsHyperwalletApiConfigMock.getServer()).thenReturn(SERVER);
final Hyperwallet result = testObj.getHyperwalletInstance(PROGRAM_TOKEN);
assertThat(result).hasFieldOrPropertyWithValue("apiClient.hyperwalletEncryption", hyperwalletEncryptionMock);
}
use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class NotificationsHyperwalletSDKServiceImplTest method getHyperwalletInstance_shouldReturnAnHyperwalletInstanceWithNOTEncryptedOption.
@Test
void getHyperwalletInstance_shouldReturnAnHyperwalletInstanceWithNOTEncryptedOption() {
when(notificationsHyperwalletApiConfigMock.getUsername()).thenReturn(USER_NAME);
when(notificationsHyperwalletApiConfigMock.getPassword()).thenReturn(PASSWORD);
when(notificationsHyperwalletApiConfigMock.getServer()).thenReturn(SERVER);
final Hyperwallet result = testObj.getHyperwalletInstance(PROGRAM_TOKEN);
assertThat(result).hasFieldOrPropertyWithValue("apiClient.hyperwalletEncryption", null);
}
use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class KYCReadyForReviewServiceImpl method notifyBstkReadyForReview.
protected void notifyBstkReadyForReview(final Map.Entry<String, List<KYCDocumentInfoModel>> entry) {
final String token = entry.getKey();
final HyperwalletUser user = new HyperwalletUser();
user.setToken(token);
user.setBusinessStakeholderVerificationStatus(HyperwalletUser.BusinessStakeholderVerificationStatus.READY_FOR_REVIEW);
try {
final Optional<String> hyperwalletProgramOptional = getHyperwalletProgram(entry.getValue());
if (hyperwalletProgramOptional.isPresent()) {
final String hyperwalletProgram = hyperwalletProgramOptional.get();
final Hyperwallet hyperwallet = hyperwalletSDKService.getHyperwalletInstance(hyperwalletProgram);
final HyperwalletUser hyperwalletUser = hyperwallet.updateUser(user);
log.info("Seller with id [{}] has been set as Ready for review", hyperwalletUser.getClientUserId());
} else {
log.error("Seller with shop Id [{}] has no Hyperwallet Program", getClientId(entry.getValue()));
}
} catch (final HyperwalletException e) {
// @formatter:off
final String clientUserId = CollectionUtils.emptyIfNull(entry.getValue()).stream().map(KYCDocumentInfoModel::getClientUserId).findAny().orElse("undefined");
// @formatter:on
log.error("Error notifying to Hyperwallet that all documents were sent: [{}]", HyperwalletLoggingErrorsUtil.stringify(e));
kycMailNotificationUtil.sendPlainTextEmail("Issue in Hyperwallet status notification", String.format("There was an error notifying Hyperwallet all documents were sent for shop Id [%s], so Hyperwallet will not be notified about this new situation%n%s", clientUserId, HyperwalletLoggingErrorsUtil.stringify(e)));
}
}
use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class HyperwalletSellerExtractServiceImpl method callHyperwalletAPI.
/**
* {@inheritDoc}
*/
protected KYCDocumentSellerInfoModel callHyperwalletAPI(final Map.Entry<KYCDocumentSellerInfoModel, List<HyperwalletVerificationDocument>> entry) {
final KYCDocumentSellerInfoModel kycDocumentSellerInfoModel = entry.getKey();
final String documentsToUpload = entry.getValue().stream().map(hyperwalletVerificationDocument -> hyperwalletVerificationDocument.getUploadFiles().keySet()).flatMap(Collection::stream).collect(Collectors.joining(LoggingConstantsUtil.LIST_LOGGING_SEPARATOR));
try {
final Hyperwallet hyperwallet = hyperwalletSDKService.getHyperwalletInstance(kycDocumentSellerInfoModel.getHyperwalletProgram());
hyperwallet.uploadUserDocuments(kycDocumentSellerInfoModel.getUserToken(), entry.getValue());
log.info("Documents [{}] uploaded for shop with id [{}]", documentsToUpload, kycDocumentSellerInfoModel.getClientUserId());
return kycDocumentSellerInfoModel;
} catch (final HyperwalletException e) {
log.error("Error uploading document to hyperwallet: [{}]", HyperwalletLoggingErrorsUtil.stringify(e));
kycMailNotificationUtil.sendPlainTextEmail("Issue detected pushing documents into Hyperwallet", String.format("Something went wrong pushing documents to Hyperwallet for shop Id [%s]%n%s", kycDocumentSellerInfoModel.getClientUserId(), HyperwalletLoggingErrorsUtil.stringify(e)));
return null;
}
}
use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class SellerHyperwalletSDKServiceImplTest method getHyperwalletInstanceWithProgramToken_shouldReturnAnHyperwalletInstance.
@Test
void getHyperwalletInstanceWithProgramToken_shouldReturnAnHyperwalletInstance() {
when(sellersHyperwalletApiConfigMock.getUsername()).thenReturn(USER_NAME);
when(sellersHyperwalletApiConfigMock.getPassword()).thenReturn(PASSWORD);
when(sellersHyperwalletApiConfigMock.getServer()).thenReturn(SERVER);
final Hyperwallet result = testObj.getHyperwalletInstanceByProgramToken(PROGRAM_TOKEN);
assertThat(result).hasFieldOrPropertyWithValue("programToken", PROGRAM_TOKEN).hasFieldOrPropertyWithValue("apiClient.username", USER_NAME).hasFieldOrPropertyWithValue("url", SERVER + "/rest/v4");
}
Aggregations