Search in sources :

Example 1 with State

use of au.com.dius.pact.provider.junit.State in project pay-adminusers by alphagov.

the class ContractTest method aServiceExistsWithMultipleAdmins.

@State("a service exists with external id cp5wa with multiple admin users")
public void aServiceExistsWithMultipleAdmins() {
    Service service = serviceDbFixture(dbHelper).withExternalId("cp5wa").insertService();
    Role role = createRole();
    createUserWithRoleForService("7d19aff33f8948deb97ed16b2912dcd3", "existing-user", "password", role, service);
    createUserWithRoleForService("admin-2-id", "admin-2", "password", role, service);
}
Also used : Role(uk.gov.pay.adminusers.model.Role) Service(uk.gov.pay.adminusers.model.Service) State(au.com.dius.pact.provider.junit.State)

Example 2 with State

use of au.com.dius.pact.provider.junit.State in project pay-products by alphagov.

the class ContractTest method aProductsWithMetadataExistForGatewayAccount.

@State("a product with gateway account id 42 and metadata exist")
public void aProductsWithMetadataExistForGatewayAccount() {
    Product productWithMetadata = aProductEntity().withGatewayAccountId(42).build().toProduct();
    dbHelper.addProduct(productWithMetadata);
    dbHelper.addMetadata(productWithMetadata.getExternalId(), "key", "value");
}
Also used : Product(uk.gov.pay.products.model.Product) State(au.com.dius.pact.provider.junit.State)

Example 3 with State

use of au.com.dius.pact.provider.junit.State 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 State

use of au.com.dius.pact.provider.junit.State in project pay-connector by alphagov.

the class ContractTest method aChargeWithIdExists.

@State("Gateway account 42 exists and has a charge for £1 with id abc123")
public void aChargeWithIdExists() {
    long accountId = 42;
    GatewayAccountUtil.setUpGatewayAccount(dbHelper, accountId);
    AddChargeParams addChargeParams = anAddChargeParams().withExternalChargeId("abc123").withGatewayAccountId(String.valueOf(accountId)).withTransactionId("aGatewayTransactionId").withAmount(100).withStatus(ChargeStatus.CAPTURED).build();
    dbHelper.addCharge(addChargeParams);
    dbHelper.updateChargeCardDetails(addChargeParams.getChargeId(), AuthCardDetailsFixture.anAuthCardDetails().build());
}
Also used : AddChargeParams(uk.gov.pay.connector.util.AddChargeParams) AddChargeParamsBuilder.anAddChargeParams(uk.gov.pay.connector.util.AddChargeParams.AddChargeParamsBuilder.anAddChargeParams) State(au.com.dius.pact.provider.junit.State) GatewayAccountCredentialState(uk.gov.pay.connector.gatewayaccountcredentials.model.GatewayAccountCredentialState)

Example 5 with State

use of au.com.dius.pact.provider.junit.State 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)

Aggregations

State (au.com.dius.pact.provider.junit.State)17 GatewayAccountCredentialState (uk.gov.pay.connector.gatewayaccountcredentials.model.GatewayAccountCredentialState)6 Product (uk.gov.pay.products.model.Product)4 Role (uk.gov.pay.adminusers.model.Role)3 Service (uk.gov.pay.adminusers.model.Service)3 AddGatewayAccountCredentialsParams (uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams)3 AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams (uk.gov.pay.connector.util.AddGatewayAccountCredentialsParams.AddGatewayAccountCredentialsParamsBuilder.anAddGatewayAccountCredentialsParams)3 PayoutState (uk.gov.pay.ledger.payout.state.PayoutState)2 TransactionState (uk.gov.pay.ledger.transaction.state.TransactionState)2 RestClientDriver.giveResponse (com.github.restdriver.clientdriver.RestClientDriver.giveResponse)1 GsonBuilder (com.google.gson.GsonBuilder)1 ZonedDateTime (java.time.ZonedDateTime)1 Response (javax.ws.rs.core.Response)1 RandomUtils.nextLong (org.apache.commons.lang3.RandomUtils.nextLong)1 AddChargeParams (uk.gov.pay.connector.util.AddChargeParams)1 AddChargeParamsBuilder.anAddChargeParams (uk.gov.pay.connector.util.AddChargeParams.AddChargeParamsBuilder.anAddChargeParams)1 TransactionFixture (uk.gov.pay.ledger.util.fixture.TransactionFixture)1 TransactionFixture.aTransactionFixture (uk.gov.pay.ledger.util.fixture.TransactionFixture.aTransactionFixture)1 ExternalMetadata (uk.gov.service.payments.commons.model.charge.ExternalMetadata)1