use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class AbstractKYCUserStatusExecutorNotificationStrategyTest method updateShop_whenIsKycManualFlow_shouldCallMiraklApiModifyingKYCWithoutUpdatingLetterOfAuthorizationAndVerificationStatus.
@Test
void updateShop_whenIsKycManualFlow_shouldCallMiraklApiModifyingKYCWithoutUpdatingLetterOfAuthorizationAndVerificationStatus() {
when(testObj.isKycAutomated()).thenReturn(false);
when(kycUserStatusNotificationBodyModelMock.getClientUserId()).thenReturn(SHOP_ID);
when(kycUserStatusNotificationBodyModelMock.getReasonsType()).thenReturn(List.of(KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED));
lenient().when(kycUserStatusNotificationBodyModelMock.getVerificationStatus()).thenReturn(HyperwalletUser.VerificationStatus.REQUIRED);
lenient().when(kycUserStatusNotificationBodyModelMock.getLetterOfAuthorizationStatus()).thenReturn(HyperwalletUser.LetterOfAuthorizationStatus.REQUIRED);
when(miraklMarketplacePlatformOperatorApiClientMock.updateShops(any(MiraklUpdateShopsRequest.class))).thenReturn(miraklUpdatedShopResponseMock);
when(testObj.expectedKycMiraklStatus(kycUserStatusNotificationBodyModelMock)).thenReturn(MiraklShopKycStatus.REFUSED);
when(kycRejectionReasonServiceMock.getRejectionReasonDescriptions(List.of(KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED))).thenReturn(KYCRejectionReasonTypeEnum.getReasonHeader() + KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED.getReason() + KYCRejectionReasonTypeEnum.getReasonFooter());
testObj.updateShop(kycUserStatusNotificationBodyModelMock);
verify(miraklMarketplacePlatformOperatorApiClientMock).updateShops(miraklUpdateShopMockArgumentCaptor.capture());
final MiraklUpdateShopsRequest request = miraklUpdateShopMockArgumentCaptor.getValue();
verify(kycRejectionReasonServiceMock).getRejectionReasonDescriptions(List.of(KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED));
assertThat(request.getShops()).hasSize(1);
assertThat(request.getShops().get(0).getShopId()).isEqualTo(Long.valueOf(SHOP_ID));
final List<MiraklRequestAdditionalFieldValue> additionalFieldValue = request.getShops().get(0).getAdditionalFieldValues();
assertThat(additionalFieldValue).isNull();
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class AbstractKYCUserStatusExecutorNotificationStrategyTest method updateShop_whenIsKycAutomatedFlow_shouldCallMiraklApiModifyingKYCLetterOfAuthorizationAndVerificationStatus.
@Test
void updateShop_whenIsKycAutomatedFlow_shouldCallMiraklApiModifyingKYCLetterOfAuthorizationAndVerificationStatus() {
when(testObj.isKycAutomated()).thenReturn(true);
when(kycUserStatusNotificationBodyModelMock.getClientUserId()).thenReturn(SHOP_ID);
when(kycUserStatusNotificationBodyModelMock.getReasonsType()).thenReturn(List.of(KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED));
when(kycUserStatusNotificationBodyModelMock.getVerificationStatus()).thenReturn(HyperwalletUser.VerificationStatus.REQUIRED);
when(kycUserStatusNotificationBodyModelMock.getLetterOfAuthorizationStatus()).thenReturn(HyperwalletUser.LetterOfAuthorizationStatus.REQUIRED);
when(miraklMarketplacePlatformOperatorApiClientMock.updateShops(any(MiraklUpdateShopsRequest.class))).thenReturn(miraklUpdatedShopResponseMock);
when(testObj.expectedKycMiraklStatus(kycUserStatusNotificationBodyModelMock)).thenReturn(MiraklShopKycStatus.REFUSED);
when(kycRejectionReasonServiceMock.getRejectionReasonDescriptions(List.of(KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED))).thenReturn(KYCRejectionReasonTypeEnum.getReasonHeader() + KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED.getReason() + KYCRejectionReasonTypeEnum.getReasonFooter());
testObj.updateShop(kycUserStatusNotificationBodyModelMock);
verify(miraklMarketplacePlatformOperatorApiClientMock).updateShops(miraklUpdateShopMockArgumentCaptor.capture());
final MiraklUpdateShopsRequest request = miraklUpdateShopMockArgumentCaptor.getValue();
verify(kycRejectionReasonServiceMock).getRejectionReasonDescriptions(List.of(KYCRejectionReasonTypeEnum.LETTER_OF_AUTHORIZATION_REQUIRED));
assertThat(request.getShops()).hasSize(1);
assertThat(request.getShops().get(0).getShopId()).isEqualTo(Long.valueOf(SHOP_ID));
final List<MiraklRequestAdditionalFieldValue> additionalFieldValue = request.getShops().get(0).getAdditionalFieldValues();
assertThat(additionalFieldValue).hasSize(2);
final List<String> additionalCodes = additionalFieldValue.stream().map(MiraklRequestAdditionalFieldValue::getCode).collect(Collectors.toList());
assertThat(additionalCodes).containsExactlyInAnyOrder(HYPERWALLET_KYC_REQUIRED_PROOF_AUTHORIZATION_BUSINESS_FIELD, HYPERWALLET_KYC_REQUIRED_PROOF_IDENTITY_BUSINESS_FIELD);
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class BusinessKYCUserLOAStatusNotificationStrategyTest method execute_shouldCallUpdateMiraklLOAStatus.
@Test
void execute_shouldCallUpdateMiraklLOAStatus() {
when(kycHyperwalletApiConfigMock.getUserStoreTokens()).thenReturn(USER_STORE_TOKENS);
when(hyperwalletSDKServiceMock.getHyperwalletInstance(anyString())).thenReturn(hyperwalletMock);
when(kycBusinessStakeholderStatusNotificationBodyModelMock.getUserToken()).thenReturn(USER_TOKEN);
when(hyperwalletMock.getUser(USER_TOKEN)).thenReturn(hyperwalletUserMock);
when(hyperwalletUserMock.getClientUserId()).thenReturn(MIRAKL_SHOP_ID);
when(hyperwalletUserMock.getLetterOfAuthorizationStatus()).thenReturn(HyperwalletUser.LetterOfAuthorizationStatus.REQUIRED);
when(miraklMarketplacePlatformOperatorApiClientMock.updateShops(miraklUpdateShopsRequestArgumentCaptor.capture())).thenReturn(miraklUpdatedShopsMock);
testObj.execute(kycBusinessStakeholderStatusNotificationBodyModelMock);
final MiraklUpdateShopsRequest miraklUpdateShopsRequestArgumentCaptorValue = miraklUpdateShopsRequestArgumentCaptor.getValue();
final MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue result = (MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue) miraklUpdateShopsRequestArgumentCaptorValue.getShops().get(0).getAdditionalFieldValues().get(0);
assertThat(result.getCode()).isEqualTo(KYCConstants.HYPERWALLET_KYC_REQUIRED_PROOF_AUTHORIZATION_BUSINESS_FIELD);
assertThat(result.getValue()).isEqualTo(Boolean.TRUE.toString());
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class IndividualKYCBusinessStakeholderStatusExecutorNotificationStrategyTest method updateMiraklProofIdentityFlagStatus_whenStatusIsRequired_shouldUpdateMiraklWithProofOfIdentityNeeded.
@Test
void updateMiraklProofIdentityFlagStatus_whenStatusIsRequired_shouldUpdateMiraklWithProofOfIdentityNeeded() {
when(miraklMarketplacePlatformOperatorApiClientMock.updateShops(miraklUpdateShopsRequestArgumentCaptor.capture())).thenReturn(miraklUpdatedShopsMock);
testObj.updateMiraklProofIdentityFlagStatus(MIRAKL_SHOP_ID, BSTK_PROOF_IDENTITY_FIELD, HyperwalletUser.VerificationStatus.REQUIRED);
final MiraklUpdateShopsRequest result = miraklUpdateShopsRequestArgumentCaptor.getValue();
final List<MiraklRequestAdditionalFieldValue> additionalFieldValuesToBeChanged = result.getShops().get(0).getAdditionalFieldValues();
assertThat(additionalFieldValuesToBeChanged).hasSize(1);
final MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue miraklSimpleRequestAdditionalFieldValue = (MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue) additionalFieldValuesToBeChanged.get(0);
assertThat(miraklSimpleRequestAdditionalFieldValue.getCode()).isEqualTo(BSTK_PROOF_IDENTITY_FIELD);
assertThat(miraklSimpleRequestAdditionalFieldValue.getValue()).isEqualTo("true");
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class IndividualKYCBusinessStakeholderStatusExecutorNotificationStrategyTest method updateMiraklProofIdentityFlagStatus_whenStatusIsNotRequired_shouldUpdateMiraklWithProofOfIdentityNotNeeded.
@Test
void updateMiraklProofIdentityFlagStatus_whenStatusIsNotRequired_shouldUpdateMiraklWithProofOfIdentityNotNeeded() {
when(miraklMarketplacePlatformOperatorApiClientMock.updateShops(miraklUpdateShopsRequestArgumentCaptor.capture())).thenReturn(miraklUpdatedShopsMock);
testObj.updateMiraklProofIdentityFlagStatus(MIRAKL_SHOP_ID, BSTK_PROOF_IDENTITY_FIELD, HyperwalletUser.VerificationStatus.NOT_REQUIRED);
final MiraklUpdateShopsRequest result = miraklUpdateShopsRequestArgumentCaptor.getValue();
final List<MiraklRequestAdditionalFieldValue> additionalFieldValuesToBeChanged = result.getShops().get(0).getAdditionalFieldValues();
assertThat(additionalFieldValuesToBeChanged).hasSize(1);
final MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue miraklSimpleRequestAdditionalFieldValue = (MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue) additionalFieldValuesToBeChanged.get(0);
assertThat(miraklSimpleRequestAdditionalFieldValue.getCode()).isEqualTo(BSTK_PROOF_IDENTITY_FIELD);
assertThat(miraklSimpleRequestAdditionalFieldValue.getValue()).isEqualTo("false");
}
Aggregations