3 Commits

Author SHA1 Message Date
437e78770c fix typo
Signed-off-by: Maurice Preuß <hello@envoyr.com>
2025-09-06 13:23:00 +00:00
0dbb27fc94 update transaction description
Signed-off-by: Maurice Preuß <hello@envoyr.com>
2025-09-06 13:22:23 +00:00
63e3f0a4a2 add refresh token method
Signed-off-by: Maurice Preuß (envoyr) <hello@envoyr.com>
2025-05-02 07:29:43 +02:00
2 changed files with 33 additions and 3 deletions

View File

@@ -46,6 +46,20 @@ trait ManagesUsers
return $this->post('v1/users', $attributes);
}
/**
* Refreshes the access token using the refresh token.
*/
public function refreshToken(string $storedRefreshToken, string $scope = ''): Result
{
return $this->post('../oauth/token', [
'grant_type' => 'refresh_token',
'refresh_token' => $storedRefreshToken,
'client_id' => $this->clientId,
'client_secret' => $this->clientSecret,
'scope' => $scope,
]);
}
/**
* Checks if the given email exists.
*

View File

@@ -13,9 +13,25 @@ class Transactions extends BaseCollection
/**
* Create a new transaction for the current user.
*
* @param array $attributes The attributes for the transaction.
* @param array{
* group: null|string,
* invoice_id: null|string,
* payment_provider: null|string,
* payment_intent: null|string,
* status: string,
* type: string,
* amount: float,
* created_at: string
* } $attributes The attributes for the transaction.
* - group: The group (optional)
* - invoice_id: The invoice id (optional)
* - payment_provider: The payment provider (optional, e.g. "kofi", "stripe")
* - payment_intent: The payment intent (optional)
* - status: The status (e.g. "expired", "failed", "pending", "refunded", "succeeded")
* - type: The type (e.g. "deposit", "withdrawal")
* - amount: The amount
* - created_at: The created at datetime string (e.g. "Y-M-D H:i:s")
* @throws Throwable
* @todo Add type hinting for the attributes array.
*/
public function create(array $attributes = []): Transaction
{
@@ -29,6 +45,6 @@ class Transactions extends BaseCollection
public function find(string $id): ?Transaction
{
return (new Transaction(fn() => $this->billable->request('GET', sprintf('v1/transactions/%s', $id))))
->setBillable($this->billable);
->setBillable($this->billable);
}
}