Files
online.tbbank.gov.tm-larave…/app/Jobs/SendSberToSystem.php
2025-09-10 17:54:36 +05:00

54 lines
1.2 KiB
PHP

<?php
namespace App\Jobs;
use App\Modules\SberPaymentOrder\Models\SberPaymentOrderItem;
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 SendSberToSystem implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
/**
* The number of seconds the job can run before timing out.
*
* @var int
*/
public $timeout = 5;
/**
* Create a new job instance.
*/
public function __construct()
{
//
}
/**
* Execute the job.
*/
public function handle(): void
{
$orderItem = SberPaymentOrderItem::query()
->where('paid', true)
->where('synced_with_system', false)
->whereDate('created_at', '>', '2025-09-05')
->first();
if (! $orderItem) {
return;
}
$result = syncWithAzatAPI($orderItem);
if (isset($result['error'])) {
Log::error($result['error']);
}
}
}