15 lines
766 B
PHP
15 lines
766 B
PHP
<?php
|
|
namespace App\Console\Commands;
|
|
use App\Services\OrderReporting\Reporter;
|
|
use Illuminate\Console\Command;
|
|
class ReportOrderPayments extends Command
|
|
{
|
|
protected $signature='orders:report-payments';
|
|
protected $description='Recover asynchronous payment notifications and snapshot the 08:00 payment report';
|
|
public function handle(Reporter $reports):int {
|
|
if(!$reports->enabled())return self::SUCCESS;
|
|
try {$recovered=$reports->reconcile();$daily=$reports->daily();$queued=$reports->queueDue();$this->line(json_encode(['recovered'=>$recovered,'daily_event_id'=>$daily?->id,'queued'=>$queued]));return self::SUCCESS;}
|
|
catch(\Throwable $e){$this->error('order_report_failed_closed: '.get_class($e));return self::FAILURE;}
|
|
}
|
|
}
|