feat(pay): content cashier, resource orders at VIP price, purchase/download JS loop
Wire zibll-style one-shot points/cash cashier for post+_aksrt_pay downloads: server amount from aksrt_get_user_pay_price, ORDER_PRODUCT_RESOURCE unlock, frontend need-purchase opens modal, download box purchased/VIP/purchase CTAs.
This commit is contained in:
1 parent
abe2f57417
commit
770205623d
11 files changed
+1142
-170
No files matched your search
@@ -486,8 +486,8 @@ if (!function_exists('aksrt_resource_download_cost')) {
|
||||
$pay_modo = (($pay['pay_modo'] ?? '0') === 'points') ? 'points' : '0';
|
||||
}
|
||||
|
||||
// Cash mode: order/checkout path unless legacy download_credit is on.
|
||||
if ($pay_modo !== 'points' && empty($paid_settings['download_credit'])) {
|
||||
// Cash mode always unlocks via resource order (cashier), never per-download credits.
|
||||
if ($pay_modo !== 'points') {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -495,6 +495,10 @@ if (!function_exists('aksrt_resource_download_cost')) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Points mode: one-time purchase via cashier. Unpaid amount is not deducted here —
|
||||
// can_download returns need_purchase; after order, has_paid_access zeros cost above.
|
||||
// Return display/gate cost only for free-tier (0) detection; unpaid still shows amount
|
||||
// but rest_request must not deduct without paid order (see Content_Visibility).
|
||||
if (is_array($priced)) {
|
||||
$price = (float) ($priced['amount'] ?? 0);
|
||||
if ($price > 0) {
|
||||
@@ -505,15 +509,11 @@ if (!function_exists('aksrt_resource_download_cost')) {
|
||||
|
||||
// Fallback without helper.
|
||||
$meta = function_exists('aksrt_get_pay_meta') ? aksrt_get_pay_meta($post) : aksrt_get_resource_meta($post);
|
||||
if ($pay_modo === 'points') {
|
||||
$price = (float) ($meta['points_price'] ?? $meta['price'] ?? 0);
|
||||
} else {
|
||||
$price = (float) ($meta['price'] ?? 0);
|
||||
}
|
||||
$price = (float) ($meta['points_price'] ?? $meta['price'] ?? 0);
|
||||
if ($price > 0) {
|
||||
return (int) ceil($price);
|
||||
}
|
||||
return max(0, (int) ($paid_settings['default_cost'] ?? 0));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user