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);
}
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");
}
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());
}
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());
}
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);
}
Aggregations