Skip to content

Commit

Permalink
Merge pull request #26 from webkod3r/transactions-refresh
Browse files Browse the repository at this point in the history
Adding support for transactions refresh endpoint
  • Loading branch information
brentscheffler authored Nov 15, 2020
2 parents eb1861a + 0093b38 commit 1b165a0
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/Plaid.php
Original file line number Diff line number Diff line change
Expand Up @@ -1014,4 +1014,21 @@ public function listPayments(array $options = []): object
$this->buildRequest("post", "payment_initiation/payment/list", $this->clientCredentials($params))
);
}

/**
* Send a refresh request for given item.
*
* @param string $access_token
* @return object
*/
public function refreshTransactions(string $access_token): object
{
$params = [
"access_token" => $access_token,
];

return $this->doRequest(
$this->buildRequest("post", "transactions/refresh", $this->clientCredentials($params))
);
}
}
13 changes: 13 additions & 0 deletions tests/TransactionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,17 @@ public function test_get_transactions()
$this->assertEquals("2019-03-31", $response->params->end_date);
$this->assertEquals(new \StdClass, $response->params->options);
}

public function test_transaction_refresh()
{
$response = $this->getPlaidClient()->refreshTransactions("access_token");

$this->assertEquals("POST", $response->method);
$this->assertEquals("2019-05-29", $response->version);
$this->assertEquals("application/json", $response->content);
$this->assertEquals("/transactions/refresh", $response->path);
$this->assertEquals("client_id", $response->params->client_id);
$this->assertEquals("secret", $response->params->secret);
$this->assertEquals("access_token", $response->params->access_token);
}
}

0 comments on commit 1b165a0

Please sign in to comment.