use of com.paypal.kyc.model.KYCUserDocumentFlagsNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.
the class KYCUserNotificationServiceImpl method updateUserDocumentsFlags.
/**
* {@inheritDoc}
*/
@Override
public void updateUserDocumentsFlags(final HyperwalletWebhookNotification incomingNotification) {
final KYCUserDocumentFlagsNotificationBodyModel kycUserDocumentFlagsNotificationBodyModel = hyperWalletObjectToKycUserDocumentFlagsNotificationBodyModelConverter.convert(incomingNotification.getObject());
kycUserDocumentFlagsExecutor.execute(kycUserDocumentFlagsNotificationBodyModel);
}
use of com.paypal.kyc.model.KYCUserDocumentFlagsNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletObjectToKYCUserDocumentFlagsExecutorNotificationBodyModelConverterTest method convert_whenDetailsAreNotNull_shouldTransformHyperWalletWebhookNotificationToKycUserDocumentFlagsNotificationModel.
@Test
void convert_whenDetailsAreNotNull_shouldTransformHyperWalletWebhookNotificationToKycUserDocumentFlagsNotificationModel() {
when(hyperwalletSDKServiceMock.getHyperwalletInstance(PROGRAM)).thenReturn(hyperwalletMock);
doReturn(PROGRAM).when(testObj).getHyperwalletPrograms();
final Map<String, String> hyperWalletKycUserBodyNotification = createHyperWalletKycUserDocumentFlagsNotification();
final KYCUserDocumentFlagsNotificationBodyModel result = testObj.convert(hyperWalletKycUserBodyNotification);
assertThat(result.getUserToken()).isEqualTo(USER_TOKEN);
assertThat(result.getClientUserId()).isEqualTo(CLIENT_USER_ID);
assertThat(result.getProfileType()).isEqualTo(PROFILE_TYPE);
assertThat(result.getVerificationStatus().name()).isEqualTo(VERIFICATION_STATUS.name());
assertThat(result.getHyperwalletProgram()).isEqualTo(PROGRAM);
}
use of com.paypal.kyc.model.KYCUserDocumentFlagsNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.
the class AbstractUserDocumentFlagsStrategyTest method fillMiraklProofIdentityOrBusinessFlagStatus_shouldSendAnEmailWhenMiraklConnectionFails.
@Test
void fillMiraklProofIdentityOrBusinessFlagStatus_shouldSendAnEmailWhenMiraklConnectionFails() {
// @formatter:off
final KYCUserDocumentFlagsNotificationBodyModel kycUserDocumentFlagsNotificationBodyModel = KYCUserDocumentFlagsNotificationBodyModel.builder().clientUserId(SHOP_ID).profileType(HyperwalletUser.ProfileType.INDIVIDUAL).verificationStatus(HyperwalletUser.VerificationStatus.REQUIRED).build();
// @formatter:on
final MiraklException miraklException = new MiraklException("Something bad happened");
doThrow(miraklException).when(miraklMarketplacePlatformOperatorApiClientMock).updateShops(any(MiraklUpdateShopsRequest.class));
final Throwable throwable = catchThrowable(() -> testObj.fillMiraklProofIdentityOrBusinessFlagStatus(kycUserDocumentFlagsNotificationBodyModel));
assertThat(throwable).isEqualTo(miraklException);
assertThat(LOG_TRACKER_STUB.contains(String.format(MSG_ERROR, SHOP_ID, miraklException.getMessage()))).isTrue();
verify(mailNotificationMock).sendPlainTextEmail("Issue detected updating KYC information in Mirakl", String.format(EMAIL_BODY_PREFIX + "Something went wrong updating KYC information of shop [%s]%n%s", SHOP_ID, MiraklLoggingErrorsUtil.stringify(miraklException)));
}
use of com.paypal.kyc.model.KYCUserDocumentFlagsNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.
the class KYCUserDocumentFlagIndividualStrategyTest method isApplicable_shouldReturnFalseWhenUserReceivedIsProfessionalAndVerificationStatusIsRequired.
@Test
void isApplicable_shouldReturnFalseWhenUserReceivedIsProfessionalAndVerificationStatusIsRequired() {
// @formatter:off
KYCUserDocumentFlagsNotificationBodyModel kycUserDocumentFlagsNotificationBodyModel = KYCUserDocumentFlagsNotificationBodyModel.builder().profileType(HyperwalletUser.ProfileType.BUSINESS).verificationStatus(HyperwalletUser.VerificationStatus.REQUIRED).build();
// @formatter:on
final boolean result = testObj.isApplicable(kycUserDocumentFlagsNotificationBodyModel);
assertThat(result).isFalse();
}
use of com.paypal.kyc.model.KYCUserDocumentFlagsNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.
the class KYCUserDocumentFlagProofIdentityBusinessStakeHolderStrategyTest method execute_shouldNotCallUpdateShopWhenNoBusinessStakeHoldersRequiresVerification.
@Test
void execute_shouldNotCallUpdateShopWhenNoBusinessStakeHoldersRequiresVerification() {
// @formatter:off
final KYCUserDocumentFlagsNotificationBodyModel kycUserDocumentFlagsNotificationBodyModel = KYCUserDocumentFlagsNotificationBodyModel.builder().hyperwalletProgram(HYPERWALLET_PROGRAM).userToken(USER_TOKEN).clientUserId(SHOP_ID).profileType(HyperwalletUser.ProfileType.BUSINESS).businessStakeholderVerificationStatus(HyperwalletUser.BusinessStakeholderVerificationStatus.REQUIRED).build();
// @formatter:on
when(hyperwalletBusinessStakeholderExtractServiceMock.getKYCRequiredVerificationBusinessStakeHolders(HYPERWALLET_PROGRAM, USER_TOKEN)).thenReturn(List.of());
testObj.execute(kycUserDocumentFlagsNotificationBodyModel);
verifyNoInteractions(miraklMarketplacePlatformOperatorApiClientMock);
}
Aggregations