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

[Feature Request] Add additional filters to "get_transactions" #106

Open
DarkPhyber-hg opened this issue May 13, 2024 · 2 comments
Open
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@DarkPhyber-hg
Copy link

I'd like to see the ability to search by Merchant and Amount.

I'm trying to write a script to categorize my amazon transactions based on my downloaded amazon history. Finding a transaction by date, merchant and amount should allow me to identify most transactions programmatically.

@hammem hammem added enhancement New feature or request help wanted Extra attention is needed good first issue Good for newcomers labels May 14, 2024
@DarkPhyber-hg
Copy link
Author

DarkPhyber-hg commented May 14, 2024

I've never done a pull request before, or else i'd submit one.

I cloned the repo and played around with the code looking at the chrome dev tools (first time using the dev tools and playing around with apis), i figured out how to find transactions by amount. There are 2 values, that i assume are floats, that can be used as search filters.
absAmountGte & absAmountLte

I assigned them as floats and it works. I've never done a pull request before or else i'd submit one.

under the async def get_transactions() block at line 1412 I added the following 2 lines

        AmountGt: Optional[float] = None,
        AmountLt: Optional[float] = None,

then there are a series of if statements under the comment
"# If bool filters are not defined (i.e. None), then it should not apply the filter"

so at line 1546 I added

        if AmountGt is not None:
            variables["filters"]["absAmountGte"] = AmountGt
        if AmountLt is not None:
            variables["filters"]["absAmountLte"] = AmountLt   

Merchants appears to just be a list of Merchant Id's with an api value of "merchants", but i haven't added the code for it yet.

@hammem
Copy link
Owner

hammem commented Jan 20, 2025

Here are the various things we'd probably want to add to support this:

  • getCategories() - Pull the categories people have defined
  • getMerchants() - Pull the merchants people have defined
  • Add merchant_ids, max_amount, and min_amount as parameters to get_transactions()

GraphQL Details

GetCategories

query GetCategories {
  categories {
    ...CategoryFields
    __typename
  }
}

fragment CategoryFields on Category {
  id
  order
  name
  icon
  systemCategory
  isSystemCategory
  isDisabled
  group {
    id
    name
    type
    __typename
  }
  __typename
}

Variables:

{}

Web_GetMerchantSettingsPage aka merchants

query Web_GetMerchantSettingsPage($offset: Int, $orderBy: MerchantOrdering, $search: String) {
  merchants(offset: $offset, orderBy: $orderBy, search: $search) {
    id
    name
    transactionCount
    createdAt
    logoUrl
    recurringTransactionStream {
      id
      __typename
    }
    __typename
  }
  merchantCount
}

Variables:

{
search: "", 
orderBy: "TRANSACTION_COUNT" # try using "NAME"
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants