Make bonus rules visible: highlighted BONUS line on the alerts overlay, streamgoals_bonus action
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1e2ca96eed
commit
c7f2dcffeb
9 files changed
+187
-3
No files matched your search
@@ -19,7 +19,20 @@ final class Engine {
|
||||
|
||||
/** Production wiring: $wpdb-backed stores. */
|
||||
public static function default(): self {
|
||||
return new self( new WpRuleStore(), new WpEventStore(), new \StreamGoals\Core\StateStore() );
|
||||
$onBonus = static function ( string $event, RuleDef $rule, Donation $d, bool $reversed ): void {
|
||||
if ( function_exists( 'do_action' ) ) {
|
||||
/**
|
||||
* Fires when a big-donation bonus rule triggers (or is reversed by a refund).
|
||||
*
|
||||
* @param string $event Rule's event name.
|
||||
* @param int $donationId Donation id.
|
||||
* @param int $ruleId Rule id.
|
||||
* @param bool $reversed True when the bonus was undone.
|
||||
*/
|
||||
do_action( 'streamgoals_bonus', $event, $d->id, $rule->id, $reversed );
|
||||
}
|
||||
};
|
||||
return new self( new WpRuleStore(), new WpEventStore(), new \StreamGoals\Core\StateStore(), null, $onBonus );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user