Skip to content

Commit

Permalink
Merge pull request #855 from alphagov/pp_6758_payment_details_on_refunds
Browse files Browse the repository at this point in the history
PP-6758 Pact states: Add payment details to refunds payload
  • Loading branch information
kbottla authored Jul 24, 2020
2 parents 5ab9cb1 + d3be44e commit 1844369
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ public List<TransactionEntity> searchTransactionsAndParent(TransactionSearchPara
public List<TransactionEntity> cursorTransactionSearch(TransactionSearchParams searchParams, ZonedDateTime startingAfterCreatedDate, Long startingAfterId) {
Long cursorPageSize = searchParams.getDisplaySize();
String cursorTemplate = "";
String searchTemplate = createSearchTemplate(searchParams.getFilterTemplatesWithParentTransactionSearch(), SEARCH_TRANSACTIONS_CURSOR);
String searchTemplate = createSearchTemplate(searchParams.getFilterTemplates(), SEARCH_TRANSACTIONS_CURSOR);

if (startingAfterCreatedDate != null && startingAfterId != null) {
cursorTemplate = searchParams.getQueryMap().isEmpty() ? "WHERE " : "AND ";
Expand Down
5 changes: 2 additions & 3 deletions src/test/java/uk/gov/pay/ledger/pact/ContractTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -388,8 +388,7 @@ private void createARefundTransaction(String parentExternalId, String gatewayAcc
.withReference(reference)
.withDescription(description)
.withCreatedDate(ZonedDateTime.parse(createdDate))
.withCardBrand(null)
.withEmail(null)
.withDefaultPaymentDetails()
.withDefaultTransactionDetails()
.insert(app.getJdbi());
}
Expand Down Expand Up @@ -455,7 +454,7 @@ private void createPaymentTransactionWithAllFields(String transactionExternalId,
.withCardBrandLabel("Visa")
.withGatewayTransactionId("gateway-transaction-id")
.withCardholderName("J Doe")
.withEmail("gds-payments-team-smoke@digital.cabinet-office.gov.uk")
.withEmail("test@example.org")
.withCreatedDate(ZonedDateTime.parse(createdDate))
.withCaptureSubmittedDate(ZonedDateTime.parse(createdDate).plusMinutes(2L))
.withCapturedDate(ZonedDateTime.parse(createdDate).plusHours(1L))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -872,6 +872,11 @@ public void searchTransactionsByCursor() {

transactionFixture = aTransactionFixture()
.withGatewayAccountId("1")
.withReference("ref1")
.withCardholderName("test 1")
.withLastDigitsCardNumber("1234")
.withCardBrand("visa")
.withEmail("test@example.org")
.withCreatedDate(now(ZoneOffset.UTC).minusDays(1))
.insert(rule.getJdbi());

Expand All @@ -881,10 +886,14 @@ public void searchTransactionsByCursor() {
.insert(rule.getJdbi());

searchParams.setAccountIds(List.of("1"));
searchParams.setReference("ref");
searchParams.setCardHolderName("test");
searchParams.setEmail("test@example.org");
searchParams.setCardBrands(new CommaDelimitedSetParameter("visa"));

List<TransactionEntity> transactionList = transactionDao.cursorTransactionSearch(searchParams, null, null);

assertThat(transactionList.size(), is(2));
assertThat(transactionList.size(), is(1));
}

@Test
Expand Down

0 comments on commit 1844369

Please sign in to comment.