use of com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel in project mirakl-hyperwallet-connector by paypal.
the class KYCReadyForReviewServiceMockImplTest method notifyBstkReadyForReview_whenThereIsAnErrorNotifyingToHW_shouldSendAnEmail.
@Test
void notifyBstkReadyForReview_whenThereIsAnErrorNotifyingToHW_shouldSendAnEmail() {
// @formatter:off
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentOne = KYCDocumentBusinessStakeHolderInfoModel.builder().clientUserId(SHOP_ID).userToken(List.of(new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(KYCConstants.HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN))).build();
// @formatter:on
HyperwalletException hwException = new HyperwalletException("Something bad happened");
doThrow(hwException).when(restTemplateMock).put(any(String.class), any(String.class), any(Object.class));
testObj.notifyBstkReadyForReview(Map.entry(USER_TOKEN, List.of(kycDocumentOne)));
verify(mailNotificationUtilMock).sendPlainTextEmail("Issue in Hyperwallet status notification", String.format("There was an error notifying Hyperwallet all documents were sent for shop Id [2000], so Hyperwallet will not be notified about this new situation%n%s", HyperwalletLoggingErrorsUtil.stringify(hwException)));
assertThat(logTrackerStub.contains("Error notifying to Hyperwallet that all documents were sent")).isTrue();
}
use of com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel in project mirakl-hyperwallet-connector by paypal.
the class KYCReadyForReviewServiceMockImplTest method notifyReadyForReview_whenBusinessStakeholderIsCorrectlyFilled_shouldCallToNotifyBstk.
@Test
void notifyReadyForReview_whenBusinessStakeholderIsCorrectlyFilled_shouldCallToNotifyBstk() {
// @formatter:off
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentOne = KYCDocumentBusinessStakeHolderInfoModel.builder().userToken(List.of(new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(KYCConstants.HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN))).hyperwalletProgram(HYPERWALLET_PROGRAM).sentToHyperwallet(Boolean.TRUE).build();
doNothing().when(testObj).notifyBstkReadyForReview(Map.entry(USER_TOKEN, List.of(kycDocumentOne)));
testObj.notifyReadyForReview(List.of(kycDocumentOne));
verify(testObj).notifyBstkReadyForReview(Map.entry(USER_TOKEN, List.of(kycDocumentOne)));
}
use of com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel in project mirakl-hyperwallet-connector by paypal.
the class MiraklProofOfAddressStrategyTest method isApplicable_shouldReturnFalseWhenIsProofOfBusinessAndObjectReceivedAsParameterIsNotKYCDocumentSellerInfoModel.
@Test
void isApplicable_shouldReturnFalseWhenIsProofOfBusinessAndObjectReceivedAsParameterIsNotKYCDocumentSellerInfoModel() {
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().build();
final boolean result = testObj.isApplicable(kycDocumentBusinessStakeHolderInfoModel);
assertThat(result).isFalse();
}
use of com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel in project mirakl-hyperwallet-connector by paypal.
the class MiraklProofOfIdentityStrategyTest method isApplicable_shouldReturnFalseWhenIsProofOfBusinessAndObjectReceivedAsParameterIsNotKYCDocumentSellerInfoModel.
@Test
void isApplicable_shouldReturnFalseWhenIsProofOfBusinessAndObjectReceivedAsParameterIsNotKYCDocumentSellerInfoModel() {
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().build();
final boolean result = testObj.isApplicable(kycDocumentBusinessStakeHolderInfoModel);
assertThat(result).isFalse();
}
use of com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel in project mirakl-hyperwallet-connector by paypal.
the class KYCBusinessStakeholderDocumentInfoModelToLetterOfAuthorizationHyperwalletVerificationDocumentStrategy method execute.
/**
* {@inheritDoc}
*/
@Override
public HyperwalletVerificationDocument execute(final KYCDocumentBusinessStakeHolderInfoModel source) {
// @formatter:off
final Map<String, String> uploadFiles = source.getLetterOfAuthorizationDocument().stream().collect(Collectors.toMap(kycDocumentModel -> LETTER_OF_AUTHORIZATION_NAME, kycDocumentModel -> kycDocumentModel.getFile().getAbsolutePath()));
// @formatter:on
final HyperwalletVerificationDocument hyperwalletVerificationDocument = new HyperwalletVerificationDocument();
hyperwalletVerificationDocument.setType(LETTER_OF_AUTHORIZATION_TYPE);
hyperwalletVerificationDocument.setCategory(KYCDocumentCategoryEnum.AUTHORIZATION.name());
hyperwalletVerificationDocument.setUploadFiles(uploadFiles);
return hyperwalletVerificationDocument;
}
Aggregations