Skip to content

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

@ahmad13544

Description

@ahmad13544

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']
            ]
          );
        }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions