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
fluent-cart / app / Http / Routes / frontend_routes.php

frontend_routes.php in FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler 1.7.0, at app/Http/Routes/frontend_routes.php

116 lines 8.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php if ( ! defined( 'ABSPATH' ) ) exit; ?>
2 <?php
3 /**
4 * @var $router \FluentCart\Framework\Http\Router
5 */
6
7 use FluentCart\App\Http\Controllers\CartController;
8 use FluentCart\App\Http\Controllers\CheckoutController;
9 use FluentCart\App\Http\Controllers\FrontendControllers\CustomerController;
10 use FluentCart\App\Http\Controllers\FrontendControllers\CustomerOrderController;
11 use FluentCart\App\Http\Controllers\FrontendControllers\CustomerProfileController;
12 use FluentCart\App\Http\Controllers\FrontendControllers\CustomerSubscriptionController;
13 use FluentCart\App\Http\Controllers\FrontendControllers\ProductReviewFrontendController;
14 use FluentCart\App\Http\Controllers\ShopController;
15 use FluentCart\App\Http\Controllers\UserController;
16 use FluentCart\App\Modules\Shipping\Http\Controllers\Frontend\ShippingFrontendController;
17 use FluentCart\Framework\Http\Router;
18
19 $router->prefix('public')
20 ->withPolicy('PublicPolicy')->group(function (Router $router) {
21 $router->get('products', [ShopController::class, 'getProducts']);
22 $router->get('product-views', [ShopController::class, 'getProductViews']);
23 $router->get('product-search', [ShopController::class, 'searchProduct']);
24 });
25
26 $router->prefix('cart')
27 ->withPolicy('PublicPolicy')->group(function (Router $router) {
28 // add_item removed — cart updates go through the WordPress AJAX handler
29 // (fluent_cart_cart_update action in WebCheckoutHandler), not this REST route.
30 //$router->post('/apply-coupon', [CartController::class, 'applyCoupon']);
31 //$router->post('/cancel-coupon', [CartController::class, 'cancelCoupon']);
32 //$router->post('/re-apply-coupon', [CartController::class, 'reapplyCoupon']);
33 });
34
35 $router->prefix('checkout')
36 ->withPolicy('PublicPolicy')->group(function (Router $router) {
37 $router->post('place-order', [CheckoutController::class, 'placeOrder']);
38 $router->get('get-order-info', [CheckoutController::class, 'getOrderInfo']);
39 $router->get('get-checkout-summary-view', [CheckoutController::class, 'getCheckoutSummary']);
40 $router->get('/get-available-shipping-methods', [ShippingFrontendController::class, 'getAvailableShippingMethods']);
41 $router->get('/get-shipping-methods-list-view', [ShippingFrontendController::class, 'getShippingMethodsListView']);
42 $router->get('/get-country-info', [ShippingFrontendController::class, 'getCountryInfo']);
43 });
44
45 $router->prefix('user')->withPolicy('PublicPolicy')->group(function (Router $router) {
46 //$router->post('register', [UserController::class, 'register']);
47 $router->post('login', [UserController::class, 'login']);
48 });
49
50 $router->prefix('customers')
51 ->withPolicy('PublicPolicy')->group(function (Router $router) {
52 // Customer self-service (details/orders/address CRUD) lives under the
53 // customer-profile group — the duplicates that used to sit here shadowed
54 // the admin customers group and were unreachable dead code (audit #5).
55 // Only these checkout-context routes, with no admin counterpart, remain.
56 // PublicPolicy rather than a login gate (audit #6): guests reach these
57 // from checkout, and both controllers fully self-guard (current-customer
58 // resolution + ownership), answering guests with their own envelopes.
59 $router->get('/{customerAddressId}/update-address-select', [CustomerController::class, 'updateAddressSelect']);
60 $router->post('/add-address', [CustomerController::class, 'createAddress']);
61 });
62
63 $router->prefix('customer-profile')->withPolicy('CustomerFrontendPolicy')->group(function (Router $router) {
64 $router->get('/', [CustomerProfileController::class, 'index']);
65 $router->get('/downloads', [CustomerProfileController::class, 'getDownloads']);
66
67 $router->get('/profile', [CustomerProfileController::class, 'getCustomerProfileDetails']);
68 $router->get('/sections', [CustomerProfileController::class, 'getSections']);
69 $router->post('/create-address', [CustomerProfileController::class, 'createCustomerProfileAddress']);
70
71 $router->post('/edit-address', [CustomerProfileController::class, 'updateCustomerProfileAddress']);
72 $router->post('/make-primary-address', [CustomerProfileController::class, 'makePrimaryCustomerProfileAddress']);
73 $router->post('/delete-address', [CustomerProfileController::class, 'deleteCustomerProfileAddress']);
74
75 $router->post('/update', [CustomerProfileController::class, 'updateCustomerProfileDetails']);
76
77
78 // orders
79 $router->get('orders', [CustomerOrderController::class, 'getOrders']);
80 $router->get('orders/{order_uuid}', [CustomerOrderController::class, 'orderDetails'])->alphaNumDash('order_uuid');
81 $router->get('orders/{order_uuid}/upgrade-paths', [CustomerProfileController::class, 'getUpgradePaths'])->alphaNumDash('order_uuid');
82
83 // Order billing address
84 $router->get('orders/{transaction_uuid}/billing-address', [CustomerOrderController::class, 'getTransactionBillingAddress'])->alphaNumDash('transaction_uuid');
85 $router->put('orders/{transaction_uuid}/billing-address', [CustomerOrderController::class, 'saveTransactionBillingAddress'])->alphaNumDash('transaction_uuid');
86
87
88 // subscriptions
89 $router->get('subscriptions', [CustomerSubscriptionController::class, 'getSubscriptions']);
90 $router->get('subscriptions/{subscription_uuid}', [CustomerSubscriptionController::class, 'getSubscription'])->alphaNumDash('subscription_uuid');
91 $router->get('subscriptions/{subscription_uuid}/setup-intent-attempts', [CustomerSubscriptionController::class, 'getSetupIntentRemainingAttempts'])->alphaNumDash('subscription_uuid');
92 $router->post('subscriptions/{subscription_uuid}/update-payment-method', [CustomerSubscriptionController::class, 'updatePaymentMethod'])->alphaNumDash('subscription_uuid');
93 $router->post('subscriptions/{subscription_uuid}/get-or-create-plan', [CustomerSubscriptionController::class, 'getOrCreatePlan'])->alphaNumDash('subscription_uuid');
94 $router->post('subscriptions/{subscription_uuid}/switch-payment-method', [CustomerSubscriptionController::class, 'switchPaymentMethod'])->alphaNumDash('subscription_uuid');
95 $router->post('subscriptions/{subscription_uuid}/confirm-subscription-switch', [CustomerSubscriptionController::class, 'confirmSubscriptionSwitch'])->alphaNumDash('subscription_uuid');
96 $router->post('subscriptions/{subscription_uuid}/cancel-auto-renew', [CustomerSubscriptionController::class, 'cancelAutoRenew'])->alphaNumDash('subscription_uuid');
97 $router->post('subscriptions/{subscription_uuid}/initiate-early-payment', [CustomerSubscriptionController::class, 'initiateEarlyPayment'])->alphaNumDash('subscription_uuid');
98 $router->post('subscriptions/{subscription_uuid}/pause', [CustomerSubscriptionController::class, 'pauseSubscription'])->alphaNumDash('subscription_uuid');
99 $router->post('subscriptions/{subscription_uuid}/resume', [CustomerSubscriptionController::class, 'resumeSubscription'])->alphaNumDash('subscription_uuid');
100
101 // my reviews — type=pending returns the to-be-reviewed products
102 $router->get('reviews', [ProductReviewFrontendController::class, 'getReviewsByCustomer']);
103 $router->get('reviews/submission-form', [ProductReviewFrontendController::class, 'getReviewSubmissionForm']);
104 });
105
106 // Public product reviews routes
107 $router->prefix('public/reviews')
108 ->withPolicy('PublicPolicy')->group(function (Router $router) {
109 $router->get('/{postId}', [ProductReviewFrontendController::class, 'getReviews'])->int('postId');
110 $router->get('/{postId}/summary', [ProductReviewFrontendController::class, 'getRatingSummary'])->int('postId');
111 $router->post('/{postId}', [ProductReviewFrontendController::class, 'submitReview'])->int('postId');
112 $router->put('/{postId}/{reviewId}', [ProductReviewFrontendController::class, 'updateReview'])->int('postId')->int('reviewId');
113 $router->get('/{postId}/{reviewId}/replies', [ProductReviewFrontendController::class, 'getReplies'])->int('postId')->int('reviewId');
114 $router->get('/{postId}/{reviewId}/modal', [ProductReviewFrontendController::class, 'getModalView'])->int('postId')->int('reviewId');
115 });
116