fix conflict issue in sticker pdf service
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Successful in 20s
Laravel Pint / pint (pull_request) Failing after 2m32s
Laravel Larastan / larastan (pull_request) Failing after 5m36s
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 12s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 13s
Gemini PR Review / Gemini PR Review (pull_request) Successful in 20s
Laravel Pint / pint (pull_request) Failing after 2m32s
Laravel Larastan / larastan (pull_request) Failing after 5m36s
This commit is contained in:
@@ -15,6 +15,9 @@ use Storage;
|
||||
use Maatwebsite\Excel\Facades\Excel;
|
||||
use Livewire\Livewire;
|
||||
use Str;
|
||||
use Firebase\JWT\JWT;
|
||||
use Firebase\JWT\Key;
|
||||
|
||||
|
||||
class CreateSerialValidation extends CreateRecord
|
||||
{
|
||||
@@ -67,6 +70,8 @@ class CreateSerialValidation extends CreateRecord
|
||||
|
||||
$invoiceNumber = trim($invoiceNumber);
|
||||
|
||||
$parts = explode('.', $invoiceNumber);
|
||||
|
||||
$this->showCapacitorInput = false;
|
||||
|
||||
$user = Filament::auth()->user();
|
||||
@@ -90,9 +95,60 @@ class CreateSerialValidation extends CreateRecord
|
||||
|
||||
//..GET SERIAL INVOICE API
|
||||
|
||||
// $decodedJwt = JWT::decode($invoiceNumber, new Key('dummy_key', 'HS256')); // replace 'dummy_key' with actual key if needed
|
||||
|
||||
// if (!$decodedJwt || !isset($decodedJwt->data)) {
|
||||
// Notification::make()
|
||||
// ->title("Invalid e-Invoice QR data or format received...")
|
||||
// ->info()
|
||||
// ->seconds(1)
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
|
||||
// $documentData = $decodedJwt->data; // This should be JSON string containing DocNo
|
||||
|
||||
// // Extract DocNo using regex
|
||||
// preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches);
|
||||
// if (isset($matches[1])) {
|
||||
// $this->invoiceNumber = $matches[1];
|
||||
// } else {
|
||||
// Notification::make()
|
||||
// ->title("DocNo not found in QR data...")
|
||||
// ->info()
|
||||
// ->seconds(1)
|
||||
// ->send();
|
||||
// return;
|
||||
// }
|
||||
//..
|
||||
|
||||
// Decode JWT payload
|
||||
$payloadJson = base64_decode(strtr($parts[1], '-_', '+/'));
|
||||
|
||||
|
||||
$payload = json_decode($payloadJson, true);
|
||||
|
||||
|
||||
if (!isset($payload['data'])) {
|
||||
throw new \Exception('Invalid payload');
|
||||
}
|
||||
|
||||
$documentData = $payload['data'];
|
||||
|
||||
|
||||
|
||||
// Extract DocNo
|
||||
preg_match('/"DocNo"\s*:\s*"([^"]+)"/', $documentData, $matches);
|
||||
|
||||
if (!isset($matches[1])) {
|
||||
// throw new \Exception('DocNo not found');
|
||||
}
|
||||
|
||||
if (isset($matches[1])) {
|
||||
$invoiceNumber = $matches[1];
|
||||
//dd($invoiceNumber);
|
||||
}
|
||||
|
||||
$updateStatus = $this->form->getState()['update_invoice'] ?? null;
|
||||
|
||||
$this->invoiceNumber = trim($this->form->getState()['invoice_number']) ?? $invoiceNumber;
|
||||
|
||||
Reference in New Issue
Block a user