PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Modules/MCP/Tools/SubscriptionTools.php +8 -3 1.5.4 → 1.6.5 View file →
@@ -24,10 +24,11 @@
24 24 class SubscriptionTools
25 25 {
26 26 public static function definitions()
27 27 {
28 - $statuses = ContextTools::ENUMS['subscription_statuses'];
29 - $intervals = ContextTools::ENUMS['billing_intervals'];
28 + $enums = ContextTools::enums();
29 + $statuses = $enums['subscription_statuses'];
30 + $intervals = $enums['billing_intervals'];
30 31
31 32 return [
32 33 'fluent-cart/list-subscriptions' => [
33 34 'label' => __('List Subscriptions', 'fluent-cart'),
@@ -49,9 +50,9 @@
49 50 'min_recurring' => ['type' => 'number', 'description' => 'Minimum recurring total in store currency.'],
50 51 'advanced_filters' => ['type' => 'array', 'items' => ['type' => ['object', 'array']], 'description' => 'Pro: condition groups {property, operator, value} — outer array = OR groups, inner = AND. Call get-search-schema entity=subscriptions FIRST for properties/operators/format. AND-combines with the other filters here (summary_only included). An empty array means no advanced filter.'],
51 52 'sort_by' => ['type' => 'string', 'enum' => ['id', 'next_billing_date', 'created_at', 'canceled_at', 'recurring_total'], 'default' => 'id'],
52 53 'sort_type' => ['type' => 'string', 'enum' => ['ASC', 'DESC'], 'default' => 'DESC'],
53 - 'fields' => ['type' => 'array', 'items' => ['type' => 'string'], 'description' => 'Optional: return only these row keys to shrink the payload (subscription_id is always kept). Available: status, item_name, customer, recurring_total, billing_interval, next_billing_date, created_at, canceled_at, bill_count, bill_times, is_installment, installments_paid, installments_remaining, total_contract_value, currency, label. Omit for the full row.'],
54 + 'fields' => ['type' => 'array', 'items' => ['type' => 'string'], 'description' => 'Optional: return only these row keys to shrink the payload (subscription_id is always kept). Available: status, item_name, customer, recurring_total, billing_interval, next_billing_date, created_at, canceled_at, bill_count, bill_times, plan_type, is_installment, installments_paid, installments_remaining, total_contract_value, currency, label. Omit for the full row.'],
54 55 'summary_only' => ['type' => 'boolean', 'description' => 'When true, return ONLY aggregates across all matching subscriptions — count_by_status, summed recurring_total, and total remaining installments — with no per-record array. Answers "how many active subs and how much is committed" with a tiny payload. Honors all the filters above.'],
55 56 'page' => ['type' => 'integer', 'default' => 1],
56 57 'per_page' => ['type' => 'integer', 'default' => 15, 'description' => 'Max 200.'],
57 58 ],
@@ -289,8 +290,11 @@
289 290 'bill_count' => (int) $sub->bill_count,
290 291 'bill_times' => (int) $sub->bill_times,
291 292 // Derived installment view (bill_times > 0). total_contract_value is
292 293 // null for open-ended plans, which have no fixed committed total.
294 + // plan_type names the same distinction using the plan_types enum from
295 + // get-store-context, so the enum, the filter and the row all agree.
296 + 'plan_type' => $isInstallment ? 'installment' : 'recurring',
293 297 'is_installment' => $isInstallment,
294 298 'installments_paid' => (int) $sub->bill_count,
295 299 'installments_remaining' => $sub->installmentsRemaining(),
296 300 'total_contract_value' => $isInstallment ? MCPHelper::money($sub->totalContractValue(), $currency) : null,
@@ -346,8 +350,9 @@
346 350 'recurring_total' => MCPHelper::money($sub->recurring_total, $currency),
347 351 'bill_times' => (int) $sub->bill_times,
348 352 'bill_count' => (int) $sub->bill_count,
349 353 'collection_method' => $sub->collection_method,
354 + 'plan_type' => $sub->isInstallment() ? 'installment' : 'recurring',
350 355 'is_installment' => $sub->isInstallment(),
351 356 'installments_paid' => (int) $sub->bill_count,
352 357 'installments_remaining' => $sub->installmentsRemaining(),
353 358 'total_contract_value' => $sub->isInstallment() ? MCPHelper::money($sub->totalContractValue(), $currency) : null,