use of com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel in project mirakl-hyperwallet-connector by paypal.
the class MiraklBusinessStakeholderDocumentDownloadExtractServiceImplTest method getBusinessStakeholderDocumentsSelectedBySeller_whenDocumentsAremissingForShop_shouldReturnShopDocument_andNeverSelectDocuments.
@MethodSource("documents")
@ParameterizedTest
void getBusinessStakeholderDocumentsSelectedBySeller_whenDocumentsAremissingForShop_shouldReturnShopDocument_andNeverSelectDocuments(final KYCDocumentBusinessStakeHolderInfoModel document) {
doReturn(document).when(testObj).populateMiraklShopBusinessStakeholderDocuments(KYCDocumentBusinessStakeHolderInfoModelMock);
final KYCDocumentBusinessStakeHolderInfoModel result = testObj.getBusinessStakeholderDocumentsSelectedBySeller(KYCDocumentBusinessStakeHolderInfoModelMock);
assertThat(result).isEqualTo(document);
verify(proofOfIdentityStrategyExecutorMock, never()).execute(any());
}
use of com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel 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.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel 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.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel in project mirakl-hyperwallet-connector by paypal.
the class KYCReadyForReviewServiceImplTest method notifyBstk_shouldShowLogSayingClientIdHasNoHyperwalletProgramAssigned.
@Test
void notifyBstk_shouldShowLogSayingClientIdHasNoHyperwalletProgramAssigned() {
// @formatter:off
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentOne = KYCDocumentBusinessStakeHolderInfoModel.builder().clientUserId("2000").userToken(List.of(new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(KYCConstants.HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN_1))).build();
// @formatter:on
testObj.notifyBstkReadyForReview(Map.entry(USER_TOKEN_1, List.of(kycDocumentOne)));
assertThat(logTrackerStub.contains("Seller with shop Id [2000] has no Hyperwallet Program")).isTrue();
}
use of com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel in project mirakl-hyperwallet-connector by paypal.
the class KYCReadyForReviewServiceImplTest method notifyBstkReadyForReview_shouldRunNotifyBusinessStakeholderToHW.
@Test
void notifyBstkReadyForReview_shouldRunNotifyBusinessStakeholderToHW() {
// @formatter:off
final KYCDocumentBusinessStakeHolderInfoModel kycDocumentOne = KYCDocumentBusinessStakeHolderInfoModel.builder().hyperwalletProgram(HYPERWALLET_PROGRAM).userToken(List.of(new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(KYCConstants.HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN_1))).build();
// @formatter:on
when(hyperwalletApiClientMock.updateUser(Mockito.any(HyperwalletUser.class))).thenReturn(hyperwalletUserMock);
when(hyperwalletUserMock.getClientUserId()).thenReturn(SHOP_ID);
when(hyperwalletSDKServiceMock.getHyperwalletInstance(HYPERWALLET_PROGRAM)).thenReturn(hyperwalletApiClientMock);
testObj.notifyBstkReadyForReview(Map.entry(USER_TOKEN_1, List.of(kycDocumentOne)));
verify(hyperwalletApiClientMock).updateUser(hyperwalletUserCaptor.capture());
final HyperwalletUser hyperwalletUser = hyperwalletUserCaptor.getValue();
assertThat(hyperwalletUser.getToken()).isEqualTo(USER_TOKEN_1);
assertThat(hyperwalletUser.getBusinessStakeholderVerificationStatus()).isEqualTo(HyperwalletUser.BusinessStakeholderVerificationStatus.READY_FOR_REVIEW);
}
Aggregations