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

Valid test user added in sandbox won't load in pattern #315

Open
meysammohajer opened this issue Nov 6, 2024 · 1 comment
Open

Valid test user added in sandbox won't load in pattern #315

meysammohajer opened this issue Nov 6, 2024 · 1 comment

Comments

@meysammohajer
Copy link

meysammohajer commented Nov 6, 2024

Hi, I created a json file based on this format and I used it to create a test user in my sanbox. But when I try to load that valid user in pattern it's not working and it just get stuck. Here is my json file. sample-user.json

Screenshot 2024-11-03 at 7 29 14 PM

Also when I try to fetch transactions (below code) for that user in sandbox, it seems it get stuck in the while loop. I'd appreciate any feedback on this. Thanks!

`def get_transactions(access_token: str):
# Set cursor to empty to receive all historical updates
cursor = ''

# New transaction updates since "cursor"
added = []
modified = []
removed = []  # Removed transaction ids
has_more = True
try:
    # Iterate through each page of new transaction updates for item
    while has_more:
        request = TransactionsSyncRequest(
            access_token=access_token,
            cursor=cursor,
        )
        response = client.transactions_sync(request).to_dict()
        cursor = response['next_cursor']
        print(f"cursor: {cursor}") # cursor is always empty for our custom data!!!

        if cursor == '':
            time.sleep(2)
            continue
            # If cursor is not an empty string, we got results,
        # so add this page of results
        added.extend(response['added'])
        modified.extend(response['modified'])
        removed.extend(response['removed'])
        has_more = response['has_more']

    # Return all transactions
    all_transactions = sorted(added, key=lambda t: t['date'])
    return all_transactions

except plaid.ApiException as e:
    error_response = json.loads(e.body)
    return error_response`
@phoenixy1
Copy link
Collaborator

I haven't tried to reproduce this, but one thing that jumps out at me is that your user's transactions are all in 2023. Because the Pattern app does not use the transactions.days_requested field, it requests the default 90 days of transaction history rather than the maximum 730 days available. As a result, it won't see any transaction history for this user.

To avoid this, you should either update the transaction dates for your test user to be within the last 90 days, or update the /link/token/create call used by the pattern app to set the transactions.days_requested field. See https://plaid.com/docs/api/link/#link-token-create-request-transactions-days-requested for more details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants