use of com.mirakl.client.mmp.domain.shop.MiraklShopKycStatus in project mirakl-hyperwallet-connector by paypal.
the class AbstractKYCUserStatusNotificationStrategy method updateShop.
protected void updateShop(final KYCUserStatusNotificationBodyModel kycUserStatusNotificationBodyModel) {
final MiraklShopKycStatus status = expectedKycMiraklStatus(kycUserStatusNotificationBodyModel);
if (Objects.nonNull(status)) {
final String shopId = kycUserStatusNotificationBodyModel.getClientUserId();
final MiraklUpdateShopsRequest request = createUpdateShopRequest(kycUserStatusNotificationBodyModel, status);
log.info("Updating KYC status for shop [{}]", shopId);
try {
final MiraklUpdatedShops response = miraklOperatorClient.updateShops(request);
if (response == null) {
log.error("No response was received for update request for shop [{}]", shopId);
} else {
final List<MiraklUpdatedShopReturn> shopReturns = response.getShopReturns();
shopReturns.forEach(this::logShopUpdates);
}
deleteInvalidDocuments(kycUserStatusNotificationBodyModel);
} catch (final MiraklException ex) {
final String errorMessage = String.format(MSG_ERROR_DETECTED, shopId, MiraklLoggingErrorsUtil.stringify(ex));
log.error(errorMessage);
mailNotificationUtil.sendPlainTextEmail(MAIL_SUBJECT, ERROR_MESSAGE_PREFIX + errorMessage);
// Rethrow exception to handle it in AbstractNotificationListener
throw ex;
}
}
}
use of com.mirakl.client.mmp.domain.shop.MiraklShopKycStatus in project mirakl-hyperwallet-connector by paypal.
the class BusinessKycUserNotificationStrategyTest method expectedKycMiraklStatus_shouldSetCorrectMiraklStatus_whenBusinessStakeHolderVerificationStatusIsNull.
@Test
void expectedKycMiraklStatus_shouldSetCorrectMiraklStatus_whenBusinessStakeHolderVerificationStatusIsNull() {
// @formatter:off
final KYCUserStatusNotificationBodyModel KYCUserStatusNotificationBodyModelStub = KYCUserStatusNotificationBodyModel.builder().clientUserId(String.valueOf(CLIENT_USER_ID)).verificationStatus(HyperwalletUser.VerificationStatus.VERIFIED).businessStakeholderVerificationStatus(null).letterOfAuthorizationStatus(HyperwalletUser.LetterOfAuthorizationStatus.VERIFIED).profileType(HyperwalletUser.ProfileType.BUSINESS).build();
// @formatter:on
final MiraklShopKycStatus result = testObj.expectedKycMiraklStatus(KYCUserStatusNotificationBodyModelStub);
assertThat(result).isEqualTo(MiraklShopKycStatus.APPROVED);
}
use of com.mirakl.client.mmp.domain.shop.MiraklShopKycStatus in project mirakl-hyperwallet-connector by paypal.
the class BusinessKycUserNotificationStrategyTest method expectedKycMiraklStatus_shouldSetCorrectMiraklStatus_whenVerificationStatusIsNull.
@Test
void expectedKycMiraklStatus_shouldSetCorrectMiraklStatus_whenVerificationStatusIsNull() {
// @formatter:off
final KYCUserStatusNotificationBodyModel KYCUserStatusNotificationBodyModelStub = KYCUserStatusNotificationBodyModel.builder().clientUserId(String.valueOf(CLIENT_USER_ID)).verificationStatus(null).businessStakeholderVerificationStatus(HyperwalletUser.BusinessStakeholderVerificationStatus.VERIFIED).letterOfAuthorizationStatus(HyperwalletUser.LetterOfAuthorizationStatus.VERIFIED).profileType(HyperwalletUser.ProfileType.BUSINESS).build();
// @formatter:on
final MiraklShopKycStatus result = testObj.expectedKycMiraklStatus(KYCUserStatusNotificationBodyModelStub);
assertThat(result).isEqualTo(MiraklShopKycStatus.APPROVED);
}
use of com.mirakl.client.mmp.domain.shop.MiraklShopKycStatus in project mirakl-hyperwallet-connector by paypal.
the class BusinessKycUserNotificationStrategyTest method expectedKycMiraklStatus_shouldSetCorrectMiraklStatus_whenLetterOfAuthorizationStatusIsNull.
@Test
void expectedKycMiraklStatus_shouldSetCorrectMiraklStatus_whenLetterOfAuthorizationStatusIsNull() {
// @formatter:off
final KYCUserStatusNotificationBodyModel KYCUserStatusNotificationBodyModelStub = KYCUserStatusNotificationBodyModel.builder().clientUserId(String.valueOf(CLIENT_USER_ID)).verificationStatus(HyperwalletUser.VerificationStatus.VERIFIED).businessStakeholderVerificationStatus(HyperwalletUser.BusinessStakeholderVerificationStatus.VERIFIED).letterOfAuthorizationStatus(null).profileType(HyperwalletUser.ProfileType.BUSINESS).build();
// @formatter:on
final MiraklShopKycStatus result = testObj.expectedKycMiraklStatus(KYCUserStatusNotificationBodyModelStub);
assertThat(result).isEqualTo(MiraklShopKycStatus.APPROVED);
}
use of com.mirakl.client.mmp.domain.shop.MiraklShopKycStatus in project mirakl-hyperwallet-connector by paypal.
the class BusinessKycUserNotificationStrategyTest method expectedKycMiraklStatus_shouldSetCorrectMiraklStatusBasedOnHyperwalletUserStatusesForBusiness.
@MethodSource("validVerificationStatuses")
@ParameterizedTest
void expectedKycMiraklStatus_shouldSetCorrectMiraklStatusBasedOnHyperwalletUserStatusesForBusiness(final HyperwalletUser.VerificationStatus verificationStatus, final HyperwalletUser.BusinessStakeholderVerificationStatus businessStakeholderVerificationStatus, final HyperwalletUser.LetterOfAuthorizationStatus letterOfAuthorizationStatus, final MiraklShopKycStatus miraklShopKycStatus) {
// @formatter:off
final KYCUserStatusNotificationBodyModel KYCUserStatusNotificationBodyModelStub = KYCUserStatusNotificationBodyModel.builder().clientUserId(String.valueOf(CLIENT_USER_ID)).verificationStatus(verificationStatus).businessStakeholderVerificationStatus(businessStakeholderVerificationStatus).letterOfAuthorizationStatus(letterOfAuthorizationStatus).profileType(HyperwalletUser.ProfileType.BUSINESS).build();
// @formatter:on
final MiraklShopKycStatus result = testObj.expectedKycMiraklStatus(KYCUserStatusNotificationBodyModelStub);
assertThat(result).isEqualTo(miraklShopKycStatus);
}
Aggregations