use of com.hyperwallet.clientsdk.model.HyperwalletUser in project mirakl-hyperwallet-connector by paypal.
the class IndividualKYCBusinessStakeholderStatusNotificationStrategy method execute.
/**
* {@inheritDoc}
*/
@Override
public Void execute(final KYCBusinessStakeholderStatusNotificationBodyModel kycBusinessStakeholderStatusNotificationBodyModel) {
final HyperwalletUser hyperWalletUser = getHyperWalletUser(kycBusinessStakeholderStatusNotificationBodyModel);
if (Objects.nonNull(hyperWalletUser)) {
final List<String> miraklProofOfIdentityCustomFieldNames = miraklBusinessStakeholderDocumentsExtractService.getKYCCustomValuesRequiredVerificationBusinessStakeholders(hyperWalletUser.getClientUserId(), List.of(kycBusinessStakeholderStatusNotificationBodyModel.getToken()));
final HyperwalletUser.VerificationStatus verificationStatus = kycBusinessStakeholderStatusNotificationBodyModel.getVerificationStatus();
if (CollectionUtils.isNotEmpty(miraklProofOfIdentityCustomFieldNames)) {
updateMiraklProofIdentityFlagStatus(hyperWalletUser.getClientUserId(), miraklProofOfIdentityCustomFieldNames.get(0), verificationStatus);
}
}
return null;
}
use of com.hyperwallet.clientsdk.model.HyperwalletUser in project mirakl-hyperwallet-connector by paypal.
the class SellerModelToHyperWalletUserConverterTest method convert_shouldCreateAHyperWalletUserWithTheDetailsFromTheIndividualSellerModelPassedAsParameter.
@Test
void convert_shouldCreateAHyperWalletUserWithTheDetailsFromTheIndividualSellerModelPassedAsParameter() {
when(sellerModelMock.getProfileType()).thenReturn(SellerProfileType.INDIVIDUAL);
final HyperwalletUser result = testObj.convert(sellerModelMock);
assertThat(result.getClientUserId()).isEqualTo(CLIENT_USER_ID);
assertThat(result.getBusinessName()).isEqualTo(BUSINESS_NAME);
assertThat(result.getProfileType()).isEqualTo(HyperwalletUser.ProfileType.INDIVIDUAL);
assertThat(result.getFirstName()).isEqualTo(FIRST_NAME);
assertThat(result.getLastName()).isEqualTo(SECOND_NAME);
assertThat(result.getDateOfBirth()).isEqualTo(DATE_OF_BIRTH);
assertThat(result.getCountryOfBirth()).isEqualTo(COUNTRY_OF_BIRTH);
assertThat(result.getCountryOfNationality()).isEqualTo(COUNTRY_OF_NATIONALITY);
assertThat(result.getPhoneNumber()).isEqualTo(PHONE_NUMBER);
assertThat(result.getMobileNumber()).isEqualTo(MOBILE_PHONE);
assertThat(result.getEmail()).isEqualTo(EMAIL);
assertThat(result.getGovernmentId()).isEqualTo(GOVERNMENT_ID);
assertThat(result.getPassportId()).isEqualTo(PASSPORT_ID);
assertThat(result.getAddressLine1()).isEqualTo(ADDRESS_LINE_ONE);
assertThat(result.getAddressLine2()).isEqualTo(ADDRESS_LINE_TWO);
assertThat(result.getCity()).isEqualTo(CITY);
assertThat(result.getStateProvince()).isEqualTo(STATE_PROVINCE);
assertThat(result.getCountry()).isEqualTo(COUNTRY);
assertThat(result.getPostalCode()).isEqualTo(POSTAL_CODE);
assertThat(result.getProgramToken()).isEqualTo(PROGRAM_TOKEN);
assertThat(result.getDriversLicenseId()).isEqualTo(DRIVERS_LICENSE);
assertThat(result.getBusinessType()).isEqualTo(HyperwalletUser.BusinessType.PRIVATE_COMPANY);
assertThat(result.getGovernmentIdType()).isEqualTo(HyperwalletUser.GovernmentIdType.NATIONAL_ID_CARD);
assertThat(result.getToken()).isEqualTo(USER_TOKEN);
}
use of com.hyperwallet.clientsdk.model.HyperwalletUser in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletCreateSellerServiceStrategyTest method createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl_shouldCreateUserAndUpdateToken.
@Test
void createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl_shouldCreateUserAndUpdateToken() {
when(hyperwalletSDKServiceMock.getHyperwalletInstanceByProgramToken(PROGRAM_TOKEN_VALUE)).thenReturn(hyperwalletMock);
when(hyperwalletMock.createUser(hyperwalletUserRequestMock)).thenReturn(hyperwalletUserResponseMock);
when(hyperwalletUserRequestMock.getProgramToken()).thenReturn(PROGRAM_TOKEN_VALUE);
final HyperwalletUser result = testObj.createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl(hyperwalletUserRequestMock);
verify(hyperwalletMock).createUser(hyperwalletUserRequestMock);
verify(miraklSellersExtractServiceMock).updateUserToken(hyperwalletUserResponseMock);
assertThat(result).isEqualTo(hyperwalletUserResponseMock);
}
use of com.hyperwallet.clientsdk.model.HyperwalletUser in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletCreateSellerServiceStrategy method createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl.
/**
* It creates the user on HyperWallet side, then it updates the user information on
* Mirakl accordingly with the response received on user creation by HyperWallet
* @param hyperwalletUser The User to be created
* @return The created HyperWallet user
*/
@Override
protected HyperwalletUser createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl(final HyperwalletUser hyperwalletUser) {
final Hyperwallet hyperwallet = hyperwalletSDKService.getHyperwalletInstanceByProgramToken(hyperwalletUser.getProgramToken());
final HyperwalletUser hwUser = hyperwallet.createUser(hyperwalletUser);
miraklSellersExtractService.updateUserToken(hwUser);
log.info("Seller created for seller with clientUserId [{}]", hyperwalletUser.getClientUserId());
return hwUser;
}
use of com.hyperwallet.clientsdk.model.HyperwalletUser in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletUpdateSellerServiceStrategy method createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl.
@Override
protected HyperwalletUser createOrUpdateUserOnHyperWalletAndUpdateItsTokenOnMirakl(final HyperwalletUser hyperwalletUser) {
final Hyperwallet hyperwallet = hyperwalletSDKService.getHyperwalletInstanceByProgramToken(hyperwalletUser.getProgramToken());
final HyperwalletUser updatedUser = hyperwallet.updateUser(hyperwalletUser);
log.info("Seller updated for seller with clientUserId [{}]", hyperwalletUser.getClientUserId());
return updatedUser;
}
Aggregations