use of com.mirakl.client.mmp.domain.shop.document.MiraklShopDocument 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();
}
use of com.mirakl.client.mmp.domain.shop.document.MiraklShopDocument in project mirakl-hyperwallet-connector by paypal.
the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method getBusinessStakeholderDocumentsSelectedBySeller_shouldPopulateKYCInfoModelWithDocumentInformationAndReturnDocumentsReturnedByStrategies.
@Test
void getBusinessStakeholderDocumentsSelectedBySeller_shouldPopulateKYCInfoModelWithDocumentInformationAndReturnDocumentsReturnedByStrategies() {
// @formatter:off
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().businessStakeholderMiraklNumber(1).clientUserId(MIRAKL_SHOP_ID).proofOfIdentity(KYCProofOfIdentityEnum.GOVERNMENT_ID).build();
// @formatter:on
final KYCDocumentModel kycDocumentModelFront = KYCDocumentModel.builder().documentFieldName(KYCConstants.HwDocuments.PROOF_OF_IDENTITY_FRONT).build();
final KYCDocumentModel kycDocumentModelBack = KYCDocumentModel.builder().documentFieldName(KYCConstants.HwDocuments.PROOF_OF_IDENTITY_BACK).build();
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 kycDocumentBusinessStakeholderInfoModelWithMiraklDocumentsShopInformation = kycDocumentBusinessStakeHolderInfoModel.toBuilder().miraklShopDocuments(miraklShopDocumentsList).build();
when(proofOfIdentityStrategyExecutorMock.execute(kycDocumentBusinessStakeholderInfoModelWithMiraklDocumentsShopInformation)).thenReturn(List.of(List.of(kycDocumentModelFront, kycDocumentModelBack)));
final KYCDocumentBusinessStakeHolderInfoModel result = testObj.getBusinessStakeholderDocumentsSelectedBySeller(kycDocumentBusinessStakeHolderInfoModel);
verify(miraklMarketplacePlatformOperatorApiClientMock).getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)));
verifyNoMoreInteractions(miraklMarketplacePlatformOperatorApiClientMock);
assertThat(result.getDocuments()).containsExactlyInAnyOrder(kycDocumentModelFront, kycDocumentModelBack);
}
use of com.mirakl.client.mmp.domain.shop.document.MiraklShopDocument in project mirakl-hyperwallet-connector by paypal.
the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method getBusinessStakeholderDocumentsSelectedBySeller_shouldPopulateKYCInfoModelWithDocumentInformationAndReturnDocumentsReturnedByStrategies_whenLetterOfAuthorizationIsRequiredAndLetterOfAuthorizationDocumentIsFilled.
@Test
void getBusinessStakeholderDocumentsSelectedBySeller_shouldPopulateKYCInfoModelWithDocumentInformationAndReturnDocumentsReturnedByStrategies_whenLetterOfAuthorizationIsRequiredAndLetterOfAuthorizationDocumentIsFilled() {
// @formatter:off
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().businessStakeholderMiraklNumber(1).requiresLetterOfAuthorization(Boolean.TRUE).clientUserId(MIRAKL_SHOP_ID).proofOfIdentity(KYCProofOfIdentityEnum.GOVERNMENT_ID).build();
// @formatter:on
final KYCDocumentModel kycDocumentModelProofOfIdentityFront = KYCDocumentModel.builder().documentFieldName(KYCConstants.HwDocuments.PROOF_OF_IDENTITY_FRONT).build();
final KYCDocumentModel kycDocumentModelProofOfIdentityBack = KYCDocumentModel.builder().documentFieldName(KYCConstants.HwDocuments.PROOF_OF_IDENTITY_BACK).build();
final KYCDocumentModel kycDocumentModelLetterOfAuthorization = KYCDocumentModel.builder().documentFieldName(KYCConstants.HwDocuments.PROOF_OF_AUTHORIZATION).build();
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 MiraklShopDocument miraklShopLetterOfAuthorizationDocument = new MiraklShopDocument();
miraklShopProofOfIdentityDocumentBack.setTypeCode("hw-bsh-letter-authorization");
final List<MiraklShopDocument> miraklShopDocumentsList = List.of(miraklShopProofOfIdentityDocumentFront, miraklShopProofOfIdentityDocumentBack, miraklShopLetterOfAuthorizationDocument);
when(miraklMarketplacePlatformOperatorApiClientMock.getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)))).thenReturn(miraklShopDocumentsList);
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeholderInfoModelWithMiraklDocumentsShopInformation = kycDocumentBusinessStakeHolderInfoModel.toBuilder().miraklShopDocuments(miraklShopDocumentsList).build();
when(proofOfIdentityStrategyExecutorMock.execute(kycDocumentBusinessStakeholderInfoModelWithMiraklDocumentsShopInformation)).thenReturn(List.of(List.of(kycDocumentModelProofOfIdentityFront, kycDocumentModelProofOfIdentityBack, kycDocumentModelLetterOfAuthorization)));
final KYCDocumentBusinessStakeHolderInfoModel result = testObj.getBusinessStakeholderDocumentsSelectedBySeller(kycDocumentBusinessStakeHolderInfoModel);
verify(miraklMarketplacePlatformOperatorApiClientMock).getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)));
verifyNoMoreInteractions(miraklMarketplacePlatformOperatorApiClientMock);
assertThat(result.getDocuments()).containsExactlyInAnyOrder(kycDocumentModelProofOfIdentityFront, kycDocumentModelProofOfIdentityBack, kycDocumentModelLetterOfAuthorization);
}
use of com.mirakl.client.mmp.domain.shop.document.MiraklShopDocument in project mirakl-hyperwallet-connector by paypal.
the class KYCDocumentBusinessStakeHolderInfoModelTest method existsLetterOfAuthorizationDocumentInMirakl_shouldReturnTrueWhenMiraklContainsProofOfAuthorizationAndRequiresLetterOfAuthorizationIsTrue.
@Test
void existsLetterOfAuthorizationDocumentInMirakl_shouldReturnTrueWhenMiraklContainsProofOfAuthorizationAndRequiresLetterOfAuthorizationIsTrue() {
// @formatter:off
final MiraklShopDocument documentForLetterOfAuthorization = new MiraklShopDocument();
documentForLetterOfAuthorization.setTypeCode(PROOF_OF_AUTHORIZATION);
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeholderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().contact(Boolean.TRUE).miraklShopDocuments(List.of(documentForLetterOfAuthorization)).requiresLetterOfAuthorization(Boolean.TRUE).build();
// @formatter:on
final boolean result = kycDocumentBusinessStakeholderInfoModel.existsLetterOfAuthorizationDocumentInMirakl();
assertThat(result).isTrue();
}
use of com.mirakl.client.mmp.domain.shop.document.MiraklShopDocument in project mirakl-hyperwallet-connector by paypal.
the class KYCDocumentBusinessStakeHolderInfoModelTest method existsLetterOfAuthorizationDocumentInMirakl_shouldReturnTrueWhenMiraklNotContainsProofOfAuthorizationAndRequiresLetterOfAuthorizationIsTrue.
@Test
void existsLetterOfAuthorizationDocumentInMirakl_shouldReturnTrueWhenMiraklNotContainsProofOfAuthorizationAndRequiresLetterOfAuthorizationIsTrue() {
// @formatter:off
final MiraklShopDocument documentDifferentFromLetterOfAuthorization = new MiraklShopDocument();
documentDifferentFromLetterOfAuthorization.setTypeCode(PROOF_OF_IDENTITY_TYPE);
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeholderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().contact(Boolean.TRUE).miraklShopDocuments(List.of(documentDifferentFromLetterOfAuthorization)).requiresLetterOfAuthorization(Boolean.TRUE).build();
// @formatter:on
final boolean result = kycDocumentBusinessStakeholderInfoModel.existsLetterOfAuthorizationDocumentInMirakl();
assertThat(result).isFalse();
}
Aggregations