Show per-event payment history with fees and net amounts, and let organizers manage payout accounts and withdrawals without leaving the app. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -55,6 +55,29 @@ class QrEventRegistration extends Model
|
||||
return round($this->amount_minor / 100, 2);
|
||||
}
|
||||
|
||||
public function platformFeeMinor(): int
|
||||
{
|
||||
$metadata = (array) ($this->metadata ?? []);
|
||||
|
||||
if (isset($metadata['ladill_pay']['platform_fee_minor'])) {
|
||||
return (int) $metadata['ladill_pay']['platform_fee_minor'];
|
||||
}
|
||||
|
||||
if (isset($metadata['platform_fee_ghs'])) {
|
||||
return (int) round((float) $metadata['platform_fee_ghs'] * 100);
|
||||
}
|
||||
|
||||
$mode = $this->qrCode?->content()['mode'] ?? 'ticketing';
|
||||
$rate = $mode === 'contributions' ? 0.035 : 0.055;
|
||||
|
||||
return (int) round($this->amount_minor * $rate);
|
||||
}
|
||||
|
||||
public function netAmountMinor(): int
|
||||
{
|
||||
return max(0, $this->amount_minor - $this->platformFeeMinor());
|
||||
}
|
||||
|
||||
public function isPaid(): bool
|
||||
{
|
||||
return $this->amount_minor > 0;
|
||||
|
||||
Reference in New Issue
Block a user