*/ public function getProfiles(): array { $response = $this->client()->get('/v1/profiles'); $response->throw(); return $response->json(); } /** * Get the multi-currency borderless account for a profile. * * @return array{id?: int, profileId?: int, balances?: array} */ public function getBorderlessAccount(int $profileId): array { $response = $this->client()->get('/v2/borderless-accounts', [ 'profileId' => $profileId, ]); $response->throw(); $accounts = $response->json(); return $accounts[0] ?? []; } /** * Fetch paginated monetary activities for a profile. * Use `since`/`until` (ISO 8601) for date range and `cursor` for pagination. * * @return array{activities?: array, cursor?: string|null} */ public function getActivities(int $profileId, string $since, string $until, ?string $cursor = null): array { $params = [ 'size' => 100, 'since' => $since, 'until' => $until, ]; if ($cursor !== null) { $params['cursor'] = $cursor; } $response = $this->client()->get("/v1/profiles/{$profileId}/activities", $params); $response->throw(); return $response->json(); } private function client(): PendingRequest { return Http::baseUrl(self::BASE_URL) ->withToken($this->apiToken) ->acceptJson() ->throw(function ($response, RequestException $exception) { Log::error('Wise API error', [ 'status' => $response->status(), 'body' => $response->json(), ]); }); } }