wip
This commit is contained in:
49
app/Jobs/SendVisaToSystem.php
Normal file
49
app/Jobs/SendVisaToSystem.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Modules\VisaMasterPaymentOrder\Models\VisaMasterPaymentOrderItem;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class SendVisaToSystem implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$orderItem = VisaMasterPaymentOrderItem::query()
|
||||
->where('paid', true)
|
||||
->where('synced_with_system', false)
|
||||
->whereDate('created_at', '>', '2025-09-05')
|
||||
->first();
|
||||
|
||||
if (! $orderItem) {
|
||||
return;
|
||||
}
|
||||
|
||||
$result = syncVisaWithAzatAPI($orderItem);
|
||||
|
||||
if (isset($result['error'])) {
|
||||
Log::channel('visa_job')->error(json_encode([
|
||||
'error' => $result['error'],
|
||||
'orderItem' => $orderItem,
|
||||
]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user