Update Pengajuan Presensi WhatsApp
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user