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/Helpers/Status.php +107 -33 1.3.22 → 1.7.0 View file →
@@ -28,10 +28,22 @@
28 28 public const PAYMENT_FAILED = 'failed';
29 29 public const PAYMENT_REFUNDED = 'refunded';
30 30 public const PAYMENT_PARTIALLY_REFUNDED = 'partially_refunded';
31 31 public const PAYMENT_AUTHORIZED = 'authorized';
32 + public const PAYMENT_SCHEDULED = 'payment_scheduled';
32 33
33 34 // Transaction Statuses
35 + // Product review statuses — fct_product_reviews.status values
36 + public const REVIEW_APPROVED = 'approved';
37 + public const REVIEW_PENDING = 'pending';
38 + public const REVIEW_SPAM = 'spam';
39 + public const REVIEW_TRASH = 'trash';
40 +
41 + // Review permission modes — who may submit a review
42 + public const REVIEW_PERMISSION_VERIFIED_BUYERS = 'verified_buyers';
43 + public const REVIEW_PERMISSION_LOGGED_IN = 'logged_in';
44 + public const REVIEW_PERMISSION_ANYONE = 'anyone';
45 +
34 46 public const TRANSACTION_SUCCEEDED = 'succeeded';
35 47 public const TRANSACTION_AUTHORIZED = 'authorized';
36 48 public const TRANSACTION_PENDING = 'pending';
37 49 public const TRANSACTION_REFUNDED = 'refunded';
@@ -62,8 +74,12 @@
62 74 public const SUBSCRIPTION_COMPLETED = 'completed';
63 75 public const SUBSCRIPTION_AUTHENTICATED = 'authenticated';
64 76 public const SUBSCRIPTION_CREATED = 'created';
65 77
78 + public const SUBSCRIPTION_METHOD_MANUAL = 'manual';
79 + public const SUBSCRIPTION_METHOD_AUTOMATIC = 'automatic';
80 + public const SUBSCRIPTION_METHOD_SYSTEM = 'system';
81 +
66 82 // billing interval
67 83 public const BILLING_YEARLY = 'yearly';
68 84 public const BILLING_HALF_YEARLY = 'half_yearly';
69 85 public const BILLING_QUARTERLY = 'quarterly';
@@ -166,17 +182,15 @@
166 182 }
167 183
168 184 public static function getEditableOrderStatuses()
169 185 {
170 - $statuses = apply_filters_deprecated('fluent-cart/editable_order_statuses', [
171 - [
172 - self::ORDER_ON_HOLD => __('On Hold', 'fluent-cart'),
173 - self::ORDER_PROCESSING => __('Processing', 'fluent-cart'),
174 - self::ORDER_COMPLETED => __('Completed', 'fluent-cart'),
175 - // 'archived' => __('Archived', 'fluent-cart'),
176 - self::ORDER_CANCELED => __('Canceled', 'fluent-cart')
177 - ], []
178 - ], '1.3.16', 'fluent_cart/editable_order_statuses', 'Use fluent_cart/editable_order_statuses instead of fluent-cart/editable_order_statuses.');
186 + $statuses = [
187 + self::ORDER_ON_HOLD => __('On Hold', 'fluent-cart'),
188 + self::ORDER_PROCESSING => __('Processing', 'fluent-cart'),
189 + self::ORDER_COMPLETED => __('Completed', 'fluent-cart'),
190 + // 'archived' => __('Archived', 'fluent-cart'),
191 + self::ORDER_CANCELED => __('Canceled', 'fluent-cart')
192 + ];
179 193
180 194 return apply_filters('fluent_cart/editable_order_statuses', $statuses, []);
181 195 }
182 196
@@ -191,8 +205,9 @@
191 205 self::PAYMENT_FAILED => __('Failed', 'fluent-cart'),
192 206 self::PAYMENT_REFUNDED => __('Refunded', 'fluent-cart'),
193 207 self::PAYMENT_PARTIALLY_REFUNDED => __('Partially Refunded', 'fluent-cart'),
194 208 self::PAYMENT_AUTHORIZED => __('Authorized', 'fluent-cart'),
209 + self::PAYMENT_SCHEDULED => __('Payment Scheduled', 'fluent-cart'),
195 210 ], []);
196 211 }
197 212
198 213 // Transaction statuses
@@ -214,17 +229,15 @@
214 229 }
215 230
216 231 public static function getEditableTransactionStatuses($withLabel = true)
217 232 {
218 - $statuses = apply_filters_deprecated('fluent-cart/editable_transaction_statuses', [
219 - [
220 - self::TRANSACTION_PENDING => __('Pending', 'fluent-cart'),
221 - self::TRANSACTION_SUCCEEDED => __('Succeeded', 'fluent-cart'),
222 - self::TRANSACTION_AUTHORIZED => __('Authorized', 'fluent-cart'),
223 - self::TRANSACTION_FAILED => __('Failed', 'fluent-cart'),
224 - self::TRANSACTION_REFUNDED => __('Refunded', 'fluent-cart'),
225 - ], []
226 - ], '1.3.16', 'fluent_cart/editable_transaction_statuses', 'Use fluent_cart/editable_transaction_statuses instead of fluent-cart/editable_transaction_statuses.');
233 + $statuses = [
234 + self::TRANSACTION_PENDING => __('Pending', 'fluent-cart'),
235 + self::TRANSACTION_SUCCEEDED => __('Succeeded', 'fluent-cart'),
236 + self::TRANSACTION_AUTHORIZED => __('Authorized', 'fluent-cart'),
237 + self::TRANSACTION_FAILED => __('Failed', 'fluent-cart'),
238 + self::TRANSACTION_REFUNDED => __('Refunded', 'fluent-cart'),
239 + ];
227 240
228 241 $statuses = apply_filters('fluent_cart/editable_transaction_statuses', $statuses, []);
229 242
230 243 if ($withLabel) {
@@ -246,16 +259,14 @@
246 259 }
247 260
248 261 public static function getEditableShippingStatuses()
249 262 {
250 - $statuses = apply_filters_deprecated('fluent-cart/editable_order_statuses', [
251 - [
252 - self::SHIPPING_UNSHIPPED => __('Unshipped', 'fluent-cart'),
253 - self::SHIPPING_SHIPPED => __('Shipped', 'fluent-cart'),
254 - self::SHIPPING_DELIVERED => __('Delivered', 'fluent-cart'),
255 - self::SHIPPING_UNSHIPPABLE => __('Unshippable', 'fluent-cart'),
256 - ], []
257 - ], '1.3.16', 'fluent_cart/editable_shipping_statuses', 'Use fluent_cart/editable_shipping_statuses instead of fluent-cart/editable_order_statuses.');
263 + $statuses = [
264 + self::SHIPPING_UNSHIPPED => __('Unshipped', 'fluent-cart'),
265 + self::SHIPPING_SHIPPED => __('Shipped', 'fluent-cart'),
266 + self::SHIPPING_DELIVERED => __('Delivered', 'fluent-cart'),
267 + self::SHIPPING_UNSHIPPABLE => __('Unshippable', 'fluent-cart'),
268 + ];
258 269
259 270 return apply_filters('fluent_cart/editable_shipping_statuses', $statuses, []);
260 271 }
261 272
@@ -323,12 +334,20 @@
323 334 {
324 335 return [
325 336 self::PAYMENT_PAID,
326 337 self::PAYMENT_PARTIALLY_REFUNDED,
327 - self::PAYMENT_PARTIALLY_PAID
338 + self::PAYMENT_PARTIALLY_PAID,
328 339 ];
329 340 }
330 341
342 + public static function getPaymentRetryableStatuses()
343 + {
344 + return [
345 + self::PAYMENT_PENDING,
346 + self::PAYMENT_FAILED
347 + ];
348 + }
349 +
331 350 public static function getReportStatuses()
332 351 {
333 352 return [
334 353 self::PAYMENT_PAID,
@@ -342,8 +361,61 @@
342 361 {
343 362 return apply_filters('fluent_cart/transaction_success_statuses', [self::TRANSACTION_SUCCEEDED, self::TRANSACTION_AUTHORIZED], []);
344 363 }
345 364
365 + /**
366 + * All product review statuses (fct_product_reviews.status values).
367 + */
368 + public static function getReviewStatuses(): array
369 + {
370 + return [
371 + self::REVIEW_APPROVED,
372 + self::REVIEW_PENDING,
373 + self::REVIEW_SPAM,
374 + self::REVIEW_TRASH,
375 + ];
376 + }
377 +
378 + /**
379 + * Review statuses that count as an existing review for duplicate
380 + * detection. Spam and trash are deliberately excluded — a review the
381 + * store rejected does not block the customer from submitting a fresh
382 + * one. Every surface that projects "can this user review?" must use
383 + * this set so it never contradicts the
384 + * ProductReviewService::canSubmitReview() write-path guard.
385 + */
386 + public static function getReviewDuplicateStatuses(): array
387 + {
388 + return apply_filters('fluent_cart/review_duplicate_statuses', [
389 + self::REVIEW_APPROVED,
390 + self::REVIEW_PENDING,
391 + ]);
392 + }
393 +
394 + /**
395 + * Review statuses the author may see in their own history: everything
396 + * except spam and trash.
397 + *
398 + * Derived by exclusion, not by listing, so a status added later is
399 + * visible to its author by default — only the two that mean "this is not
400 + * really a review" are held back, and a customer who has been silently
401 + * spammed or trashed is not shown that judgement.
402 + *
403 + * Deliberately NOT getReviewDuplicateStatuses(). The two sets happen to
404 + * hold the same values today, but they answer different questions, and
405 + * that one is filterable: a site narrowing its duplicate rules would
406 + * otherwise hide customers' pending reviews from them as a side effect.
407 + *
408 + * @return array
409 + */
410 + public static function getReviewAuthorVisibleStatuses(): array
411 + {
412 + return array_values(array_diff(
413 + static::getReviewStatuses(),
414 + [self::REVIEW_SPAM, self::REVIEW_TRASH]
415 + ));
416 + }
417 +
346 418 // Get all statuses (optional utility)
347 419 public static function all()
348 420 {
349 421 return [
@@ -358,14 +430,12 @@
358 430 }
359 431
360 432 public static function getEditableCustomerStatuses()
361 433 {
362 - $statuses = apply_filters_deprecated('fluent-cart/editable_customer_statuses', [
363 - [
364 - self::CUSTOMER_ACTIVE => __('Active', 'fluent-cart'),
365 - self::CUSTOMER_INACTIVE => __('Inactive', 'fluent-cart'),
366 - ], []
367 - ], '1.3.16', 'fluent_cart/editable_customer_statuses', 'Use fluent_cart/editable_customer_statuses instead of fluent-cart/editable_customer_statuses.');
434 + $statuses = [
435 + self::CUSTOMER_ACTIVE => __('Active', 'fluent-cart'),
436 + self::CUSTOMER_INACTIVE => __('Inactive', 'fluent-cart'),
437 + ];
368 438
369 439 return apply_filters('fluent_cart/editable_customer_statuses', $statuses, []);
370 440 }
371 441
@@ -446,8 +516,12 @@
446 516 'options' => [
447 517 [
448 518 'value' => 'subscription_activated',
449 519 'label' => __('Subscription Activated', 'fluent-cart')
520 + ],
521 + [
522 + 'value' => 'subscription_reactivated',
523 + 'label' => __('Subscription Reactivated', 'fluent-cart')
450 524 ],
451 525 [
452 526 'value' => 'subscription_canceled',
453 527 'label' => __('Subscription Canceled', 'fluent-cart')