feat(payment): complete creator income center
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
450b9f44b9
commit
9e6ae32fc1
16 files changed
+550
-134
No files matched your search
@@ -19,7 +19,23 @@ class CreatorRevenue {
|
||||
}
|
||||
|
||||
public function init(): void {
|
||||
// Revenue is generated by the content fulfillment completion boundary.
|
||||
add_action('aksrt_creator_income_settlement', [$this, 'settle_due']);
|
||||
add_action('aksrt_order_status_changed', [$this, 'handle_order_status_changed'], 10, 3);
|
||||
if (!wp_next_scheduled('aksrt_creator_income_settlement')) {
|
||||
wp_schedule_event(time() + HOUR_IN_SECONDS, 'hourly', 'aksrt_creator_income_settlement');
|
||||
}
|
||||
}
|
||||
|
||||
public function settle_due(): void {
|
||||
if (class_exists('AKSRT\\Payment\\Revenue')) {
|
||||
Revenue::get_instance()->settle_due(100, 0);
|
||||
}
|
||||
}
|
||||
|
||||
public function handle_order_status_changed(string $order_number, string $new_status, array $order = []): void {
|
||||
if (in_array($new_status, ['cancelled', 'refunding', 'refunded'], true) && class_exists('AKSRT\\Payment\\Revenue')) {
|
||||
Revenue::get_instance()->cancel_or_reverse($order_number, sprintf(__('订单状态变更为%s', 'aksrt'), $new_status));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user