Skip to content

Commit

Permalink
Merge pull request #3679 from alphagov/PP-13334-add_pact_state
Browse files Browse the repository at this point in the history
PP-13334 add pact state
  • Loading branch information
SandorArpa authored Dec 18, 2024
2 parents 7710c6f + 4ddd022 commit add4ff7
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .secrets.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@
"filename": "src/test/java/uk/gov/pay/ledger/pact/ContractTest.java",
"hashed_secret": "fa143a7a660dac99bd4755c518d72306ad2df9d1",
"is_verified": false,
"line_number": 792
"line_number": 817
}
],
"src/test/java/uk/gov/pay/ledger/rule/PostgresTestDocker.java": [
Expand All @@ -163,5 +163,5 @@
}
]
},
"generated_at": "2024-11-27T09:58:15Z"
"generated_at": "2024-12-18T09:23:59Z"
}
25 changes: 25 additions & 0 deletions src/test/java/uk/gov/pay/ledger/pact/ContractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
import static org.apache.commons.lang3.RandomStringUtils.randomAlphanumeric;
import static org.junit.platform.commons.util.StringUtils.isBlank;
import static uk.gov.pay.ledger.event.model.ResourceType.AGREEMENT;
import static uk.gov.pay.ledger.transaction.model.Exemption3ds.EXEMPTION_HONOURED;
import static uk.gov.pay.ledger.transaction.model.Exemption3dsRequested.CORPORATE;
import static uk.gov.pay.ledger.util.DatabaseTestHelper.aDatabaseTestHelper;
import static uk.gov.pay.ledger.util.fixture.EventFixture.anEventFixture;
import static uk.gov.pay.ledger.util.fixture.PayoutFixture.PayoutFixtureBuilder.aPayoutFixture;
Expand Down Expand Up @@ -266,6 +268,29 @@ public void createTransactionWithFeeAndNetAmount(Map<String, String> params) {
.insert(app.getJdbi());
}

@State("a transaction with honoured corporate exemption exists")
public void createTransactionWith3dsExemption(Map<String, String> params) {
String transactionExternalId = params.get("charge_id");
String gatewayAccountId = params.get("account_id");

if (isBlank(transactionExternalId)) {
transactionExternalId = "ch_123abc456xyz";
}
if (isBlank(gatewayAccountId)) {
gatewayAccountId = "123456";
}

aTransactionFixture()
.withExternalId(transactionExternalId)
.withGatewayAccountId(gatewayAccountId)
.withState(TransactionState.SUCCESS)
.withAmount(100L)
.withExemption3ds(EXEMPTION_HONOURED)
.withExemption3dsRequested(CORPORATE)
.withDefaultTransactionDetails()
.insert(app.getJdbi());
}

@State("a transaction with delayed capture true exists")
public void createTransactionWithDelayedCapture(Map<String, String> params) {
String transactionExternalId = params.get("charge_id");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package uk.gov.pay.ledger.pact;

import au.com.dius.pact.provider.junit.IgnoreNoPactsToVerify;
import au.com.dius.pact.provider.junit.PactRunner;
import au.com.dius.pact.provider.junit.Provider;
import au.com.dius.pact.provider.junit.loader.PactBroker;
Expand All @@ -11,5 +12,6 @@
@PactBroker(scheme = "https", host = "${PACT_BROKER_HOST:pact-broker.deploy.payments.service.gov.uk}", tags = {"${PACT_CONSUMER_TAG}", "test-fargate"},
authentication = @PactBrokerAuth(username = "${PACT_BROKER_USERNAME}", password = "${PACT_BROKER_PASSWORD}"),
consumers = {"selfservice"})
@IgnoreNoPactsToVerify
public class SelfServiceContractTest extends ContractTest {
}

0 comments on commit add4ff7

Please sign in to comment.