use of uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams in project pay-connector by alphagov.
the class GatewayAccountCredentialsResourceIT method patchGatewayAccountCredentialsForGatewayMerchantIdShouldReturn400ForUnsupportedGateway.
@Test
public void patchGatewayAccountCredentialsForGatewayMerchantIdShouldReturn400ForUnsupportedGateway() {
DatabaseFixtures.TestAccount testAccount = addGatewayAccountAndCredential("stripe");
AddGatewayAccountCredentialsParams params = testAccount.getCredentials().get(0);
givenSetup().body(toJson(singletonList(Map.of("op", "replace", "path", "credentials/gateway_merchant_id", "value", "abcdef123abcdef")))).patch(format(PATCH_CREDENTIALS_URL, params.getGatewayAccountId(), params.getId())).then().statusCode(400).body("message[0]", is("Gateway 'stripe' does not support digital wallets."));
}
use of uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams in project pay-connector by alphagov.
the class GatewayAccountCredentialsDaoIT method hasActiveCredentialsShouldReturnFalseIfGatewayAccountHasNoActiveCredentials.
@Test
public void hasActiveCredentialsShouldReturnFalseIfGatewayAccountHasNoActiveCredentials() {
long gatewayAccountId = nextLong();
AddGatewayAccountCredentialsParams credentialsParams = anAddGatewayAccountCredentialsParams().withState(CREATED).withPaymentProvider("stripe").withGatewayAccountId(gatewayAccountId).build();
databaseTestHelper.addGatewayAccount(anAddGatewayAccountParams().withAccountId(String.valueOf(gatewayAccountId)).withPaymentGateway("stripe").withGatewayAccountCredentials(Collections.singletonList(credentialsParams)).withServiceName("a cool service").build());
boolean result = gatewayAccountCredentialsDao.hasActiveCredentials(gatewayAccountId);
assertThat(result, is(false));
}
use of uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams in project pay-connector by alphagov.
the class ContractTest method aWorldpayGatewayAccountWithFilledCredentialsWithIdExists.
@State("a Worldpay gateway account with id 444 with gateway account credentials with id 555 and valid credentials")
public void aWorldpayGatewayAccountWithFilledCredentialsWithIdExists() {
Map<String, String> credentials = Map.of("merchant_id", "a-merchant-id", "username", "a-username", "password", "blablabla");
AddGatewayAccountCredentialsParams gatewayAccountCredentialsParams = anAddGatewayAccountCredentialsParams().withId(555).withExternalId("an-external-id").withPaymentProvider("worldpay").withState(GatewayAccountCredentialState.CREATED).withGatewayAccountId(444).withCredentials(credentials).build();
dbHelper.addGatewayAccount(anAddGatewayAccountParams().withAccountId("444").withGatewayAccountCredentials(singletonList(gatewayAccountCredentialsParams)).withPaymentGateway(WORLDPAY.getName()).build());
}
use of uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams in project pay-connector by alphagov.
the class ContractTest method anAccountWithTwoCredentialsReadyForSwitchPsp.
@State("a Worldpay gateway account with id 444 with two credentials ready to be switched")
public void anAccountWithTwoCredentialsReadyForSwitchPsp() {
String gatewayAccountId = "444";
String activeExtId = "555aaa000";
String switchToExtId = "switchto1234";
dbHelper.addGatewayAccount(anAddGatewayAccountParams().withAccountId(gatewayAccountId).withPaymentGateway("smartpay").withServiceName("a cool service").withProviderSwitchEnabled(true).build());
AddGatewayAccountCredentialsParams activeParams = AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams().withGatewayAccountId(Long.valueOf(gatewayAccountId)).withCredentials(Map.of()).withExternalId(activeExtId).withState(ACTIVE).withPaymentProvider("smartpay").build();
dbHelper.insertGatewayAccountCredentials(activeParams);
AddGatewayAccountCredentialsParams switchToParams = AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams().withGatewayAccountId(Long.valueOf(gatewayAccountId)).withCredentials(Map.of()).withExternalId(switchToExtId).withState(VERIFIED_WITH_LIVE_PAYMENT).withPaymentProvider("worldpay").build();
dbHelper.insertGatewayAccountCredentials(switchToParams);
}
use of uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams in project pay-connector by alphagov.
the class ContractTest method aWorldpayGatewayAccountWithCredentialsWithIdExists.
@State("a Worldpay gateway account with id 333 with gateway account credentials with id 444")
public void aWorldpayGatewayAccountWithCredentialsWithIdExists() {
AddGatewayAccountCredentialsParams gatewayAccountCredentialsParams = anAddGatewayAccountCredentialsParams().withId(444).withExternalId("an-external-id").withPaymentProvider("worldpay").withState(GatewayAccountCredentialState.CREATED).withGatewayAccountId(333).build();
dbHelper.addGatewayAccount(anAddGatewayAccountParams().withAccountId("333").withGatewayAccountCredentials(singletonList(gatewayAccountCredentialsParams)).withPaymentGateway(WORLDPAY.getName()).build());
}
Aggregations