*/ public function mailboxLinkStatus(string $publicId): array { $response = $this->request()->get($this->url('/identity/mailbox-link'), [ 'user' => $publicId, ]); $response->throw(); return (array) $response->json('data', []); } /** @return array */ public function linkMailbox(string $publicId, string $mailboxAddress): array { $response = $this->request()->put($this->url('/identity/mailbox-link'), [ 'user' => $publicId, 'mailbox_address' => $mailboxAddress, ]); $response->throw(); return (array) $response->json('data', []); } /** @return array */ public function unlinkMailbox(string $publicId): array { $response = $this->request()->delete($this->url('/identity/mailbox-link'), [ 'user' => $publicId, ]); $response->throw(); return (array) $response->json('data', []); } /** * Start a central-wallet Paystack top-up for an account and return the * Paystack checkout URL. Backs the in-app "Add funds" modal so users top up * without leaving the app for the central wallet page. */ public function walletTopup(string $publicId, float $amount, string $returnUrl): string { $response = $this->request()->post($this->url('/identity/wallet-topup-account'), [ 'user' => $publicId, 'amount' => $amount, 'return_url' => $returnUrl, ]); $response->throw(); return (string) $response->json('data.checkout_url', ''); } private function request() { return Http::withToken((string) config('identity.api_key')) ->acceptJson() ->timeout(15); } private function url(string $path): string { return rtrim((string) config('identity.api_url'), '/').$path; } }