Search in sources :

Example 1 with AddGatewayAccountCredentialsParams

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."));
}
Also used : DatabaseFixtures(uk.gov.pay.connector.it.dao.DatabaseFixtures) AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams) AddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams) Test(org.junit.Test)

Example 2 with AddGatewayAccountCredentialsParams

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));
}
Also used : AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams) AddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams) Test(org.junit.Test)

Example 3 with AddGatewayAccountCredentialsParams

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());
}
Also used : AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams) AddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams) State(au.com.dius.pact.provider.junit.State) GatewayAccountCredentialState(uk.gov.pay.connector.gatewayaccountcredentials.model.GatewayAccountCredentialState)

Example 4 with AddGatewayAccountCredentialsParams

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);
}
Also used : AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams) AddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams) State(au.com.dius.pact.provider.junit.State) GatewayAccountCredentialState(uk.gov.pay.connector.gatewayaccountcredentials.model.GatewayAccountCredentialState)

Example 5 with AddGatewayAccountCredentialsParams

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());
}
Also used : AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams) AddGatewayAccountCredentialsParams(uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams) State(au.com.dius.pact.provider.junit.State) GatewayAccountCredentialState(uk.gov.pay.connector.gatewayaccountcredentials.model.GatewayAccountCredentialState)

Aggregations

AddGatewayAccountCredentialsParams (uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams)15 AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams (uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams)14 Test (org.junit.Test)9 AddGatewayAccountParams (uk.gov.pay.connector.util.AddGatewayAccountParams)4 AddGatewayAccountParamsBuilder.anAddGatewayAccountParams (uk.gov.pay.connector.util.AddGatewayAccountParams.AddGatewayAccountParamsBuilder.anAddGatewayAccountParams)4 State (au.com.dius.pact.provider.junit.State)3 GatewayAccountCredentialState (uk.gov.pay.connector.gatewayaccountcredentials.model.GatewayAccountCredentialState)3 LocalDateTime (java.time.LocalDateTime)2 DatabaseFixtures (uk.gov.pay.connector.it.dao.DatabaseFixtures)2 ValidatableResponse (io.restassured.response.ValidatableResponse)1 GatewayAccountEntity (uk.gov.pay.connector.gatewayaccount.model.GatewayAccountEntity)1 GatewayAccountSearchParams (uk.gov.pay.connector.gatewayaccount.model.GatewayAccountSearchParams)1 ChargeUtils (uk.gov.pay.connector.it.util.ChargeUtils)1