Search in sources :

Example 21 with KYCDocumentBusinessStakeHolderInfoModel

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

the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method documents.

private static Stream<Arguments> documents() {
    // Case 1: Document needs LOA and KYC but does not exist in Mirakl
    final KYCDocumentBusinessStakeHolderInfoModel case1 = spy(KYCDocumentBusinessStakeHolderInfoModel.builder().requiresLetterOfAuthorization(true).requiresKYC(true).build());
    when(case1.existsDocumentInMirakl()).thenReturn(false);
    // Case 2: Document needs LOA and KYC, exists in Mirakl but does not have LoA
    // document in Mirakl
    final KYCDocumentBusinessStakeHolderInfoModel case2 = spy(KYCDocumentBusinessStakeHolderInfoModel.builder().requiresLetterOfAuthorization(true).requiresKYC(true).build());
    when(case2.existsDocumentInMirakl()).thenReturn(true);
    when(case2.existsDocumentInMirakl()).thenReturn(false);
    // Case 3: Document needs LOA (not KYC), but does not have a LoA document in
    // Mirakl
    final KYCDocumentBusinessStakeHolderInfoModel case3 = spy(KYCDocumentBusinessStakeHolderInfoModel.builder().requiresLetterOfAuthorization(true).requiresKYC(false).build());
    when(case3.existsLetterOfAuthorizationDocumentInMirakl()).thenReturn(false);
    // Case 4: Document needs KYC, but does not have a document in Mirakl
    final KYCDocumentBusinessStakeHolderInfoModel case4 = spy(KYCDocumentBusinessStakeHolderInfoModel.builder().requiresLetterOfAuthorization(false).requiresKYC(true).build());
    when(case4.existsDocumentInMirakl()).thenReturn(false);
    return Stream.of(Arguments.of(case1), Arguments.of(case2), Arguments.of(case3), Arguments.of(case4));
}
Also used : KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel)

Example 22 with KYCDocumentBusinessStakeHolderInfoModel

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

the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method getBusinessStakeholderDocumentsSelectedBySeller_shouldReturnSameInputWhenRequiresKYCButDocumentsDoesNotExists.

@Test
void getBusinessStakeholderDocumentsSelectedBySeller_shouldReturnSameInputWhenRequiresKYCButDocumentsDoesNotExists() {
    // @formatter:off
    final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().requiresKYC(true).businessStakeholderMiraklNumber(1).clientUserId(MIRAKL_SHOP_ID).proofOfIdentity(KYCProofOfIdentityEnum.GOVERNMENT_ID).build();
    // @formatter:on
    final KYCDocumentBusinessStakeHolderInfoModel result = testObj.getBusinessStakeholderDocumentsSelectedBySeller(kycDocumentBusinessStakeHolderInfoModel);
    assertThat(kycDocumentBusinessStakeHolderInfoModel).isEqualTo(result);
}
Also used : KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 23 with KYCDocumentBusinessStakeHolderInfoModel

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

the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method getBusinessStakeholderDocumentsSelectedBySeller_shouldReturnSameInputWhenAuthorizationLetterIsRequiredAndRequiresKYCButDocumentsDoesNotExists.

@Test
void getBusinessStakeholderDocumentsSelectedBySeller_shouldReturnSameInputWhenAuthorizationLetterIsRequiredAndRequiresKYCButDocumentsDoesNotExists() {
    // @formatter:off
    final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().requiresKYC(true).requiresLetterOfAuthorization(true).businessStakeholderMiraklNumber(1).clientUserId(MIRAKL_SHOP_ID).proofOfIdentity(KYCProofOfIdentityEnum.GOVERNMENT_ID).build();
    // @formatter:on
    final KYCDocumentBusinessStakeHolderInfoModel result = testObj.getBusinessStakeholderDocumentsSelectedBySeller(kycDocumentBusinessStakeHolderInfoModel);
    assertThat(kycDocumentBusinessStakeHolderInfoModel).isEqualTo(result);
}
Also used : KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 24 with KYCDocumentBusinessStakeHolderInfoModel

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

the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method getBusinessStakeholderDocumentsSelectedBySeller_shouldNotPopulateKYCInfoModelWithDocumentInformationWhenLetterOfAuthorizationIsRequiredAndLetterOfAuthorizationDocumentIsNotFilled.

@Test
void getBusinessStakeholderDocumentsSelectedBySeller_shouldNotPopulateKYCInfoModelWithDocumentInformationWhenLetterOfAuthorizationIsRequiredAndLetterOfAuthorizationDocumentIsNotFilled() {
    // @formatter:off
    final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().businessStakeholderMiraklNumber(1).requiresLetterOfAuthorization(Boolean.TRUE).clientUserId(MIRAKL_SHOP_ID).proofOfIdentity(KYCProofOfIdentityEnum.GOVERNMENT_ID).build();
    // @formatter:on
    final MiraklShopDocument miraklShopProofOfIdentityDocumentFront = new MiraklShopDocument();
    miraklShopProofOfIdentityDocumentFront.setTypeCode("hw-bsh1-proof-identity-front");
    final MiraklShopDocument miraklShopProofOfIdentityDocumentBack = new MiraklShopDocument();
    miraklShopProofOfIdentityDocumentBack.setTypeCode("hw-bsh1-proof-identity-back");
    final List<MiraklShopDocument> miraklShopDocumentsList = List.of(miraklShopProofOfIdentityDocumentFront, miraklShopProofOfIdentityDocumentBack);
    when(miraklMarketplacePlatformOperatorApiClientMock.getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)))).thenReturn(miraklShopDocumentsList);
    final KYCDocumentBusinessStakeHolderInfoModel result = testObj.getBusinessStakeholderDocumentsSelectedBySeller(kycDocumentBusinessStakeHolderInfoModel);
    verify(miraklMarketplacePlatformOperatorApiClientMock).getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)));
    verifyNoMoreInteractions(miraklMarketplacePlatformOperatorApiClientMock);
    assertThat(result.getDocuments()).isEmpty();
}
Also used : KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) MiraklShopDocument(com.mirakl.client.mmp.domain.shop.document.MiraklShopDocument) MiraklGetShopDocumentsRequest(com.mirakl.client.mmp.request.shop.document.MiraklGetShopDocumentsRequest) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 25 with KYCDocumentBusinessStakeHolderInfoModel

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

the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method getBusinessStakeholderDocumentsSelectedBySeller_shouldReturnAnEmptyListWhenNoProofOfAddressNeitherProofOfIdentityHasBeenSelectedBySeller.

@Test
void getBusinessStakeholderDocumentsSelectedBySeller_shouldReturnAnEmptyListWhenNoProofOfAddressNeitherProofOfIdentityHasBeenSelectedBySeller() {
    // @formatter:off
    final KYCDocumentBusinessStakeHolderInfoModel kycBusinessStakeholderNonSelectedDocuments = KYCDocumentBusinessStakeHolderInfoModel.builder().clientUserId(MIRAKL_SHOP_ID).proofOfIdentity(KYCProofOfIdentityEnum.GOVERNMENT_ID).build();
    // @formatter:on
    final KYCDocumentBusinessStakeHolderInfoModel result = testObj.getBusinessStakeholderDocumentsSelectedBySeller(kycBusinessStakeholderNonSelectedDocuments);
    assertThat(result.getDocuments()).isEmpty();
}
Also used : KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

KYCDocumentBusinessStakeHolderInfoModel (com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel)36 Test (org.junit.jupiter.api.Test)27 MiraklAdditionalFieldValue (com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue)11 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)10 HyperwalletVerificationDocument (com.hyperwallet.clientsdk.model.HyperwalletVerificationDocument)8 KYCDocumentModel (com.paypal.kyc.model.KYCDocumentModel)7 HyperwalletException (com.hyperwallet.clientsdk.HyperwalletException)6 MiraklException (com.mirakl.client.core.exception.MiraklException)4 MiraklShopDocument (com.mirakl.client.mmp.domain.shop.document.MiraklShopDocument)4 MiraklUpdatedShops (com.mirakl.client.mmp.operator.domain.shop.update.MiraklUpdatedShops)4 MiraklUpdateShopsRequest (com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest)4 MiraklGetShopDocumentsRequest (com.mirakl.client.mmp.request.shop.document.MiraklGetShopDocumentsRequest)4 Collectors (java.util.stream.Collectors)4 Service (org.springframework.stereotype.Service)4 ObjectUtils (org.springframework.util.ObjectUtils)4 MiraklShop (com.mirakl.client.mmp.domain.shop.MiraklShop)3 Map (java.util.Map)3 HyperwalletUser (com.hyperwallet.clientsdk.model.HyperwalletUser)2 AbstractMiraklShop (com.mirakl.client.mmp.domain.shop.AbstractMiraklShop)2 MiraklShops (com.mirakl.client.mmp.domain.shop.MiraklShops)2