use of uk.gov.pay.connector.gatewayaccount.model.GatewayAccountSearchParams in project pay-connector by alphagov.
the class GatewayAccountServiceTest method shouldSearchGatewayAccounts.
@Test
public void shouldSearchGatewayAccounts() {
GatewayAccountSearchParams gatewayAccountSearchParams = new GatewayAccountSearchParams();
when(mockGatewayAccountDao.search(gatewayAccountSearchParams)).thenReturn(Arrays.asList(getMockGatewayAccountEntity1, getMockGatewayAccountEntity2));
List<GatewayAccountResourceDTO> gatewayAccounts = gatewayAccountService.searchGatewayAccounts(gatewayAccountSearchParams);
assertThat(gatewayAccounts, hasSize(2));
assertThat(gatewayAccounts.get(0).getServiceName(), is("service one"));
assertThat(gatewayAccounts.get(1).getServiceName(), is("service two"));
}
use of uk.gov.pay.connector.gatewayaccount.model.GatewayAccountSearchParams in project pay-connector by alphagov.
the class GatewayAccountDaoIT method shouldSearchForAccountsByPaymentProvider.
@Test
public void shouldSearchForAccountsByPaymentProvider() {
long gatewayAccountId1 = nextLong();
long gatewayAccountId2 = nextLong();
long gatewayAccountId3 = nextLong();
AddGatewayAccountCredentialsParams account1_credentials1 = anAddGatewayAccountCredentialsParams().withPaymentProvider(WORLDPAY.getName()).withState(CREATED).withGatewayAccountId(gatewayAccountId1).build();
AddGatewayAccountCredentialsParams account1_credentials2 = anAddGatewayAccountCredentialsParams().withPaymentProvider(STRIPE.getName()).withState(ACTIVE).withGatewayAccountId(gatewayAccountId1).build();
AddGatewayAccountCredentialsParams account2_credentials = anAddGatewayAccountCredentialsParams().withPaymentProvider(WORLDPAY.getName()).withState(ACTIVE).withGatewayAccountId(gatewayAccountId2).build();
AddGatewayAccountCredentialsParams account3_credentials = anAddGatewayAccountCredentialsParams().withPaymentProvider(WORLDPAY.getName()).withState(CREATED).withGatewayAccountId(gatewayAccountId3).build();
databaseTestHelper.addGatewayAccount(anAddGatewayAccountParams().withAccountId(String.valueOf(gatewayAccountId1)).withGatewayAccountCredentials(List.of(account1_credentials1, account1_credentials2)).build());
databaseTestHelper.addGatewayAccount(anAddGatewayAccountParams().withAccountId(String.valueOf(gatewayAccountId2)).withGatewayAccountCredentials(List.of(account2_credentials)).build());
databaseTestHelper.addGatewayAccount(anAddGatewayAccountParams().withAccountId(String.valueOf(gatewayAccountId3)).withGatewayAccountCredentials(List.of(account3_credentials)).build());
var params = new GatewayAccountSearchParams();
params.setPaymentProvider("worldpay");
List<GatewayAccountEntity> gatewayAccounts = gatewayAccountDao.search(params);
assertThat(gatewayAccounts, hasSize(2));
assertThat(gatewayAccounts, containsInAnyOrder(hasProperty("id", is(gatewayAccountId2)), hasProperty("id", is(gatewayAccountId3))));
}
Aggregations