Search in sources :

Example 11 with KYCUserStatusNotificationBodyModel

use of com.paypal.kyc.model.KYCUserStatusNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.

the class BusinessKycUserNotificationStrategyTest method isApplicable_shouldReturnFalseWhenProfileTypeIsNotIndividual.

@MethodSource("nonBusinessProfileTypes")
@ParameterizedTest
void isApplicable_shouldReturnFalseWhenProfileTypeIsNotIndividual(final HyperwalletUser.ProfileType profileType) {
    // @formatter:off
    final KYCUserStatusNotificationBodyModel KYCUserStatusNotificationBodyModelStub = KYCUserStatusNotificationBodyModel.builder().profileType(profileType).build();
    // @formatter:on
    final boolean result = testObj.isApplicable(KYCUserStatusNotificationBodyModelStub);
    assertThat(result).isFalse();
}
Also used : KYCUserStatusNotificationBodyModel(com.paypal.kyc.model.KYCUserStatusNotificationBodyModel) MethodSource(org.junit.jupiter.params.provider.MethodSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 12 with KYCUserStatusNotificationBodyModel

use of com.paypal.kyc.model.KYCUserStatusNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.

the class BusinessKycUserNotificationStrategyTest method expectedKycMiraklStatus_shouldSetCorrectMiraklStatusBasedOnHyperwalletUserStatusesForBusiness.

@MethodSource("validVerificationStatuses")
@ParameterizedTest
void expectedKycMiraklStatus_shouldSetCorrectMiraklStatusBasedOnHyperwalletUserStatusesForBusiness(final HyperwalletUser.VerificationStatus verificationStatus, final HyperwalletUser.BusinessStakeholderVerificationStatus businessStakeholderVerificationStatus, final HyperwalletUser.LetterOfAuthorizationStatus letterOfAuthorizationStatus, final MiraklShopKycStatus miraklShopKycStatus) {
    // @formatter:off
    final KYCUserStatusNotificationBodyModel KYCUserStatusNotificationBodyModelStub = KYCUserStatusNotificationBodyModel.builder().clientUserId(String.valueOf(CLIENT_USER_ID)).verificationStatus(verificationStatus).businessStakeholderVerificationStatus(businessStakeholderVerificationStatus).letterOfAuthorizationStatus(letterOfAuthorizationStatus).profileType(HyperwalletUser.ProfileType.BUSINESS).build();
    // @formatter:on
    final MiraklShopKycStatus result = testObj.expectedKycMiraklStatus(KYCUserStatusNotificationBodyModelStub);
    assertThat(result).isEqualTo(miraklShopKycStatus);
}
Also used : MiraklShopKycStatus(com.mirakl.client.mmp.domain.shop.MiraklShopKycStatus) KYCUserStatusNotificationBodyModel(com.paypal.kyc.model.KYCUserStatusNotificationBodyModel) MethodSource(org.junit.jupiter.params.provider.MethodSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 13 with KYCUserStatusNotificationBodyModel

use of com.paypal.kyc.model.KYCUserStatusNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.

the class IndividualKYCUserNotificationStrategyTest method execute_shouldSendKycUpdateNotification_whenIndividualSeller.

@MethodSource("validVerificationStatuses")
@ParameterizedTest
void execute_shouldSendKycUpdateNotification_whenIndividualSeller(final HyperwalletUser.VerificationStatus hyperwalletVerificationStatus, final MiraklShopKycStatus miraklKycStatus) {
    // @formatter:off
    final KYCUserStatusNotificationBodyModel KYCUserStatusNotificationBodyModelStub = KYCUserStatusNotificationBodyModel.builder().clientUserId(String.valueOf(CLIENT_USER_ID)).verificationStatus(hyperwalletVerificationStatus).profileType(HyperwalletUser.ProfileType.INDIVIDUAL).build();
    // @formatter:on
    final MiraklShopKycStatus result = testObj.expectedKycMiraklStatus(KYCUserStatusNotificationBodyModelStub);
    assertThat(result).isEqualTo(miraklKycStatus);
}
Also used : MiraklShopKycStatus(com.mirakl.client.mmp.domain.shop.MiraklShopKycStatus) KYCUserStatusNotificationBodyModel(com.paypal.kyc.model.KYCUserStatusNotificationBodyModel) MethodSource(org.junit.jupiter.params.provider.MethodSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 14 with KYCUserStatusNotificationBodyModel

use of com.paypal.kyc.model.KYCUserStatusNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.

the class HyperWalletObjectToKYCUserStatusExecutorNotificationBodyModelConverterTest method convert_shouldTransformHyperWalletWebhookUserNotificationWithLetterOfAuthorizationRequirementToKycUserStatusNotificationModelWithLetterOfAuthorizationReasonType_whenDetailsIsNotNull.

@Test
void convert_shouldTransformHyperWalletWebhookUserNotificationWithLetterOfAuthorizationRequirementToKycUserStatusNotificationModelWithLetterOfAuthorizationReasonType_whenDetailsIsNotNull() {
    final Map<String, String> hyperWalletKycUserBodyNotification = createHyperWalletKycBusinessUserBodyNotification(HyperwalletUser.BusinessStakeholderVerificationStatus.NOT_REQUIRED, HyperwalletUser.LetterOfAuthorizationStatus.REQUIRED);
    when(kycRejectionReasonServiceMock.getReasonTypes(hyperWalletKycUserBodyNotification)).thenReturn(List.of(KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED));
    final KYCUserStatusNotificationBodyModel result = testObj.convert(hyperWalletKycUserBodyNotification);
    assertThat(result.getClientUserId()).isEqualTo(CLIENT_USER_ID);
    assertThat(result.getProfileType()).isEqualTo(BUSINESS_PROFILE_TYPE);
    assertThat(result.getVerificationStatus()).isEqualTo(HyperwalletUser.VerificationStatus.NOT_REQUIRED);
    assertThat(result.getReasonsType()).containsExactly(KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED);
}
Also used : KYCUserStatusNotificationBodyModel(com.paypal.kyc.model.KYCUserStatusNotificationBodyModel) Test(org.junit.jupiter.api.Test)

Example 15 with KYCUserStatusNotificationBodyModel

use of com.paypal.kyc.model.KYCUserStatusNotificationBodyModel in project mirakl-hyperwallet-connector by paypal.

the class HyperWalletObjectToKYCUserStatusExecutorNotificationBodyModelConverterTest method convert_shouldTransformHyperWalletWebhookBusinessUserNotificationToKycBusinessUserStatusNotificationModel_whenDetailsIsNotNull.

@Test
void convert_shouldTransformHyperWalletWebhookBusinessUserNotificationToKycBusinessUserStatusNotificationModel_whenDetailsIsNotNull() {
    final Map<String, String> hyperWalletKycUserBodyNotification = createHyperWalletKycUserBodyNotification(BUSINESS_PROFILE_TYPE);
    when(kycRejectionReasonServiceMock.getReasonTypes(hyperWalletKycUserBodyNotification)).thenReturn(List.of(KYCRejectionReasonTypeEnum.VERIFICATIONSTATUS_PROF_REQUIRED));
    final KYCUserStatusNotificationBodyModel result = testObj.convert(hyperWalletKycUserBodyNotification);
    assertThat(result.getClientUserId()).isEqualTo(CLIENT_USER_ID);
    assertThat(result.getProfileType()).isEqualTo(BUSINESS_PROFILE_TYPE);
    assertThat(result.getVerificationStatus()).isEqualTo(REQUIRED_VERIFICATION_STATUS);
    assertThat(result.getBusinessStakeholderVerificationStatus()).isEqualTo(NOT_REQUIRED_BUSINESS_VERIFICATION_STATUS);
    assertThat(result.getLetterOfAuthorizationStatus()).isEqualTo(FAILED_LETTER_VERIFICATION_STATUS);
    assertThat(result.getReasonsType()).containsExactlyInAnyOrder(KYCRejectionReasonTypeEnum.VERIFICATIONSTATUS_PROF_REQUIRED);
    verify(objectKYCDocumentNotificationModelListConverterMock).convert(hyperWalletKycUserBodyNotification);
}
Also used : KYCUserStatusNotificationBodyModel(com.paypal.kyc.model.KYCUserStatusNotificationBodyModel) Test(org.junit.jupiter.api.Test)

Aggregations

KYCUserStatusNotificationBodyModel (com.paypal.kyc.model.KYCUserStatusNotificationBodyModel)16 Test (org.junit.jupiter.api.Test)10 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)9 MiraklShopKycStatus (com.mirakl.client.mmp.domain.shop.MiraklShopKycStatus)6 MethodSource (org.junit.jupiter.params.provider.MethodSource)4 HyperwalletUser (com.hyperwallet.clientsdk.model.HyperwalletUser)1 MiraklException (com.mirakl.client.core.exception.MiraklException)1 ErrorBean (com.mirakl.client.domain.common.error.ErrorBean)1 MiraklShopKyc (com.mirakl.client.mmp.domain.shop.MiraklShopKyc)1 MiraklShopDocument (com.mirakl.client.mmp.domain.shop.document.MiraklShopDocument)1 MiraklMarketplacePlatformOperatorApiClient (com.mirakl.client.mmp.operator.core.MiraklMarketplacePlatformOperatorApiClient)1 MiraklUpdateShop (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdateShop)1 MiraklUpdateShopWithErrors (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdateShopWithErrors)1 MiraklUpdatedShopReturn (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdatedShopReturn)1 MiraklUpdatedShops (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdatedShops)1 MiraklUpdateShopsRequest (com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest)1 MiraklRequestAdditionalFieldValue (com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue)1 MiraklSimpleRequestAdditionalFieldValue (com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue)1 Converter (com.paypal.infrastructure.converter.Converter)1 HMCException (com.paypal.infrastructure.exceptions.HMCException)1