Search in sources :

Example 31 with KYCDocumentBusinessStakeHolderInfoModel

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

the class KYCReadyForReviewServiceMockImplTest method notifyBstkReadyForReview_whenThereIsAnErrorNotifyingToHW_shouldSendAnEmail.

@Test
void notifyBstkReadyForReview_whenThereIsAnErrorNotifyingToHW_shouldSendAnEmail() {
    // @formatter:off
    final KYCDocumentBusinessStakeHolderInfoModel kycDocumentOne = KYCDocumentBusinessStakeHolderInfoModel.builder().clientUserId(SHOP_ID).userToken(List.of(new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(KYCConstants.HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN))).build();
    // @formatter:on
    HyperwalletException hwException = new HyperwalletException("Something bad happened");
    doThrow(hwException).when(restTemplateMock).put(any(String.class), any(String.class), any(Object.class));
    testObj.notifyBstkReadyForReview(Map.entry(USER_TOKEN, List.of(kycDocumentOne)));
    verify(mailNotificationUtilMock).sendPlainTextEmail("Issue in Hyperwallet status notification", String.format("There was an error notifying Hyperwallet all documents were sent for shop Id [2000], so Hyperwallet will not be notified about this new situation%n%s", HyperwalletLoggingErrorsUtil.stringify(hwException)));
    assertThat(logTrackerStub.contains("Error notifying to Hyperwallet that all documents were sent")).isTrue();
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) HyperwalletException(com.hyperwallet.clientsdk.HyperwalletException) KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) Test(org.junit.jupiter.api.Test)

Example 32 with KYCDocumentBusinessStakeHolderInfoModel

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

the class KYCReadyForReviewServiceMockImplTest method notifyReadyForReview_whenBusinessStakeholderIsCorrectlyFilled_shouldCallToNotifyBstk.

@Test
void notifyReadyForReview_whenBusinessStakeholderIsCorrectlyFilled_shouldCallToNotifyBstk() {
    // @formatter:off
    final KYCDocumentBusinessStakeHolderInfoModel kycDocumentOne = KYCDocumentBusinessStakeHolderInfoModel.builder().userToken(List.of(new MiraklAdditionalFieldValue.MiraklStringAdditionalFieldValue(KYCConstants.HYPERWALLET_USER_TOKEN_FIELD, USER_TOKEN))).hyperwalletProgram(HYPERWALLET_PROGRAM).sentToHyperwallet(Boolean.TRUE).build();
    doNothing().when(testObj).notifyBstkReadyForReview(Map.entry(USER_TOKEN, List.of(kycDocumentOne)));
    testObj.notifyReadyForReview(List.of(kycDocumentOne));
    verify(testObj).notifyBstkReadyForReview(Map.entry(USER_TOKEN, List.of(kycDocumentOne)));
}
Also used : MiraklAdditionalFieldValue(com.mirakl.client.mmp.domain.common.MiraklAdditionalFieldValue) KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) Test(org.junit.jupiter.api.Test)

Example 33 with KYCDocumentBusinessStakeHolderInfoModel

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

the class MiraklProofOfAddressStrategyTest method isApplicable_shouldReturnFalseWhenIsProofOfBusinessAndObjectReceivedAsParameterIsNotKYCDocumentSellerInfoModel.

@Test
void isApplicable_shouldReturnFalseWhenIsProofOfBusinessAndObjectReceivedAsParameterIsNotKYCDocumentSellerInfoModel() {
    final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().build();
    final boolean result = testObj.isApplicable(kycDocumentBusinessStakeHolderInfoModel);
    assertThat(result).isFalse();
}
Also used : KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) Test(org.junit.jupiter.api.Test)

Example 34 with KYCDocumentBusinessStakeHolderInfoModel

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

the class MiraklProofOfIdentityStrategyTest method isApplicable_shouldReturnFalseWhenIsProofOfBusinessAndObjectReceivedAsParameterIsNotKYCDocumentSellerInfoModel.

@Test
void isApplicable_shouldReturnFalseWhenIsProofOfBusinessAndObjectReceivedAsParameterIsNotKYCDocumentSellerInfoModel() {
    final KYCDocumentBusinessStakeHolderInfoModel kycDocumentBusinessStakeHolderInfoModel = KYCDocumentBusinessStakeHolderInfoModel.builder().build();
    final boolean result = testObj.isApplicable(kycDocumentBusinessStakeHolderInfoModel);
    assertThat(result).isFalse();
}
Also used : KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) Test(org.junit.jupiter.api.Test)

Example 35 with KYCDocumentBusinessStakeHolderInfoModel

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

the class KYCBusinessStakeholderDocumentInfoModelToLetterOfAuthorizationHyperwalletVerificationDocumentStrategy method execute.

/**
 * {@inheritDoc}
 */
@Override
public HyperwalletVerificationDocument execute(final KYCDocumentBusinessStakeHolderInfoModel source) {
    // @formatter:off
    final Map<String, String> uploadFiles = source.getLetterOfAuthorizationDocument().stream().collect(Collectors.toMap(kycDocumentModel -> LETTER_OF_AUTHORIZATION_NAME, kycDocumentModel -> kycDocumentModel.getFile().getAbsolutePath()));
    // @formatter:on
    final HyperwalletVerificationDocument hyperwalletVerificationDocument = new HyperwalletVerificationDocument();
    hyperwalletVerificationDocument.setType(LETTER_OF_AUTHORIZATION_TYPE);
    hyperwalletVerificationDocument.setCategory(KYCDocumentCategoryEnum.AUTHORIZATION.name());
    hyperwalletVerificationDocument.setUploadFiles(uploadFiles);
    return hyperwalletVerificationDocument;
}
Also used : HyperwalletVerificationDocument(com.hyperwallet.clientsdk.model.HyperwalletVerificationDocument) KYCDocumentBusinessStakeHolderInfoModel(com.paypal.kyc.model.KYCDocumentBusinessStakeHolderInfoModel) Service(org.springframework.stereotype.Service) ObjectUtils(org.springframework.util.ObjectUtils) Map(java.util.Map) KYCDocumentCategoryEnum(com.paypal.kyc.model.KYCDocumentCategoryEnum) Collectors(java.util.stream.Collectors) Strategy(com.paypal.infrastructure.strategy.Strategy) HyperwalletVerificationDocument(com.hyperwallet.clientsdk.model.HyperwalletVerificationDocument)

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