diff --git a/src/Plaid.php b/src/Plaid.php index ab80fa6..359cfa9 100644 --- a/src/Plaid.php +++ b/src/Plaid.php @@ -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)) + ); + } } diff --git a/tests/TransactionTest.php b/tests/TransactionTest.php index dbb96c3..9813c35 100644 --- a/tests/TransactionTest.php +++ b/tests/TransactionTest.php @@ -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); + } } \ No newline at end of file