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/Http/Controllers/CouponsController.php +10 -2 1.5.4 → 1.6.5 View file →
@@ -33,10 +33,17 @@
33 33 }
34 34
35 35 public function viewDetails(Request $request, $id)
36 36 {
37 + $coupon = CouponResource::viewDetails($id);
37 38
38 - return ['coupon' => CouponResource::viewDetails($id)];
39 + if (!$coupon) {
40 + return CouponResource::makeErrorResponse([
41 + ['code' => 404, 'message' => __('Coupon not found, please reload the page and try again!', 'fluent-cart')]
42 + ], 404);
43 + }
44 +
45 + return ['coupon' => $coupon];
39 46 }
40 47
41 48 public function create(CouponRequest $request)
42 49 {
@@ -176,8 +183,9 @@
176 183 {
177 184 $data = $request->getSafe([
178 185 'order_uuid' => 'sanitize_text_field',
179 186 'applied_coupons.*' => 'intval',
187 + 'customer_email' => 'sanitize_email',
180 188 ]);
181 189 $data['order_items'] = Arr::except(Arr::get($request->all(), 'order_items', []), ['*']);
182 190
183 191 $isApplied = CouponResource::reapplyCoupon($data);
@@ -198,9 +206,9 @@
198 206 {
199 207 $productId = Arr::get($request->all(), 'productId', null);
200 208 $appliedCoupons = Arr::get($request->all(), 'appliedCoupons', []);
201 209 $origin = Arr::get($request->all(), 'origin', null);
202 - $checkEligibility = CouponResource::checkProductEligibility($productId, $appliedCoupons, $origin);
210 + $checkEligibility = CouponResource::checkProductEligibilityForCodes($productId, $appliedCoupons, $origin);
203 211 return $checkEligibility;
204 212 }
205 213
206 214 public function storeCouponSettings(Request $request)