feat(pay): sales volume, paid order meta, pending resume, limit-over buy
Bump content sales on resource order paid; show order number/time in download box; poll pending gateway payments; support download_limit_over_price overbuy.
This commit is contained in:
@@ -276,9 +276,22 @@ class AKSRT_Content_Visibility {
|
||||
|
||||
// Zibll daily free-download quota (only when free / already unlocked).
|
||||
if ($cost <= 0 && function_exists('aksrt_check_free_download_quota')) {
|
||||
// Provide per-post overbuy price to quota error.
|
||||
$over_cb = static function ($over, $uid) use ($resource_post) {
|
||||
if (!($resource_post instanceof WP_Post) || !function_exists('aksrt_get_pay_meta')) {
|
||||
return $over;
|
||||
}
|
||||
$m = aksrt_get_pay_meta($resource_post);
|
||||
return max(0.0, (float) ($m['download_limit_over_price'] ?? 0));
|
||||
};
|
||||
add_filter('aksrt_download_limit_over_price', $over_cb, 10, 2);
|
||||
$quota = aksrt_check_free_download_quota($uid, $cost);
|
||||
remove_filter('aksrt_download_limit_over_price', $over_cb, 10);
|
||||
if (is_wp_error($quota)) {
|
||||
return $quota;
|
||||
$data = (array) $quota->get_error_data();
|
||||
$data['post_id'] = (int) ($state['post_id'] ?? 0);
|
||||
$data['pay_modo'] = (string) ($state['pay_modo'] ?? '0');
|
||||
return new WP_Error($quota->get_error_code(), $quota->get_error_message(), $data);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user