Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getTransaction has a new parameter - includeTotals #775

Closed
omniwolf opened this issue May 29, 2024 · 4 comments
Closed

getTransaction has a new parameter - includeTotals #775

omniwolf opened this issue May 29, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@omniwolf
Copy link
Contributor

Please see here:

https://www.independentreserve.com/au/features/api#GetTransactions

includeTotals - Defaults to true for backward compatibility. When set to false, response time is improved and the TotalItems and TotalPages properties are returned as -1.

It's easy enough to alter ir-api getTransactions.js to allow this to work, just add it to the parameters payload:

  return async ({
    accountGuid,
    fromTimestampUtc,
    toTimestampUtc,
    txTypes,
    pageIndex = defaultParams.pageIndex,
    pageSize = defaultParams.pageSize,
    includeTotals
  }) => {
    const payload = {
      accountGuid,
      fromTimestampUtc,
      toTimestampUtc,
      txTypes,
      pageIndex,
      pageSize,
      includeTotals
    }

The allowable values are strings, "true" or "false".
Eg;

                const singleCurrencyTransactions = await getTransactions({
                    accountGuid: currency_dict[accounts[acc].currencyCode],
                    txTypes: ['Withdrawal'],
                    fromTimestampUtc: fromTimestampUtc.toISOString(),
                    toTimestampUtc: toTimestampUtc.toISOString(),
                    pageSize: 100,
                    includeTotals: "false"
                });

However, I'm not smart enough to put this into the validation code. I'm guessing you can make use of the isOneOf.js validation, but I'm not sure how.
I can create a PR for the above stuff if you want to then add the validation to it, or just leave it with you.

@davesag
Copy link
Owner

davesag commented Jun 3, 2024

hey - sorry for the delay - I have merged your PR but there's a few out of date deps I should also upgrade before I issue a new release. I'll close this now as your PR

@davesag davesag closed this as completed Jun 3, 2024
@omniwolf
Copy link
Contributor Author

omniwolf commented Jun 3, 2024

Hi, sorry I'm not sure I understand your message.
Just to be clear - there is no PR for this issue as I don't know how to properly do the validation for the two allowable values ("true" and "false"). The issue shouldn't be closed - it still exists.
I can create a PR to add the includeTotals feature if you want, but there will be no validation.

@davesag
Copy link
Owner

davesag commented Jun 3, 2024 via email

@davesag davesag reopened this Jun 4, 2024
@davesag davesag self-assigned this Jun 4, 2024
@davesag davesag added the enhancement New feature or request label Jun 4, 2024
davesag added a commit that referenced this issue Jun 4, 2024
davesag added a commit that referenced this issue Jun 4, 2024
…Transactions

#775 add includeTotals param to getTransactions
@davesag
Copy link
Owner

davesag commented Jun 4, 2024

Okay now fixed.

@davesag davesag closed this as completed Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants