Files
ladill-qr-plus/app/Services/Identity/IdentityClient.php
T
isaaccladandClaude Opus 4.8 b7adb69245
Deploy Ladill QR Plus / deploy (push) Successful in 33s
Point in-app wallet top-up at the billing API (key the app already holds)
qr-plus authenticates to the monolith with a billing service key, not an
identity key, so the modal's top-up now goes through BillingClient::topup ->
POST /api/billing/topup. Drops the unused IdentityClient::walletTopup.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-26 06:23:03 +00:00

58 lines
1.4 KiB
PHP

<?php
namespace App\Services\Identity;
use Illuminate\Support\Facades\Http;
class IdentityClient
{
/** @return array<string, mixed> */
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<string, mixed> */
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<string, mixed> */
public function unlinkMailbox(string $publicId): array
{
$response = $this->request()->delete($this->url('/identity/mailbox-link'), [
'user' => $publicId,
]);
$response->throw();
return (array) $response->json('data', []);
}
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;
}
}