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

Found duplicate transactions when relogged-in to a specific bank account #71

Open
ahmad13544 opened this issue Mar 20, 2023 · 1 comment

Comments

@ahmad13544
Copy link

ahmad13544 commented Mar 20, 2023

Do not receiving new transactions against a specific bank account, but when I verify transactions from the following endpoint, it shows that there are new transactions available.

When I delete this specific account (do not delete transactions just update account status bit to 1) and relogged-in to the account using bank credentials, it creates new entry in database with different access token of same bank account, also it gives duplicated transactions.

I've looked into a solution that for new account exchange token request (relogged-in), need to compare combination of the accounts’ institution_id, account name, and account mask to determine whether an end user has previously linked an account to your application. Do not exchange a public token for an access token if you detect a duplicate Item.

Need some help in implementing this solution, like after exchange token request, do I need to active same deleted account and do not change account access token instead of adding new account in the database with the new access token (current flow).

$accessTokenObject = (array)$this->plaid->items->exchangeToken($publicTokenObject['public_token']);
      if ($accessTokenObject) {
        $bank = Banks::updateOrCreate([
          'bank_name' => $publicTokenObject['institution']['name'],
          'user_id' => Auth::user()->id
        ], [
          'access_token' => $accessTokenObject['access_token']
        ]);
        foreach ($publicTokenObject['accounts'] as $a => $account) {
          Accounts::updateOrCreate(
            [
              'bank_id' => $bank['id'],
              'name' => $account['name'],
              'mask' => $account['mask']
            ],
            [
              'access_token'=>$accessTokenObject['access_token'],
              'name' => $account['name'],
              'status' => 0,
              // 'available'=>$account['balances']['available'],
              // 'current'=>$account['balances']['current'],
              'subtype' => $account['subtype'],
              'type' => $account['type'],
              'account_id' => $account['id'],
              // 'official_name'=>$account['official_name']
            ]
          );
        }

@levizoesch
Copy link

levizoesch commented Nov 23, 2023

That has nothing to do with the package. It has to do with your implementation.

Each time you run this; you are creating a new session with plaid for the specific account(s). That is why you see a new ID generated and duplicated transactions being stored within your application.

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