← 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 |