Deploy Ladill Mini / deploy (push) Successful in 48s
Adds account avatar upload (multipart proxy to identity), wallet payout-account + withdrawal endpoints, and a hourly mini:cancel-stale-payments command that cancels payments pending beyond 6h (new MiniPayment::STATUS_CANCELED). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
936 B
PHP
35 lines
936 B
PHP
<?php
|
|
|
|
namespace App\Console\Commands;
|
|
|
|
use App\Models\MiniPayment;
|
|
use Illuminate\Console\Command;
|
|
|
|
/**
|
|
* Cancels Mini payments left pending longer than MiniPayment::STALE_PENDING_HOURS.
|
|
* Scheduled hourly (routes/console.php).
|
|
*/
|
|
class CancelStalePayments extends Command
|
|
{
|
|
protected $signature = 'mini:cancel-stale-payments';
|
|
|
|
protected $description = 'Cancel Ladill Mini payments stuck pending beyond the stale window.';
|
|
|
|
public function handle(): int
|
|
{
|
|
$cutoff = now()->subHours(MiniPayment::STALE_PENDING_HOURS);
|
|
|
|
$count = MiniPayment::query()
|
|
->where('status', MiniPayment::STATUS_PENDING)
|
|
->where('created_at', '<', $cutoff)
|
|
->update([
|
|
'status' => MiniPayment::STATUS_CANCELED,
|
|
'updated_at' => now(),
|
|
]);
|
|
|
|
$this->info("Canceled {$count} stale pending payment(s).");
|
|
|
|
return self::SUCCESS;
|
|
}
|
|
}
|