Add goals repository and configurable rules engine
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
939193f258
commit
7155396312
19 files changed
+882
No files matched your search
@@ -0,0 +1,23 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user