Lean control center at mini.ladill.com: payment QR CRUD, Paystack checkout with 5% fee settlement via Billing API, payments feed, and payouts. QR codes use a fixed black-and-white preset only. Co-authored-by: Cursor <cursoragent@cursor.com>
58 lines
1.3 KiB
PHP
58 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class MiniPayment extends Model
|
|
{
|
|
public const STATUS_PENDING = 'pending';
|
|
public const STATUS_PAID = 'paid';
|
|
public const STATUS_FAILED = 'failed';
|
|
|
|
/** Platform fee on trader payments (Ladill Mini tier). */
|
|
public const PLATFORM_FEE_RATE = 0.05;
|
|
|
|
protected $fillable = [
|
|
'qr_code_id',
|
|
'user_id',
|
|
'reference',
|
|
'amount_minor',
|
|
'currency',
|
|
'platform_fee_minor',
|
|
'merchant_amount_minor',
|
|
'payer_name',
|
|
'payer_email',
|
|
'payer_phone',
|
|
'payer_note',
|
|
'status',
|
|
'payment_reference',
|
|
'paid_at',
|
|
'metadata',
|
|
];
|
|
|
|
protected $casts = [
|
|
'amount_minor' => 'integer',
|
|
'platform_fee_minor' => 'integer',
|
|
'merchant_amount_minor' => 'integer',
|
|
'metadata' => 'array',
|
|
'paid_at' => 'datetime',
|
|
];
|
|
|
|
public function qrCode(): BelongsTo
|
|
{
|
|
return $this->belongsTo(QrCode::class);
|
|
}
|
|
|
|
public function merchant(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
|
|
public function amountMajor(): float
|
|
{
|
|
return $this->amount_minor / 100;
|
|
}
|
|
}
|