Update Pengajuan Presensi WhatsApp

This commit is contained in:
Ariyutta
2026-09-19 16:05:56 +07:00
parent 8aa3da65ce
commit 9057ab3643
10000 changed files with 1269273 additions and 1062 deletions
+13 -8
View File
@@ -4,7 +4,7 @@ namespace App\Services;
class VerifikasiAbsenLinkService
{
const TTL_MENIT_DEFAULT = 7200; // 5 hari, selaras dengan batas kadaluarsa pengajuan
const TTL_MENIT_DEFAULT = 7200;
public function generate(int $pengajuanId, string $nip, int $ttlMenit = self::TTL_MENIT_DEFAULT): array
{
@@ -15,17 +15,22 @@ class VerifikasiAbsenLinkService
'nip' => $nip,
'expires' => $expires,
'signature' => $signature,
'url' => route('verifikasi-absen.show', [
'id' => $pengajuanId,
'nip' => $nip,
'expires' => $expires,
'signature' => $signature,
]),
// Suffix untuk parameter tombol URL template WhatsApp (domain sudah baku di template).
'url' => $this->url($pengajuanId, $nip, $expires, $signature),
'button_param' => "{$pengajuanId}?nip={$nip}&expires={$expires}&signature={$signature}",
];
}
public function url(int $pengajuanId, ?string $nip = null, ?int $expires = null, ?string $signature = null): string
{
$base = rtrim(config('services.verifikasi_absen_wa.url'), '/')."/{$pengajuanId}";
if (! $nip || ! $expires || ! $signature) {
return $base;
}
return $base.'?'.http_build_query(compact('nip', 'expires', 'signature'));
}
public function verify(int $pengajuanId, ?string $nip, mixed $expires, ?string $signature): bool
{
if (! $nip || ! $expires || ! $signature) {