Files
online.tbbank.gov.tm-larave…/app/Jobs/SendVisaToSystem.php
2026-03-12 02:09:44 +05:00

51 lines
1.3 KiB
PHP

<?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\DB;
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
{
$ignore = DB::table('ignore_visa_payments')->pluck('payment_id');
$orderItems = VisaMasterPaymentOrderItem::query()
->where('paid', true)
->where('synced_with_system', false)
->whereDate('created_at', '>', '2025-09-05')
->whereIntegerNotInRaw('id', $ignore)
->limit(2)
->get()
->each(function ($orderItem) {
if (! $orderItem) {
return;
}
$result = syncVisaWithAzatAPI($orderItem);
if (isset($result['error'])) {}
});
}
}