use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class InvoiceHyperwalletSDKServiceImplTest method getHyperwalletInstanceWithProgramToken_shouldReturnAnHyperwalletInstanceWithNOTEncryptedOption.
@Test
void getHyperwalletInstanceWithProgramToken_shouldReturnAnHyperwalletInstanceWithNOTEncryptedOption() {
when(invoicesHyperwalletApiConfigMock.getUsername()).thenReturn(USER_NAME);
when(invoicesHyperwalletApiConfigMock.getPassword()).thenReturn(PASSWORD);
when(invoicesHyperwalletApiConfigMock.getServer()).thenReturn(SERVER);
final Hyperwallet result = testObj.getHyperwalletInstanceWithProgramToken(PROGRAM_TOKEN);
assertThat(result).hasFieldOrPropertyWithValue(API_CLIENT_HYPERWALLET_ENCRYPTION, null);
}
use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class HyperWalletCreateBusinessStakeHolderServiceStrategy method execute.
/**
* Executes the business logic based on the content of
* {@code businessStakeHolderModel} and returns a {@link BusinessStakeHolderModel}
* class based on a set of strategies
* @param businessStakeHolderModel the businessStakeHolderModel object of type
* {@link BusinessStakeHolderModel}
* @return the converted object of type {@link BusinessStakeHolderModel}
*/
@Override
public BusinessStakeHolderModel execute(final BusinessStakeHolderModel businessStakeHolderModel) {
final HyperwalletBusinessStakeholder hyperWalletBusinessStakeHolder = businessStakeHolderModelHyperwalletBusinessStakeholderConverter.convert(businessStakeHolderModel);
try {
final Hyperwallet hyperwallet = hyperwalletSDKService.getHyperwalletInstanceByHyperwalletProgram(businessStakeHolderModel.getHyperwalletProgram());
final HyperwalletBusinessStakeholder hyperWalletBusinessStakeHolderResponse = hyperwallet.createBusinessStakeholder(businessStakeHolderModel.getUserToken(), hyperWalletBusinessStakeHolder);
return businessStakeHolderModel.toBuilder().token(hyperWalletBusinessStakeHolderResponse.getToken()).justCreated(true).build();
} catch (final HyperwalletException e) {
log.error("Stakeholder not created for clientId [{}]", businessStakeHolderModel.getClientUserId());
log.error(HyperwalletLoggingErrorsUtil.stringify(e));
mailNotificationUtil.sendPlainTextEmail("Issue detected when creating business stakeholder in Hyperwallet", String.format(ERROR_MESSAGE_PREFIX + "Business stakeholder not created for clientId [%s]%n%s", businessStakeHolderModel.getClientUserId(), HyperwalletLoggingErrorsUtil.stringify(e)));
}
return null;
}
use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class KYCHyperwalletSDKEncryptedServiceImplTest method getHyperwalletInstance_shouldReturnAnHyperwalletInstanceWithEncryptedOption.
@Test
void getHyperwalletInstance_shouldReturnAnHyperwalletInstanceWithEncryptedOption() {
when(kycHyperwalletApiConfigMock.getUsername()).thenReturn(USER_NAME);
when(kycHyperwalletApiConfigMock.getPassword()).thenReturn(PASSWORD);
when(kycHyperwalletApiConfigMock.getServer()).thenReturn(SERVER);
final Hyperwallet result = testObj.getHyperwalletInstance(PROGRAM_TOKEN);
assertThat(result).hasFieldOrPropertyWithValue("apiClient.hyperwalletEncryption", hyperwalletEncryptionMock);
}
use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class KYCHyperwalletSDKServiceImplTest method getHyperwalletInstance_shouldReturnAnHyperwalletInstance.
@Test
void getHyperwalletInstance_shouldReturnAnHyperwalletInstance() {
when(kycHyperwalletApiConfigMock.getUserStoreTokens()).thenReturn(Map.of(HYPERWALLET_PROGRAM, PROGRAM_TOKEN));
when(kycHyperwalletApiConfigMock.getUsername()).thenReturn(USER_NAME);
when(kycHyperwalletApiConfigMock.getPassword()).thenReturn(PASSWORD);
when(kycHyperwalletApiConfigMock.getServer()).thenReturn(SERVER);
final Hyperwallet result = testObj.getHyperwalletInstance(HYPERWALLET_PROGRAM);
assertThat(result).hasFieldOrPropertyWithValue("programToken", PROGRAM_TOKEN).hasFieldOrPropertyWithValue("apiClient.username", USER_NAME).hasFieldOrPropertyWithValue("url", SERVER + "/rest/v4");
}
use of com.hyperwallet.clientsdk.Hyperwallet in project mirakl-hyperwallet-connector by paypal.
the class KYCHyperwalletSDKServiceImplTest method getHyperwalletInstance_shouldReturnAnHyperwalletInstanceWithNOTEncryptedOption.
@Test
void getHyperwalletInstance_shouldReturnAnHyperwalletInstanceWithNOTEncryptedOption() {
when(kycHyperwalletApiConfigMock.getUsername()).thenReturn(USER_NAME);
when(kycHyperwalletApiConfigMock.getPassword()).thenReturn(PASSWORD);
when(kycHyperwalletApiConfigMock.getServer()).thenReturn(SERVER);
final Hyperwallet result = testObj.getHyperwalletInstance(PROGRAM_TOKEN);
assertThat(result).hasFieldOrPropertyWithValue("apiClient.hyperwalletEncryption", null);
}
Aggregations