use of com.mirakl.client.mmp.request.shop.document.MiraklGetShopDocumentsRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellerDocumentDownloadExtractServiceImplTest method getDocumentsSelectedBySeller_shouldSendMailNotificationWhenMiraklExceptionIsThrown.
@Test
void getDocumentsSelectedBySeller_shouldSendMailNotificationWhenMiraklExceptionIsThrown() {
// formatter:off
final KYCDocumentSellerInfoModel kycDocumentSellerInfoModel = KYCDocumentSellerInfoModel.builder().clientUserId(MIRAKL_SHOP_ID).proofOfIdentity(KYCProofOfIdentityEnum.GOVERNMENT_ID).proofOfAddress(KYCProofOfAddressEnum.BANK_STATEMENT).build();
// formatter:on
final MiraklException miraklException = new MiraklException("Something wrong happened");
doThrow(miraklException).when(miraklMarketplacePlatformOperatorApiClientMock).getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)));
testObj.getDocumentsSelectedBySeller(kycDocumentSellerInfoModel);
verify(kycMailNotificationUtilMock).sendPlainTextEmail("Issue detected getting documents from Mirakl", String.format("Something went wrong getting documents from Mirakl for shop Id [%s]%n%s", String.join(",", kycDocumentSellerInfoModel.getClientUserId()), MiraklLoggingErrorsUtil.stringify(miraklException)));
}
use of com.mirakl.client.mmp.request.shop.document.MiraklGetShopDocumentsRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellerDocumentDownloadExtractServiceImplTest method getDocumentsSelectedBySeller_shouldPopulateKYCInfoModelWithDocumentInformationAndReturnDocumentsReturnedByStrategies.
@Test
void getDocumentsSelectedBySeller_shouldPopulateKYCInfoModelWithDocumentInformationAndReturnDocumentsReturnedByStrategies() {
final KYCDocumentSellerInfoModel kycDocumentSellerInfoModel = KYCDocumentSellerInfoModel.builder().clientUserId(MIRAKL_SHOP_ID).proofOfIdentity(KYCProofOfIdentityEnum.GOVERNMENT_ID).proofOfAddress(KYCProofOfAddressEnum.BANK_STATEMENT).build();
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-ind-proof-identity-front");
final MiraklShopDocument miraklShopProofOfIdentityDocumentBack = new MiraklShopDocument();
miraklShopProofOfIdentityDocumentBack.setTypeCode("hw-ind-proof-identity-back");
final MiraklShopDocument miraklShopProofOfAddressFront = new MiraklShopDocument();
miraklShopProofOfAddressFront.setTypeCode("hw-ind-proof-address");
final List<MiraklShopDocument> miraklShopDocumentsList = List.of(miraklShopProofOfIdentityDocumentFront, miraklShopProofOfIdentityDocumentBack, miraklShopProofOfAddressFront);
when(miraklMarketplacePlatformOperatorApiClientMock.getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)))).thenReturn(miraklShopDocumentsList);
final KYCDocumentSellerInfoModel kycDocumentSellerInfoModelWithMiraklDocumentsShopInformation = kycDocumentSellerInfoModel.toBuilder().miraklShopDocuments(miraklShopDocumentsList).build();
when(proofOfIdentityStrategyExecutorMock.execute(kycDocumentSellerInfoModelWithMiraklDocumentsShopInformation)).thenReturn(List.of(List.of(kycDocumentModelFront, kycDocumentModelBack)));
final KYCDocumentSellerInfoModel result = testObj.getDocumentsSelectedBySeller(kycDocumentSellerInfoModel);
verify(miraklMarketplacePlatformOperatorApiClientMock).getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)));
verifyNoMoreInteractions(miraklMarketplacePlatformOperatorApiClientMock);
assertThat(result.getDocuments()).containsExactlyInAnyOrder(kycDocumentModelFront, kycDocumentModelBack);
}
use of com.mirakl.client.mmp.request.shop.document.MiraklGetShopDocumentsRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method getBusinessStakeholderDocumentsSelectedBySeller_shouldSendMailNotificationWhenMiraklExceptionIsThrown.
@Test
void getBusinessStakeholderDocumentsSelectedBySeller_shouldSendMailNotificationWhenMiraklExceptionIsThrown() {
// @formatter:off
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().businessStakeholderMiraklNumber(1).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 MiraklException miraklException = new MiraklException("Something wrong happened");
doThrow(miraklException).when(miraklMarketplacePlatformOperatorApiClientMock).getShopDocuments(new MiraklGetShopDocumentsRequest(List.of(MIRAKL_SHOP_ID)));
testObj.getBusinessStakeholderDocumentsSelectedBySeller(kycDocumentBusinessStakeHolderInfoModel);
verify(kycMailNotificationUtilMock).sendPlainTextEmail("Issue detected getting business stakeholder documents from Mirakl", String.format("Something went wrong getting documents from Mirakl for shop Id [%s]%n%s", String.join(",", kycDocumentBusinessStakeHolderInfoModel.getClientUserId()), MiraklLoggingErrorsUtil.stringify(miraklException)));
}
use of com.mirakl.client.mmp.request.shop.document.MiraklGetShopDocumentsRequest 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.request.shop.document.MiraklGetShopDocumentsRequest 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);
}
Aggregations