Files
2026-11-15 08:44:52 -08:00

24 lines
673 B
PHP

<?php
declare( strict_types=1 );
namespace StreamGoals\Rules;
/** Immutable donation value object consumed by the rules engine (no WordPress dependency). */
final class Donation {
public function __construct(
public readonly int $id,
public readonly int $goalId,
public readonly int $baseMinor,
public readonly int $feeMinor,
public readonly int $totalMinor,
public readonly string $currency,
public readonly string $status = 'completed'
) {}
/** Amount a rule should measure: 'base' (default) or 'total' (base + fee cover). */
public function amountFor( string $basis ): int {
return 'total' === $basis ? $this->totalMinor : $this->baseMinor;
}
}