<?php
namespace App\Jobs;use App\Contracts\SmsGateway;use App\Models\Transfer;use Illuminate\Bus\Queueable;use Illuminate\Contracts\Queue\ShouldQueue;use Illuminate\Foundation\Bus\Dispatchable;use Illuminate\Queue\InteractsWithQueue;use Illuminate\Queue\SerializesModels;
class SendTransferNotification implements ShouldQueue {use Dispatchable,InteractsWithQueue,Queueable,SerializesModels;public function __construct(public int $transferId,public string $type){}public function handle(SmsGateway $sms):void{$t=Transfer::with('sendMerchant')->find($this->transferId);if(!$t)return;$message=$this->type==='expiring'?"Transfer {$t->reference} expires at {$t->expires_at->toIso8601String()}.":"Transfer {$t->reference} status changed.";if($t->sendMerchant?->contact_phone)$sms->send($t->sendMerchant->contact_phone,$message);}}
