use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class IndividualKYCBusinessStakeholderStatusNotificationStrategy method updateMiraklProofIdentityFlagStatus.
protected void updateMiraklProofIdentityFlagStatus(final String miraklShopId, final String kycCustomValuesRequiredVerificationBusinessStakeholder, final HyperwalletUser.VerificationStatus verificationStatus) {
if (StringUtils.nonEmptyString(kycCustomValuesRequiredVerificationBusinessStakeholder)) {
final MiraklUpdateShop updateShop = new MiraklUpdateShop();
final List<MiraklRequestAdditionalFieldValue> additionalFieldValues = Optional.of(kycCustomValuesRequiredVerificationBusinessStakeholder).stream().map(kycCustomValueRequiredVerification -> new MiraklRequestAdditionalFieldValue.MiraklSimpleRequestAdditionalFieldValue(kycCustomValueRequiredVerification, Boolean.toString(HyperwalletUser.VerificationStatus.REQUIRED.equals(verificationStatus)))).collect(Collectors.toList());
updateShop.setShopId(Long.valueOf(miraklShopId));
updateShop.setAdditionalFieldValues(additionalFieldValues);
log.info("Updating KYC proof of identity flag in Mirakl for business Stakeholder for shopId [{}]", miraklShopId);
final MiraklUpdateShopsRequest miraklUpdateShopsRequest = new MiraklUpdateShopsRequest(List.of(updateShop));
miraklMarketplacePlatformOperatorApiClient.updateShops(miraklUpdateShopsRequest);
log.info("Proof of identity flag updated for business Stakeholder for shopId [{}]", miraklShopId);
}
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellersExtractServiceImplCustomFieldsTest method updateUserToken_shouldUpdateValueForCustomFieldHwUserToken.
@DisplayName("Should Update Value for Custom Field 'hw-user-token'")
@Test
void updateUserToken_shouldUpdateValueForCustomFieldHwUserToken() {
when(hyperwalletUserMock.getToken()).thenReturn(TOKEN_VALUE);
when(hyperwalletUserMock.getClientUserId()).thenReturn("12345");
testObj.updateUserToken(hyperwalletUserMock);
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-user-token");
assertThat(castedAdditionalFieldValue.getValue()).isEqualTo(TOKEN_VALUE);
}
use of com.mirakl.client.mmp.operator.request.shop.MiraklUpdateShopsRequest in project mirakl-hyperwallet-connector by paypal.
the class MiraklSellersExtractServiceImpl method updateUserToken.
/**
* {@inheritDoc}
*/
@Override
public void updateUserToken(final HyperwalletUser hyperwalletUser) {
final MiraklUpdateShop miraklUpdateShop = new MiraklUpdateShop();
final String shopId = hyperwalletUser.getClientUserId();
miraklUpdateShop.setShopId(Long.valueOf(shopId));
final MiraklSimpleRequestAdditionalFieldValue userTokenCustomField = new MiraklSimpleRequestAdditionalFieldValue();
userTokenCustomField.setCode(HYPERWALLET_USER_TOKEN);
userTokenCustomField.setValue(hyperwalletUser.getToken());
miraklUpdateShop.setAdditionalFieldValues(List.of(userTokenCustomField));
final MiraklUpdateShopsRequest request = new MiraklUpdateShopsRequest(List.of(miraklUpdateShop));
log.info("Updating token for shop [{}] to [{}]", shopId, hyperwalletUser.getToken());
try {
miraklOperatorClient.updateShops(request);
} catch (final MiraklApiException ex) {
log.error("Something went wrong getting information of shop [{}]", shopId);
sellerMailNotificationUtil.sendPlainTextEmail(EMAIL_SUBJECT_MESSAGE, String.format(ERROR_MESSAGE_PREFIX + "Something went wrong getting information of shop [%s]%n%s", shopId, MiraklLoggingErrorsUtil.stringify(ex)));
}
}
Aggregations