PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.7.0
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.7.0
1.7.0 1.6.6 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 All 50 releases
← All changes | app/Http/Controllers/FrontendControllers/CustomerSubscriptionController.php +3 -3 1.6.1 → 1.7.0 View file →
@@ -51,12 +51,11 @@
51 51
52 52 // Query the Subscription model to retrieve subscriptions for the logged-in customer
53 53 // Include associated order and product data using 'with' for eager loading
54 54 // Sort the results by 'id' in descending order and fetch the data
55 - $subscriptions = Subscription::query()
55 + $subscriptions = Subscription::visibleToCustomer()
56 56 ->where('customer_id', $customer->id)
57 57 ->with(['product'])
58 - ->whereNotIn('status', [Status::SUBSCRIPTION_PENDING, Status::SUBSCRIPTION_INTENDED])
59 58 ->orderBy('id', 'desc')
60 59 ->paginate($perPage, ['*'], 'page', $page);
61 60
62 61
@@ -98,9 +97,9 @@
98 97 ->with(['product', 'variation', 'billing_addresses'])
99 98 ->where('uuid', $subscription_uuid)
100 99 ->first();
101 100
102 - if (!$subscription || in_array($subscription->status, [Status::SUBSCRIPTION_PENDING, Status::SUBSCRIPTION_INTENDED])) {
101 + if (!$subscription || !$subscription->isVisibleToCustomer()) {
103 102 return $this->sendError([
104 103 'message' => __('Subscription not found', 'fluent-cart')
105 104 ]);
106 105 }
@@ -136,8 +135,9 @@
136 135 'uuid' => $subscription->order ? $subscription->order->uuid : ''
137 136 ],
138 137 'billing_addresses' => $subscription->billing_addresses,
139 138 'recurring_amount' => $subscription->recurring_amount,
139 + 'currency' => $subscription->currency,
140 140 'can_early_pay' => EarlyPaymentFeature::canPay($subscription),
141 141 'remaining_installments' => max(0, $subscription->bill_times - $subscription->bill_count),
142 142 'card_update_url' => $subscription->url,
143 143 // Auto-charged (system) subscriptions: the saved card is charged