use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class BusinessKYCUserLOAStatusNotificationStrategy method updateMiraklLOAStatus.
protected void updateMiraklLOAStatus(final String miraklShopId, final HyperwalletUser.LetterOfAuthorizationStatus letterOfAuthorizationStatus) {
final MiraklUpdateShop updateShop = new MiraklUpdateShop();
final String isLetterOfAuthorizationRequired = Boolean.toString(isLetterOfAuthorizationRequired(letterOfAuthorizationStatus));
final MiraklSimpleRequestAdditionalFieldValue miraklSimpleRequestAdditionalFieldValue = new MiraklSimpleRequestAdditionalFieldValue(KYCConstants.HYPERWALLET_KYC_REQUIRED_PROOF_AUTHORIZATION_BUSINESS_FIELD, isLetterOfAuthorizationRequired);
updateShop.setShopId(Long.valueOf(miraklShopId));
updateShop.setAdditionalFieldValues(List.of(miraklSimpleRequestAdditionalFieldValue));
log.info("Updating KYC Letter of authorization flag in Mirakl for business Stakeholder for shopId [{}]", miraklShopId);
final MiraklUpdateShopsRequest miraklUpdateShopsRequest = new MiraklUpdateShopsRequest(List.of(updateShop));
miraklMarketplacePlatformOperatorApiClient.updateShops(miraklUpdateShopsRequest);
log.info("Letter of authorization flag updated to '{}', for business Stakeholder in shopId [{}]", isLetterOfAuthorizationRequired, miraklShopId);
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class AbstractUserDocumentFlagsStrategy method fillMiraklProofIdentityOrBusinessFlagStatus.
protected void fillMiraklProofIdentityOrBusinessFlagStatus(final KYCUserDocumentFlagsNotificationBodyModel source) {
final MiraklUpdateShop updateShop = new MiraklUpdateShop();
final MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue additionalValue = new MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue(KYCConstants.HYPERWALLET_KYC_REQUIRED_PROOF_IDENTITY_BUSINESS_FIELD, Boolean.TRUE.toString());
updateShop.setShopId(Long.valueOf(source.getClientUserId()));
updateShop.setAdditionalFieldValues(List.of(additionalValue));
try {
log.info("Updating KYC proof of identity flag in Mirakl for shopId [{}]", source.getClientUserId());
final MiraklUpdateShopsRequest miraklUpdateShopsRequest = new MiraklUpdateShopsRequest(List.of(updateShop));
miraklMarketplacePlatformOperatorApiClient.updateShops(miraklUpdateShopsRequest);
log.info("Proof of identity flag updated for shopId [{}]", source.getClientUserId());
} catch (final MiraklException ex) {
log.error("Something went wrong updating KYC information of shop [{}]. Details [{}]", source.getClientUserId(), ex.getMessage());
mailNotificationUtil.sendPlainTextEmail("Issue detected updating KYC information in Mirakl", String.format(EMAIL_BODY_PREFIX + "Something went wrong updating KYC information of shop [%s]%n%s", source.getClientUserId(), MiraklLoggingErrorsUtil.stringify(ex)));
// Rethrow exception to handle it in AbstractNotificationListener
throw ex;
}
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest 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.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklBusinessStakeholderExtractServiceImpl method updateBusinessStakeholderToken.
@Override
public void updateBusinessStakeholderToken(final String clientUserId, final List<BusinessStakeHolderModel> businessStakeHolderModels) {
if (CollectionUtils.isEmpty(businessStakeHolderModels)) {
log.info("No data for business stakeholders on store [{}]", clientUserId);
return;
}
final MiraklUpdateShop miraklUpdateShop = createMiraklUpdateFieldRequestForStakeholders(clientUserId, businessStakeHolderModels);
final MiraklUpdateShopsRequest request = new MiraklUpdateShopsRequest(List.of(miraklUpdateShop));
try {
miraklOperatorClient.updateShops(request);
} catch (final MiraklApiException ex) {
log.error("Something went wrong getting information of shop [{}]", clientUserId);
sellerMailNotificationUtil.sendPlainTextEmail(EMAIL_SUBJECT_MESSAGE, String.format(ERROR_MESSAGE_PREFIX + "Something went wrong getting information of shop [%s]%n%s", clientUserId, MiraklLoggingErrorsUtil.stringify(ex)));
}
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest 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);
}
Aggregations