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

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

101 lines 6.8 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\ShopController;
14 use FluentCart\App\Http\Controllers\UserController;
15 use FluentCart\App\Modules\Shipping\Http\Controllers\Frontend\ShippingFrontendController;
16 use FluentCart\Framework\Http\Router;
17
18 $router->prefix('public')
19 ->withPolicy('PublicPolicy')->group(function (Router $router) {
20 $router->get('products', [ShopController::class, 'getProducts']);
21 $router->get('product-views', [ShopController::class, 'getProductViews']);
22 $router->get('product-search', [ShopController::class, 'searchProduct']);
23 });
24
25 $router->prefix('cart')
26 ->withPolicy('PublicPolicy')->group(function (Router $router) {
27 // add_item removed — cart updates go through the WordPress AJAX handler
28 // (fluent_cart_cart_update action in WebCheckoutHandler), not this REST route.
29 //$router->post('/apply-coupon', [CartController::class, 'applyCoupon']);
30 //$router->post('/cancel-coupon', [CartController::class, 'cancelCoupon']);
31 //$router->post('/re-apply-coupon', [CartController::class, 'reapplyCoupon']);
32 });
33
34 $router->prefix('checkout')
35 ->withPolicy('PublicPolicy')->group(function (Router $router) {
36 $router->post('place-order', [CheckoutController::class, 'placeOrder']);
37 $router->get('get-order-info', [CheckoutController::class, 'getOrderInfo']);
38 $router->get('get-checkout-summary-view', [CheckoutController::class, 'getCheckoutSummary']);
39 $router->get('/get-available-shipping-methods', [ShippingFrontendController::class, 'getAvailableShippingMethods']);
40 $router->get('/get-shipping-methods-list-view', [ShippingFrontendController::class, 'getShippingMethodsListView']);
41 $router->get('/get-country-info', [ShippingFrontendController::class, 'getCountryInfo']);
42 });
43
44 $router->prefix('user')->withPolicy('PublicPolicy')->group(function (Router $router) {
45 //$router->post('register', [UserController::class, 'register']);
46 $router->post('login', [UserController::class, 'login']);
47 });
48
49 $router->prefix('customers')
50 ->withPolicy('PublicPolicy')->group(function (Router $router) {
51 // Customer self-service (details/orders/address CRUD) lives under the
52 // customer-profile group — the duplicates that used to sit here shadowed
53 // the admin customers group and were unreachable dead code (audit #5).
54 // Only these checkout-context routes, with no admin counterpart, remain.
55 // PublicPolicy rather than a login gate (audit #6): guests reach these
56 // from checkout, and both controllers fully self-guard (current-customer
57 // resolution + ownership), answering guests with their own envelopes.
58 $router->get('/{customerAddressId}/update-address-select', [CustomerController::class, 'updateAddressSelect']);
59 $router->post('/add-address', [CustomerController::class, 'createAddress']);
60 });
61
62 $router->prefix('customer-profile')->withPolicy('CustomerFrontendPolicy')->group(function (Router $router) {
63 $router->get('/', [CustomerProfileController::class, 'index']);
64 $router->get('/downloads', [CustomerProfileController::class, 'getDownloads']);
65
66 $router->get('/profile', [CustomerProfileController::class, 'getCustomerProfileDetails']);
67 $router->get('/sections', [CustomerProfileController::class, 'getSections']);
68 $router->post('/create-address', [CustomerProfileController::class, 'createCustomerProfileAddress']);
69
70 $router->post('/edit-address', [CustomerProfileController::class, 'updateCustomerProfileAddress']);
71 $router->post('/make-primary-address', [CustomerProfileController::class, 'makePrimaryCustomerProfileAddress']);
72 $router->post('/delete-address', [CustomerProfileController::class, 'deleteCustomerProfileAddress']);
73
74 $router->post('/update', [CustomerProfileController::class, 'updateCustomerProfileDetails']);
75
76
77 // orders
78 $router->get('orders', [CustomerOrderController::class, 'getOrders']);
79 $router->get('orders/{order_uuid}', [CustomerOrderController::class, 'orderDetails'])->alphaNumDash('order_uuid');
80 $router->get('orders/{order_uuid}/upgrade-paths', [CustomerProfileController::class, 'getUpgradePaths'])->alphaNumDash('order_uuid');
81
82 // Order billing address
83 $router->get('orders/{transaction_uuid}/billing-address', [CustomerOrderController::class, 'getTransactionBillingAddress'])->alphaNumDash('transaction_uuid');
84 $router->put('orders/{transaction_uuid}/billing-address', [CustomerOrderController::class, 'saveTransactionBillingAddress'])->alphaNumDash('transaction_uuid');
85
86
87 // subscriptions
88 $router->get('subscriptions', [CustomerSubscriptionController::class, 'getSubscriptions']);
89 $router->get('subscriptions/{subscription_uuid}', [CustomerSubscriptionController::class, 'getSubscription'])->alphaNumDash('subscription_uuid');
90 $router->get('subscriptions/{subscription_uuid}/setup-intent-attempts', [CustomerSubscriptionController::class, 'getSetupIntentRemainingAttempts'])->alphaNumDash('subscription_uuid');
91 $router->post('subscriptions/{subscription_uuid}/update-payment-method', [CustomerSubscriptionController::class, 'updatePaymentMethod'])->alphaNumDash('subscription_uuid');
92 $router->post('subscriptions/{subscription_uuid}/get-or-create-plan', [CustomerSubscriptionController::class, 'getOrCreatePlan'])->alphaNumDash('subscription_uuid');
93 $router->post('subscriptions/{subscription_uuid}/switch-payment-method', [CustomerSubscriptionController::class, 'switchPaymentMethod'])->alphaNumDash('subscription_uuid');
94 $router->post('subscriptions/{subscription_uuid}/confirm-subscription-switch', [CustomerSubscriptionController::class, 'confirmSubscriptionSwitch'])->alphaNumDash('subscription_uuid');
95 $router->post('subscriptions/{subscription_uuid}/cancel-auto-renew', [CustomerSubscriptionController::class, 'cancelAutoRenew'])->alphaNumDash('subscription_uuid');
96 $router->post('subscriptions/{subscription_uuid}/initiate-early-payment', [CustomerSubscriptionController::class, 'initiateEarlyPayment'])->alphaNumDash('subscription_uuid');
97 $router->post('subscriptions/{subscription_uuid}/pause', [CustomerSubscriptionController::class, 'pauseSubscription'])->alphaNumDash('subscription_uuid');
98 $router->post('subscriptions/{subscription_uuid}/resume', [CustomerSubscriptionController::class, 'resumeSubscription'])->alphaNumDash('subscription_uuid');
99
100 });
101