use of com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.
the class MiraklBusinessStakeholderDocumentsExtractServiceImpl method getMiraklUpdateShopWithProofOfDocumentFields.
private MiraklUpdateShop getMiraklUpdateShopWithProofOfDocumentFields(final Map.Entry<String, List<KYCDocumentBusinessStakeHolderInfoModel>> entry) {
final MiraklUpdateShop miraklUpdateShop = new MiraklUpdateShop();
miraklUpdateShop.setShopId(Long.valueOf(entry.getKey()));
// @formatter:off
final List<MiraklRequestAdditionalFieldValue> additionalValues = entry.getValue().stream().filter(KYCDocumentBusinessStakeHolderInfoModel::isRequiresKYC).map(businessStakeholder -> new MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue(HYPERWALLET_PREFIX + STAKEHOLDER_PREFIX + REQUIRED_PROOF_IDENTITY + businessStakeholder.getBusinessStakeholderMiraklNumber(), Boolean.FALSE.toString().toLowerCase())).collect(Collectors.toList());
additionalValues.addAll(entry.getValue().stream().filter(KYCDocumentBusinessStakeHolderInfoModel::isRequiresLetterOfAuthorization).map(businessStakeholder -> new MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue(HYPERWALLET_KYC_REQUIRED_PROOF_AUTHORIZATION_BUSINESS_FIELD, Boolean.FALSE.toString().toLowerCase())).collect(Collectors.toList()));
// @formatter:on
miraklUpdateShop.setAdditionalFieldValues(additionalValues);
return miraklUpdateShop;
}
use of com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.
the class AbstractKYCUserStatusNotificationStrategy method createUpdateShopRequest.
private MiraklUpdateShopsRequest createUpdateShopRequest(final KYCUserStatusNotificationBodyModel kycUserStatusNotificationBodyModel, final MiraklShopKycStatus status) {
final String shopId = kycUserStatusNotificationBodyModel.getClientUserId();
final MiraklUpdateShop miraklUpdateShop = new MiraklUpdateShop();
miraklUpdateShop.setShopId(Long.valueOf(shopId));
// @formatter:off
miraklUpdateShop.setKyc(new MiraklShopKyc(status, kycRejectionReasonService.getRejectionReasonDescriptions(kycUserStatusNotificationBodyModel.getReasonsType())));
if (isKycAutomated()) {
final List<MiraklRequestAdditionalFieldValue> additionalFieldValues = new ArrayList<>();
if (HyperwalletUser.VerificationStatus.REQUIRED.equals(kycUserStatusNotificationBodyModel.getVerificationStatus())) {
final MiraklSimpleRequestAdditionalFieldValue kycVerificationStatusCustomField = new MiraklSimpleRequestAdditionalFieldValue();
kycVerificationStatusCustomField.setCode(HYPERWALLET_KYC_REQUIRED_PROOF_IDENTITY_BUSINESS_FIELD);
kycVerificationStatusCustomField.setValue(Boolean.TRUE.toString());
additionalFieldValues.add(kycVerificationStatusCustomField);
}
if (HyperwalletUser.LetterOfAuthorizationStatus.REQUIRED.equals(kycUserStatusNotificationBodyModel.getLetterOfAuthorizationStatus())) {
final MiraklSimpleRequestAdditionalFieldValue kycLetterOfAuthorizationStatusCustomField = new MiraklSimpleRequestAdditionalFieldValue();
kycLetterOfAuthorizationStatusCustomField.setCode(HYPERWALLET_KYC_REQUIRED_PROOF_AUTHORIZATION_BUSINESS_FIELD);
kycLetterOfAuthorizationStatusCustomField.setValue(Boolean.TRUE.toString());
additionalFieldValues.add(kycLetterOfAuthorizationStatusCustomField);
}
if (!CollectionUtils.isEmpty(additionalFieldValues)) {
miraklUpdateShop.setAdditionalFieldValues(additionalFieldValues);
}
}
return new MiraklUpdateShopsRequest(List.of(miraklUpdateShop));
}
use of com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.
the class MiraklBusinessStakeholderExtractServiceImplTest method updateBusinessStakeholderToken_shouldUpdateValueForCustomFieldHwUserToken.
@DisplayName("Should Update Value for Custom Field 'hw-user-token'")
@Test
void updateBusinessStakeholderToken_shouldUpdateValueForCustomFieldHwUserToken() {
when(sellerModelMock.getBusinessStakeHolderDetails()).thenReturn(List.of(businessStakeHolderModelMock));
when(sellerModelMock.getClientUserId()).thenReturn("12345");
when(businessStakeHolderModelMock.getToken()).thenReturn(BUSINESS_STAKE_HOLDER_TOKEN);
when(businessStakeHolderModelMock.getStkId()).thenReturn(1);
testObj.updateBusinessStakeholderToken(sellerModelMock.getClientUserId(), sellerModelMock.getBusinessStakeHolderDetails());
verify(miraklMarketplacePlatformOperatorApiClientMock).updateShops(miraklUpdateShopsRequestCaptor.capture());
final MiraklUpdateShopsRequest miraklUpdateShopsRequest = miraklUpdateShopsRequestCaptor.getValue();
assertThat(miraklUpdateShopsRequest.getShops()).hasSize(1);
final MiraklUpdateShop shopToUpdate = miraklUpdateShopsRequest.getShops().get(0);
assertThat(shopToUpdate).hasFieldOrPropertyWithValue("shopId", 12345L);
assertThat(shopToUpdate.getAdditionalFieldValues()).hasSize(1);
final MiraklRequestAdditionalFieldValue additionalFieldValue = shopToUpdate.getAdditionalFieldValues().get(0);
assertThat(additionalFieldValue).isInstanceOf(MiraklSimpleRequestAdditionalFieldValue.class);
final MiraklSimpleRequestAdditionalFieldValue castedAdditionalFieldValue = (MiraklSimpleRequestAdditionalFieldValue) additionalFieldValue;
assertThat(castedAdditionalFieldValue.getCode()).isEqualTo("hw-stakeholder-token-1");
assertThat(castedAdditionalFieldValue.getValue()).isEqualTo(BUSINESS_STAKE_HOLDER_TOKEN);
}
use of com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.
the class MiraklBankAccountExtractServiceImplTest method updateBankAccountToken_shouldUpdateValueForCustomFieldHwBankAccountToken.
@DisplayName("Should Update Value for Custom Field 'hw-bankaccount-token'")
@Test
void updateBankAccountToken_shouldUpdateValueForCustomFieldHwBankAccountToken() {
when(hyperwalletBankAccount.getToken()).thenReturn(TOKEN_VALUE);
when(sellerModelMock.getClientUserId()).thenReturn("12345");
testObj.updateBankAccountToken(sellerModelMock, hyperwalletBankAccount);
verify(miraklMarketplacePlatformOperatorApiClientMock).updateShops(miraklUpdateShopsRequestCaptor.capture());
final MiraklUpdateShopsRequest miraklUpdateShopsRequest = miraklUpdateShopsRequestCaptor.getValue();
assertThat(miraklUpdateShopsRequest.getShops()).hasSize(1);
final MiraklUpdateShop shopToUpdate = miraklUpdateShopsRequest.getShops().get(0);
assertThat(shopToUpdate).hasFieldOrPropertyWithValue("shopId", 12345L);
assertThat(shopToUpdate.getAdditionalFieldValues()).hasSize(1);
final MiraklRequestAdditionalFieldValue additionalFieldValue = shopToUpdate.getAdditionalFieldValues().get(0);
assertThat(additionalFieldValue).isInstanceOf(MiraklSimpleRequestAdditionalFieldValue.class);
final MiraklSimpleRequestAdditionalFieldValue castedAdditionalFieldValue = (MiraklSimpleRequestAdditionalFieldValue) additionalFieldValue;
assertThat(castedAdditionalFieldValue.getCode()).isEqualTo("hw-bankaccount-token");
assertThat(castedAdditionalFieldValue.getValue()).isEqualTo(TOKEN_VALUE);
}
use of com.mirakl.client.mmp.request.additionalfield.MiraklRequestAdditionalFieldValue in project mirakl-hyperwallet-connector by paypal.
the class AbstractKYCUserStatusExecutorNotificationStrategyTest method updateShop_shouldCallMiraklApiWithValuesProvidedModifyingKYCVerificationStatus.
@Test
void updateShop_shouldCallMiraklApiWithValuesProvidedModifyingKYCVerificationStatus() {
when(testObj.isKycAutomated()).thenReturn(true);
when(kycUserStatusNotificationBodyModelMock.getClientUserId()).thenReturn(SHOP_ID);
when(kycUserStatusNotificationBodyModelMock.getVerificationStatus()).thenReturn(HyperwalletUser.VerificationStatus.REQUIRED);
when(miraklMarketplacePlatformOperatorApiClientMock.updateShops(any(MiraklUpdateShopsRequest.class))).thenReturn(miraklUpdatedShopResponseMock);
when(testObj.expectedKycMiraklStatus(kycUserStatusNotificationBodyModelMock)).thenReturn(MiraklShopKycStatus.REFUSED);
testObj.updateShop(kycUserStatusNotificationBodyModelMock);
verify(miraklMarketplacePlatformOperatorApiClientMock).updateShops(miraklUpdateShopMockArgumentCaptor.capture());
final MiraklUpdateShopsRequest request = miraklUpdateShopMockArgumentCaptor.getValue();
assertThat(request.getShops()).hasSize(1);
assertThat(request.getShops().get(0).getShopId()).isEqualTo(Long.valueOf(SHOP_ID));
assertThat(request.getShops().get(0).getKyc().getStatus()).isEqualTo(MiraklShopKycStatus.REFUSED);
final MiraklRequestAdditionalFieldValue additionalFieldValue = request.getShops().get(0).getAdditionalFieldValues().get(0);
final MiraklSimpleRequestAdditionalFieldValue castedAdditionalFieldValue = (MiraklSimpleRequestAdditionalFieldValue) additionalFieldValue;
assertThat(castedAdditionalFieldValue.getCode()).isEqualTo(HYPERWALLET_KYC_REQUIRED_PROOF_IDENTITY_BUSINESS_FIELD);
assertThat(castedAdditionalFieldValue.getValue()).isEqualTo("true");
}
Aggregations