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 +23 -3 1.6.0 → 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
@@ -233,8 +233,13 @@
233 233 return $this->sendError([
234 234 'message' => $e->getMessage()
235 235 ]);
236 236 }
237 +
238 + return $this->sendSuccess([
239 + 'status' => 'success',
240 + 'message' => __('Payment method updated successfully', 'fluent-cart')
241 + ]);
237 242 }
238 243
239 244 return $this->sendError([
240 245 'message' => __('Could not update payment method', 'fluent-cart')
@@ -280,8 +285,13 @@
280 285 return $this->sendError([
281 286 'message' => $e->getMessage()
282 287 ]);
283 288 }
289 +
290 + return $this->sendSuccess([
291 + 'status' => 'success',
292 + 'message' => __('Plan created successfully', 'fluent-cart')
293 + ]);
284 294 }
285 295
286 296 return $this->sendError([
287 297 'message' => __('Could not get or create plan', 'fluent-cart')
@@ -334,8 +344,13 @@
334 344 return $this->sendError([
335 345 'message' => $e->getMessage()
336 346 ]);
337 347 }
348 +
349 + return $this->sendSuccess([
350 + 'status' => 'success',
351 + 'message' => __('Payment method switched successfully', 'fluent-cart')
352 + ]);
338 353 }
339 354
340 355 return $this->sendError([
341 356 'message' => __('Could not switch payment method', 'fluent-cart')
@@ -390,8 +405,13 @@
390 405 return $this->sendError([
391 406 'message' => $e->getMessage()
392 407 ]);
393 408 }
409 +
410 + return $this->sendSuccess([
411 + 'status' => 'success',
412 + 'message' => __('Subscription switch confirmed successfully', 'fluent-cart')
413 + ]);
394 414 }
395 415
396 416 return $this->sendError([
397 417 'message' => __('Could not confirm subscription switch', 'fluent-cart')