Skip to content

feat(EWT-535): Support for merchant account transactions pagination#279

Merged
dili91 merged 7 commits intomainfrom
ewt-535-merchant-accounts-trx-pagination-support
Apr 15, 2024
Merged

feat(EWT-535): Support for merchant account transactions pagination#279
dili91 merged 7 commits intomainfrom
ewt-535-merchant-accounts-trx-pagination-support

Conversation

@dili91
Copy link
Contributor

@dili91 dili91 commented Apr 12, 2024

Description

Adds support for paginating merchant accounts transactions.
If not enabled at their client setting already, clients created before December 2023 have to explicitly opt-in with the help of an HTTP header as described on our public API documentation.

To do so, when using the Java library, those clients can use a new overload of the listTransactions API accepts an extra headers parameter:

// Clients created before December 2023
tlClient.merchantAccounts()
    .listTransactions(
            Headers.builder()
                    .enablePagination() //required to opt-in for pagination
                    .build(), 
            getMerchantAccount(CurrencyCode.GBP).getId(),
            ListTransactionsQuery.builder().from(from).to(to).build())
    .get();

Clients created from December 2023 onwards can use the existing, simpler variation of the listTransactions API:

// Clients created from December 2023
tlClient.merchantAccounts()
    .listTransactions(
            getMerchantAccount(CurrencyCode.GBP).getId(),
            ListTransactionsQuery.builder().from(from).to(to).build())
    .get();

Important

Note that for clients created before December 2023 that do not explicitly opt-in for the pagination feature, the use of the cursor query parameter will be ineffective, and the pagination object in returned responses will be always null.

Type of change

Please select multiple options if required.

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code where necessary
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the relevant documentation

@swarmia
Copy link

swarmia bot commented Apr 12, 2024

Comment on lines 144 to 154
Arguments.of(
ZonedDateTime.of(LocalDate.of(2021, 3, 1), LocalTime.MIN, ZoneId.of("UTC")),
ZonedDateTime.of(LocalDate.of(2022, 3, 1), LocalTime.MIN, ZoneId.of("UTC"))),
ZonedDateTime.of(LocalDate.of(2024, 2, 1), LocalTime.MIN, ZoneId.of("UTC")),
ZonedDateTime.of(LocalDate.of(2024, 3, 1), LocalTime.MIN, ZoneId.of("UTC"))),
Arguments.of(
ZonedDateTime.of(LocalDate.of(2021, 3, 1), LocalTime.MIN, ZoneId.of("Europe/Paris")),
ZonedDateTime.of(LocalDate.of(2022, 3, 1), LocalTime.MIN, ZoneId.of("Europe/Paris"))),
Arguments.of(ZonedDateTime.parse("2021-03-01T00:00:00Z"), ZonedDateTime.parse("2022-03-01T00:00:00Z")));
ZonedDateTime.of(LocalDate.of(2024, 2, 1), LocalTime.MIN, ZoneId.of("Europe/Paris")),
ZonedDateTime.of(LocalDate.of(2024, 3, 1), LocalTime.MIN, ZoneId.of("Europe/Paris"))),
Arguments.of(ZonedDateTime.parse("2024-02-01T00:00:00Z"), ZonedDateTime.parse("2024-03-01T00:00:00Z")));
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm changing these defaults from and to values because pagination works only on more recent transactions.

@dili91 dili91 marked this pull request as ready for review April 12, 2024 15:05
@dili91 dili91 requested a review from a team as a code owner April 12, 2024 15:05
@dili91 dili91 requested a review from a team April 12, 2024 15:05
@dili91 dili91 changed the title feat(EWT-535): Suppor for merchant account transactions pagination feat(EWT-535): Support for merchant account transactions pagination Apr 12, 2024
Copy link
Contributor

@azanin azanin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great work!

@dili91 dili91 merged commit 34ab929 into main Apr 15, 2024
@dili91 dili91 deleted the ewt-535-merchant-accounts-trx-pagination-support branch April 15, 2024 14:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants