admin.php
576 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WordPress Admin Routes. |
| 4 | * WARNING: Do not use \SureCart::route()->all() here, otherwise you will override |
| 5 | * ALL custom admin pages which you most likely do not want to do. |
| 6 | * |
| 7 | * @link https://docs.wpemerge.com/#/framework/routing/methods |
| 8 | * |
| 9 | * @package SureCart |
| 10 | */ |
| 11 | |
| 12 | use SureCart\Middleware\AccountClaimMiddleware; |
| 13 | use SureCart\Models\ApiToken; |
| 14 | |
| 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | exit; |
| 17 | } |
| 18 | |
| 19 | /* |
| 20 | |-------------------------------------------------------------------------- |
| 21 | | Onboarding |
| 22 | |-------------------------------------------------------------------------- |
| 23 | */ |
| 24 | \SureCart::route() |
| 25 | ->get() |
| 26 | ->where( 'admin', 'sc-getting-started' ) |
| 27 | ->name( 'onboarding.show' ) |
| 28 | ->middleware( 'user.can:manage_options' ) |
| 29 | ->middleware( 'assets.components' ) |
| 30 | ->middleware( 'assets.brand_colors' ) |
| 31 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Onboarding\\' ) |
| 32 | ->handle( 'OnboardingController@show' ); |
| 33 | |
| 34 | /* |
| 35 | |-------------------------------------------------------------------------- |
| 36 | | Claim Account |
| 37 | |-------------------------------------------------------------------------- |
| 38 | */ |
| 39 | \SureCart::route() |
| 40 | ->get() |
| 41 | ->where( 'admin', 'sc-claim-account' ) |
| 42 | ->name( 'account.claim' ) |
| 43 | ->middleware( AccountClaimMiddleware::class ) |
| 44 | ->middleware( 'assets.brand_colors' ) |
| 45 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Onboarding\\' ) |
| 46 | ->handle( 'OnboardingController@show' ); |
| 47 | |
| 48 | /* |
| 49 | |-------------------------------------------------------------------------- |
| 50 | | Dashboard |
| 51 | |-------------------------------------------------------------------------- |
| 52 | */ |
| 53 | \SureCart::route() |
| 54 | ->get() |
| 55 | ->where( 'admin', 'sc-dashboard' ) |
| 56 | ->middleware( 'user.can:manage_sc_shop_settings' ) |
| 57 | ->middleware( 'assets.components' ) |
| 58 | ->middleware( 'assets.brand_colors' ) |
| 59 | ->name( 'dashboard.show' ) |
| 60 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Dashboard\\' ) |
| 61 | ->handle( 'DashboardController@index' ); |
| 62 | |
| 63 | /* |
| 64 | |-------------------------------------------------------------------------- |
| 65 | | Complete Signup |
| 66 | |-------------------------------------------------------------------------- |
| 67 | */ |
| 68 | \SureCart::route() |
| 69 | ->get() |
| 70 | ->where( 'admin', 'sc-complete-signup' ) |
| 71 | ->middleware( 'user.can:manage_options' ) |
| 72 | ->middleware( 'assets.components' ) |
| 73 | ->middleware( 'assets.brand_colors' ) |
| 74 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Onboarding\\' ) |
| 75 | ->group( |
| 76 | function () { |
| 77 | \SureCart::route()->get()->handle( 'OnboardingController@complete' ); |
| 78 | \SureCart::route()->post()->middleware( 'nonce:update_plugin_settings' )->handle( 'OnboardingController@save' ); |
| 79 | } |
| 80 | ); |
| 81 | |
| 82 | |
| 83 | /* |
| 84 | |-------------------------------------------------------------------------- |
| 85 | | Orders |
| 86 | |-------------------------------------------------------------------------- |
| 87 | */ |
| 88 | \SureCart::route() |
| 89 | ->where( 'admin', 'sc-orders' ) |
| 90 | ->middleware( 'user.can:edit_sc_orders' ) |
| 91 | ->middleware( 'assets.components' ) |
| 92 | ->middleware( 'assets.admin_colors' ) |
| 93 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Orders\\' ) |
| 94 | ->group( |
| 95 | function () { |
| 96 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'OrdersViewController@index' ); |
| 97 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'OrdersViewController@edit' ); |
| 98 | \SureCart::route()->get()->where( 'sc_url_var', 'archive', 'action' )->handle( 'OrdersViewController@archive' ); |
| 99 | } |
| 100 | ); |
| 101 | |
| 102 | /* |
| 103 | |-------------------------------------------------------------------------- |
| 104 | | Invoices |
| 105 | |-------------------------------------------------------------------------- |
| 106 | */ |
| 107 | \SureCart::route() |
| 108 | ->where( 'admin', 'sc-invoices' ) |
| 109 | ->middleware( 'user.can:edit_sc_invoices' ) |
| 110 | ->middleware( 'assets.components' ) |
| 111 | ->middleware( 'assets.admin_colors' ) |
| 112 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Invoices\\' ) |
| 113 | ->group( |
| 114 | function () { |
| 115 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'InvoicesViewController@index' ); |
| 116 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'InvoicesViewController@edit' ); |
| 117 | \SureCart::route()->get()->where( 'sc_url_var', 'create', 'action' )->middleware( 'nonce:create_invoices' )->handle( 'InvoicesViewController@create' ); |
| 118 | } |
| 119 | ); |
| 120 | |
| 121 | /* |
| 122 | |-------------------------------------------------------------------------- |
| 123 | | Checkouts |
| 124 | |-------------------------------------------------------------------------- |
| 125 | */ |
| 126 | \SureCart::route() |
| 127 | ->where( 'admin', 'sc-checkouts' ) |
| 128 | ->middleware( 'user.can:edit_sc_orders' ) |
| 129 | ->middleware( 'assets.components' ) |
| 130 | ->middleware( 'assets.admin_colors' ) |
| 131 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Checkouts\\' ) |
| 132 | ->group( |
| 133 | function () { |
| 134 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'CheckoutsController@edit' ); |
| 135 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'CheckoutsController@edit' ); |
| 136 | } |
| 137 | ); |
| 138 | |
| 139 | /* |
| 140 | |-------------------------------------------------------------------------- |
| 141 | | Products |
| 142 | |-------------------------------------------------------------------------- |
| 143 | */ |
| 144 | \SureCart::route() |
| 145 | ->where( 'admin', 'sc-products' ) |
| 146 | ->middleware( 'user.can:edit_sc_products' ) |
| 147 | ->middleware( 'assets.components' ) |
| 148 | ->middleware( 'assets.admin_colors' ) |
| 149 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Products\\' ) |
| 150 | ->group( |
| 151 | function () { |
| 152 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'ProductsController@index' ); |
| 153 | \SureCart::route()->get()->where( 'sc_url_var', 'delete', 'action' )->handle( 'ProductsController@confirmBulkDelete' ); |
| 154 | \SureCart::route()->post()->middleware( 'nonce:bulk_delete_nonce' )->handle( 'ProductsController@bulkDelete' ); |
| 155 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'ProductsController@edit' ); |
| 156 | \SureCart::route()->get()->where( 'sc_url_var', 'toggle_archive', 'action' )->middleware( 'archive_model:product' )->handle( 'ProductsController@toggleArchive' ); |
| 157 | \SureCart::route()->get()->where( 'sc_url_var', 'sync_all', 'action' )->middleware( 'nonce:sync_products' )->handle( 'ProductsController@syncAll' ); |
| 158 | \SureCart::route()->get()->where( 'sc_url_var', 'sync', 'action' )->middleware( 'nonce:sync_product' )->handle( 'ProductsController@sync' ); |
| 159 | } |
| 160 | ); |
| 161 | |
| 162 | /* |
| 163 | |-------------------------------------------------------------------------- |
| 164 | | Coupons |
| 165 | |-------------------------------------------------------------------------- |
| 166 | */ |
| 167 | \SureCart::route() |
| 168 | ->where( 'admin', 'sc-coupons' ) |
| 169 | ->middleware( 'user.can:edit_sc_coupons' ) |
| 170 | ->middleware( 'assets.components' ) |
| 171 | ->middleware( 'assets.admin_colors' ) |
| 172 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Coupons\\' ) |
| 173 | ->group( |
| 174 | function () { |
| 175 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'CouponsController@index' ); |
| 176 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'CouponsController@edit' ); |
| 177 | } |
| 178 | ); |
| 179 | |
| 180 | /* |
| 181 | |-------------------------------------------------------------------------- |
| 182 | | Customers |
| 183 | |-------------------------------------------------------------------------- |
| 184 | */ |
| 185 | \SureCart::route() |
| 186 | ->where( 'admin', 'sc-customers' ) |
| 187 | ->middleware( 'user.can:edit_sc_customers' ) |
| 188 | ->middleware( 'assets.components' ) |
| 189 | ->middleware( 'assets.admin_colors' ) |
| 190 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Customers\\' ) |
| 191 | ->group( |
| 192 | function () { |
| 193 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'CustomersController@index' ); |
| 194 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'CustomersController@edit' ); |
| 195 | } |
| 196 | ); |
| 197 | |
| 198 | /* |
| 199 | |-------------------------------------------------------------------------- |
| 200 | | Licenses |
| 201 | |-------------------------------------------------------------------------- |
| 202 | */ |
| 203 | \SureCart::route() |
| 204 | ->where( 'admin', 'sc-licenses' ) |
| 205 | ->middleware( 'user.can:edit_sc_products' ) |
| 206 | ->middleware( 'assets.components' ) |
| 207 | ->middleware( 'assets.admin_colors' ) |
| 208 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Licenses\\' ) |
| 209 | ->group( |
| 210 | function () { |
| 211 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'LicensesController@index' ); |
| 212 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'LicensesController@edit' ); |
| 213 | } |
| 214 | ); |
| 215 | |
| 216 | /* |
| 217 | |-------------------------------------------------------------------------- |
| 218 | | Abandoned Checkouts |
| 219 | |-------------------------------------------------------------------------- |
| 220 | */ |
| 221 | \SureCart::route() |
| 222 | ->where( 'admin', 'sc-abandoned-checkouts' ) |
| 223 | ->middleware( 'user.can:edit_sc_orders' ) |
| 224 | ->middleware( 'assets.components' ) |
| 225 | ->middleware( 'assets.admin_colors' ) |
| 226 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Abandoned\\' ) |
| 227 | ->group( |
| 228 | function () { |
| 229 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'AbandonedCheckoutViewController@index' ); |
| 230 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'AbandonedCheckoutViewController@edit' ); |
| 231 | } |
| 232 | ); |
| 233 | |
| 234 | /* |
| 235 | |-------------------------------------------------------------------------- |
| 236 | | Subscriptions |
| 237 | |-------------------------------------------------------------------------- |
| 238 | */ |
| 239 | \SureCart::route() |
| 240 | ->where( 'admin', 'sc-subscriptions' ) |
| 241 | ->middleware( 'user.can:edit_sc_subscriptions' ) |
| 242 | ->middleware( 'assets.components' ) |
| 243 | ->middleware( 'assets.admin_colors' ) |
| 244 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Subscriptions\\' ) |
| 245 | ->group( |
| 246 | function () { |
| 247 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'SubscriptionsController@index' ); |
| 248 | \SureCart::route()->get()->where( 'sc_url_var', 'show', 'action' )->handle( 'SubscriptionsController@show' ); |
| 249 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'SubscriptionsController@edit' ); |
| 250 | } |
| 251 | ); |
| 252 | |
| 253 | /* |
| 254 | |-------------------------------------------------------------------------- |
| 255 | | Cancellation Insights |
| 256 | |-------------------------------------------------------------------------- |
| 257 | */ |
| 258 | \SureCart::route() |
| 259 | ->where( 'admin', 'sc-cancellation-insights' ) |
| 260 | ->middleware( 'user.can:edit_sc_subscriptions' ) |
| 261 | ->middleware( 'assets.components' ) |
| 262 | ->middleware( 'assets.admin_colors' ) |
| 263 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\CancellationInsights\\' ) |
| 264 | ->group( |
| 265 | function () { |
| 266 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'CancellationInsightsController@index' ); |
| 267 | \SureCart::route()->get()->where( 'sc_url_var', 'show', 'action' )->handle( 'CancellationInsightsController@show' ); |
| 268 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'CancellationInsightsController@edit' ); |
| 269 | } |
| 270 | ); |
| 271 | |
| 272 | |
| 273 | \SureCart::route() |
| 274 | ->where( 'admin', 'cart' ) |
| 275 | ->middleware( 'user.can:manage_options' ) |
| 276 | ->middleware( 'assets.components' ) |
| 277 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Cart\\' ) |
| 278 | ->group( |
| 279 | function () { |
| 280 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'CartController@edit' ); |
| 281 | \SureCart::route()->get()->where( 'sc_url_var', 'show', 'action' )->handle( 'CartController@edit' ); |
| 282 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'CartController@edit' ); |
| 283 | } |
| 284 | ); |
| 285 | |
| 286 | /* |
| 287 | |-------------------------------------------------------------------------- |
| 288 | | Upgrade Paths |
| 289 | |-------------------------------------------------------------------------- |
| 290 | */ |
| 291 | \SureCart::route() |
| 292 | ->where( 'admin', 'sc-product-groups' ) |
| 293 | ->middleware( 'user.can:edit_sc_products' ) |
| 294 | ->middleware( 'assets.components' ) |
| 295 | ->middleware( 'assets.admin_colors' ) |
| 296 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\ProductGroups\\' ) |
| 297 | ->group( |
| 298 | function () { |
| 299 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'ProductGroupsController@index' ); |
| 300 | \SureCart::route()->get()->where( 'sc_url_var', 'show', 'action' )->handle( 'ProductGroupsController@show' ); |
| 301 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'ProductGroupsController@show' ); |
| 302 | } |
| 303 | ); |
| 304 | |
| 305 | /* |
| 306 | |-------------------------------------------------------------------------- |
| 307 | | Product Collections |
| 308 | |-------------------------------------------------------------------------- |
| 309 | */ |
| 310 | \SureCart::route() |
| 311 | ->where( 'admin', 'sc-product-collections' ) |
| 312 | ->middleware( 'user.can:edit_sc_products' ) |
| 313 | ->middleware( 'assets.components' ) |
| 314 | ->middleware( 'assets.admin_colors' ) |
| 315 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\ProductCollections\\' ) |
| 316 | ->group( |
| 317 | function () { |
| 318 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'ProductCollectionsController@index' ); |
| 319 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'ProductCollectionsController@edit' ); |
| 320 | } |
| 321 | ); |
| 322 | |
| 323 | /* |
| 324 | |-------------------------------------------------------------------------- |
| 325 | | Upgrade Paths |
| 326 | |-------------------------------------------------------------------------- |
| 327 | */ |
| 328 | \SureCart::route() |
| 329 | ->where( 'admin', 'sc-bumps' ) |
| 330 | ->middleware( 'user.can:edit_sc_products' ) |
| 331 | ->middleware( 'assets.components' ) |
| 332 | ->middleware( 'assets.admin_colors' ) |
| 333 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Bumps\\' ) |
| 334 | ->group( |
| 335 | function () { |
| 336 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'BumpsController@index' ); |
| 337 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'BumpsController@edit' ); |
| 338 | } |
| 339 | ); |
| 340 | |
| 341 | |
| 342 | /* |
| 343 | |-------------------------------------------------------------------------- |
| 344 | | Upsell Paths |
| 345 | |-------------------------------------------------------------------------- |
| 346 | */ |
| 347 | \SureCart::route() |
| 348 | ->where( 'admin', 'sc-upsell-funnels' ) |
| 349 | ->middleware( 'user.can:edit_sc_products' ) |
| 350 | ->middleware( 'assets.components' ) |
| 351 | ->middleware( 'assets.admin_colors' ) |
| 352 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Upsells\\' ) |
| 353 | ->group( |
| 354 | function () { |
| 355 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'UpsellsController@index' ); |
| 356 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'UpsellsController@edit' ); |
| 357 | \SureCart::route()->get()->where( 'sc_url_var', 'toggle_enabled', 'action' )->middleware( 'archive_model:product' )->handle( 'UpsellsController@toggleEnabled' ); |
| 358 | } |
| 359 | ); |
| 360 | |
| 361 | /* |
| 362 | |-------------------------------------------------------------------------- |
| 363 | | Affiliations |
| 364 | |-------------------------------------------------------------------------- |
| 365 | */ |
| 366 | \SureCart::route() |
| 367 | ->where( 'admin', 'sc-affiliates' ) |
| 368 | ->middleware( 'user.can:edit_sc_affiliates' ) |
| 369 | ->middleware( 'assets.components' ) |
| 370 | ->middleware( 'assets.admin_colors' ) |
| 371 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Affiliations\\' ) |
| 372 | ->group( |
| 373 | function () { |
| 374 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'AffiliationsController@index' ); |
| 375 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'AffiliationsController@edit' ); |
| 376 | \SureCart::route()->get()->where( 'sc_url_var', 'activate', 'action' )->middleware( 'nonce:activate_affiliation' )->handle( 'AffiliationsController@activate' ); |
| 377 | \SureCart::route()->get()->where( 'sc_url_var', 'deactivate', 'action' )->middleware( 'nonce:deactivate_affiliation' )->handle( 'AffiliationsController@deactivate' ); |
| 378 | } |
| 379 | ); |
| 380 | |
| 381 | \SureCart::route() |
| 382 | ->where( 'admin', 'sc-affiliate-requests' ) |
| 383 | ->middleware( 'user.can:edit_sc_affiliates' ) |
| 384 | ->middleware( 'assets.components' ) |
| 385 | ->middleware( 'assets.admin_colors' ) |
| 386 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\AffiliationRequests\\' ) |
| 387 | ->group( |
| 388 | function () { |
| 389 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'AffiliationRequestsController@index' ); |
| 390 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'AffiliationRequestsController@edit' ); |
| 391 | } |
| 392 | ); |
| 393 | |
| 394 | \SureCart::route() |
| 395 | ->where( 'admin', 'sc-affiliate-clicks' ) |
| 396 | ->middleware( 'user.can:edit_sc_affiliates' ) |
| 397 | ->middleware( 'assets.components' ) |
| 398 | ->middleware( 'assets.admin_colors' ) |
| 399 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\AffiliationClicks\\' ) |
| 400 | ->group( |
| 401 | function () { |
| 402 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'AffiliationClicksController@index' ); |
| 403 | } |
| 404 | ); |
| 405 | |
| 406 | \SureCart::route() |
| 407 | ->where( 'admin', 'sc-affiliate-referrals' ) |
| 408 | ->middleware( 'user.can:edit_sc_affiliates' ) |
| 409 | ->middleware( 'assets.components' ) |
| 410 | ->middleware( 'assets.admin_colors' ) |
| 411 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\AffiliationReferrals\\' ) |
| 412 | ->group( |
| 413 | function () { |
| 414 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'AffiliationReferralsController@index' ); |
| 415 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'AffiliationReferralsController@edit' ); |
| 416 | \SureCart::route()->get()->where( 'sc_url_var', 'delete', 'action' )->middleware( 'nonce:delete_affiliation' )->handle( 'AffiliationReferralsController@delete' ); |
| 417 | \SureCart::route()->get()->where( 'sc_url_var', 'approve', 'action' )->middleware( 'nonce:approve_affiliation' )->handle( 'AffiliationReferralsController@approve' ); |
| 418 | \SureCart::route()->get()->where( 'sc_url_var', 'deny', 'action' )->middleware( 'nonce:deny_affiliation' )->handle( 'AffiliationReferralsController@deny' ); |
| 419 | \SureCart::route()->get()->where( 'sc_url_var', 'make_reviewing', 'action' )->middleware( 'nonce:make_reviewing_affiliation' )->handle( 'AffiliationReferralsController@makeReviewing' ); |
| 420 | } |
| 421 | ); |
| 422 | |
| 423 | \SureCart::route() |
| 424 | ->where( 'admin', 'sc-affiliate-payouts' ) |
| 425 | ->middleware( 'user.can:edit_sc_affiliates' ) |
| 426 | ->middleware( 'assets.components' ) |
| 427 | ->middleware( 'assets.admin_colors' ) |
| 428 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\AffiliationPayouts\\' ) |
| 429 | ->group( |
| 430 | function () { |
| 431 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'AffiliationPayoutsController@index' ); |
| 432 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'AffiliationPayoutsController@edit' ); |
| 433 | \SureCart::route()->get()->where( 'sc_url_var', 'export', 'action' )->handle( 'AffiliationPayoutsController@export' ); |
| 434 | \SureCart::route()->get()->where( 'sc_url_var', 'delete', 'action' )->middleware( 'nonce:delete_affiliation_payout' )->handle( 'AffiliationPayoutsController@delete' ); |
| 435 | \SureCart::route()->get()->where( 'sc_url_var', 'complete', 'action' )->middleware( 'nonce:complete_affiliation_payout' )->handle( 'AffiliationPayoutsController@complete' ); |
| 436 | \SureCart::route()->get()->where( 'sc_url_var', 'make_processing', 'action' )->middleware( 'nonce:make_processing_affiliation_payout' )->handle( 'AffiliationPayoutsController@makeProcessing' ); |
| 437 | } |
| 438 | ); |
| 439 | |
| 440 | \SureCart::route() |
| 441 | ->where( 'admin', 'sc-affiliate-payout-groups' ) |
| 442 | ->middleware( 'user.can:edit_sc_affiliates' ) |
| 443 | ->middleware( 'assets.components' ) |
| 444 | ->middleware( 'assets.admin_colors' ) |
| 445 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\AffiliationPayoutGroups\\' ) |
| 446 | ->group( |
| 447 | function () { |
| 448 | \SureCart::route()->get()->where( 'sc_url_var', 'edit', 'action' )->handle( 'AffiliationPayoutGroupsController@edit' ); |
| 449 | } |
| 450 | ); |
| 451 | |
| 452 | /* |
| 453 | |-------------------------------------------------------------------------- |
| 454 | | Settings |
| 455 | |-------------------------------------------------------------------------- |
| 456 | */ |
| 457 | \SureCart::route() |
| 458 | ->get() |
| 459 | ->where( 'admin', 'sc-settings' ) |
| 460 | ->middleware( 'user.can:manage_sc_account_settings' ) |
| 461 | ->middleware( 'assets.components' ) |
| 462 | ->middleware( 'assets.brand_colors' ) |
| 463 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Settings\\' ) |
| 464 | ->group( |
| 465 | function () { |
| 466 | // limit menu routes if no API token. |
| 467 | if ( ! ApiToken::get() ) { |
| 468 | // without the var. |
| 469 | \SureCart::route()->get()->where( 'sc_url_var', false, 'tab' )->handle( 'ConnectionSettings@show' ); |
| 470 | |
| 471 | // with the var. |
| 472 | \SureCart::route()->get()->where( 'sc_url_var', 'connection', 'tab' )->handle( 'ConnectionSettings@show' ); |
| 473 | |
| 474 | // Advanced. |
| 475 | \SureCart::route()->get()->where( 'sc_url_var', 'advanced', 'tab' )->name( 'settings.advanced' )->handle( 'AdvancedSettings@show' ); |
| 476 | \SureCart::route()->post()->where( 'sc_url_var', 'advanced', 'tab' )->middleware( 'nonce:update_plugin_settings' )->handle( 'AdvancedSettings@save' ); |
| 477 | |
| 478 | // Cache. |
| 479 | \SureCart::route()->post()->where( 'sc_url_var', 'clear', 'cache' )->middleware( 'nonce:update_plugin_settings' )->handle( 'CacheSettings@clear' ); |
| 480 | return; |
| 481 | } |
| 482 | |
| 483 | // Settings. |
| 484 | \SureCart::route()->get()->where( 'sc_url_var', false, 'tab' )->name( 'settings.account' )->handle( 'AccountSettings@show' ); |
| 485 | \SureCart::route()->get()->where( 'sc_url_var', 'brand', 'tab' )->name( 'settings.brand' )->handle( 'BrandSettings@show' ); |
| 486 | \SureCart::route()->get()->where( 'sc_url_var', 'order', 'tab' )->name( 'settings.order' )->handle( 'OrderSettings@show' ); |
| 487 | \SureCart::route()->get()->where( 'sc_url_var', 'abandoned_checkout', 'tab' )->name( 'settings.abandoned_checkout' )->handle( 'AbandonedCheckoutSettings@show' ); |
| 488 | \SureCart::route()->get()->where( 'sc_url_var', 'subscription_preservation', 'tab' )->name( 'settings.subscription_preservation' )->handle( 'SubscriptionPreservationSettings@show' ); |
| 489 | \SureCart::route()->get()->where( 'sc_url_var', 'affiliation_protocol', 'tab' )->name( 'settings.affiliation_protocol' )->handle( 'AffiliationProtocolSettings@show' ); |
| 490 | \SureCart::route()->get()->where( 'sc_url_var', 'customer_notification_protocol', 'tab' )->name( 'settings.customer' )->handle( 'CustomerSettings@show' ); |
| 491 | \SureCart::route()->get()->where( 'sc_url_var', 'subscription_protocol', 'tab' )->name( 'settings.subscription' )->handle( 'SubscriptionSettings@show' ); |
| 492 | \SureCart::route()->get()->where( 'sc_url_var', 'tax_protocol', 'tab' )->where( 'sc_url_var', 'region', 'type' )->name( 'settings.tax.region' )->handle( 'TaxRegionSettings@show' ); |
| 493 | \SureCart::route()->get()->where( 'sc_url_var', 'tax_protocol', 'tab' )->name( 'settings.tax' )->handle( 'TaxSettings@show' ); |
| 494 | \SureCart::route()->get()->where( 'sc_url_var', 'upgrade', 'tab' )->name( 'settings.upgrade' )->handle( 'UpgradeSettings@show' ); |
| 495 | \SureCart::route()->get()->where( 'sc_url_var', 'shipping_protocol', 'tab' )->where( 'sc_url_var', 'shipping_profile', 'type' )->name( 'settings.shipping.profile' )->handle( 'ShippingProfileSettings@show' ); |
| 496 | \SureCart::route()->get()->where( 'sc_url_var', 'shipping_protocol', 'tab' )->name( 'settings.shipping' )->handle( 'ShippingSettings@show' ); |
| 497 | |
| 498 | // Connection. |
| 499 | \SureCart::route()->get()->where( 'sc_url_var', 'connection', 'tab' )->name( 'settings.connection' )->handle( 'ConnectionSettings@show' ); |
| 500 | |
| 501 | // Advanced. |
| 502 | \SureCart::route()->get()->where( 'sc_url_var', 'advanced', 'tab' )->name( 'settings.advanced' )->handle( 'AdvancedSettings@show' ); |
| 503 | \SureCart::route()->post()->where( 'sc_url_var', 'advanced', 'tab' )->middleware( 'nonce:update_plugin_settings' )->name( 'settings.advanced.save' )->handle( 'AdvancedSettings@save' ); |
| 504 | |
| 505 | // Processors. |
| 506 | \SureCart::route()->get()->where( 'sc_url_var', 'processors', 'tab' )->name( 'settings.processors' )->handle( 'ProcessorsSettings@show' ); |
| 507 | |
| 508 | // Export. |
| 509 | \SureCart::route()->get()->where( 'sc_url_var', 'export', 'tab' )->name( 'settings.export' )->handle( 'ExportSettings@show' ); |
| 510 | |
| 511 | // Cache. |
| 512 | \SureCart::route()->post()->where( 'sc_url_var', 'clear', 'cache' )->middleware( 'nonce:update_plugin_settings' )->handle( 'CacheSettings@clear' ); |
| 513 | } |
| 514 | ); |
| 515 | |
| 516 | /* |
| 517 | |-------------------------------------------------------------------------- |
| 518 | | Connection |
| 519 | |-------------------------------------------------------------------------- |
| 520 | */ |
| 521 | \SureCart::route() |
| 522 | ->get() |
| 523 | ->where( 'admin', 'sc-plugin' ) |
| 524 | ->middleware( 'user.can:manage_options' ) |
| 525 | ->middleware( 'assets.components' ) |
| 526 | ->group( |
| 527 | function () { |
| 528 | \SureCart::route()->get()->name( 'plugin.show' )->handle( 'PluginSettings@show' ); |
| 529 | \SureCart::route()->post()->middleware( 'nonce:update_plugin_settings' )->handle( 'PluginSettings@save' ); |
| 530 | } |
| 531 | ); |
| 532 | |
| 533 | /* |
| 534 | |-------------------------------------------------------------------------- |
| 535 | | Webhooks |
| 536 | |-------------------------------------------------------------------------- |
| 537 | */ |
| 538 | \SureCart::route() |
| 539 | ->get() |
| 540 | ->where( 'sc_url_var', 'create_webhook', 'action' ) |
| 541 | ->name( 'webhook.create' ) |
| 542 | ->middleware( 'nonce:create_webhook' ) |
| 543 | ->middleware( 'user.can:edit_sc_webhooks' ) |
| 544 | ->handle( '\\SureCart\\Controllers\\Web\\WebhookController@create' ); |
| 545 | \SureCart::route() |
| 546 | ->get() |
| 547 | ->where( 'sc_url_var', 'update_webhook', 'action' ) |
| 548 | ->name( 'webhook.update' ) |
| 549 | ->middleware( 'nonce:update_webhook' ) |
| 550 | ->middleware( 'user.can:edit_sc_webhooks' ) |
| 551 | ->handle( '\\SureCart\\Controllers\\Web\\WebhookController@update' ); |
| 552 | \SureCart::route() |
| 553 | ->get() |
| 554 | ->where( 'sc_url_var', 'resync_webhook', 'action' ) |
| 555 | ->name( 'webhook.resync' ) |
| 556 | ->middleware( 'nonce:resync_webhook' ) |
| 557 | ->middleware( 'user.can:edit_sc_webhooks' ) |
| 558 | ->handle( '\\SureCart\\Controllers\\Web\\WebhookController@resync' ); |
| 559 | |
| 560 | /* |
| 561 | |-------------------------------------------------------------------------- |
| 562 | | Restore |
| 563 | |-------------------------------------------------------------------------- |
| 564 | */ |
| 565 | \SureCart::route() |
| 566 | ->where( 'admin', 'sc-restore' ) |
| 567 | ->middleware( 'user.can:manage_options' ) |
| 568 | ->middleware( 'assets.components' ) |
| 569 | ->setNamespace( '\\SureCart\\Controllers\\Admin\\Restore\\' ) |
| 570 | ->group( |
| 571 | function () { |
| 572 | \SureCart::route()->get()->where( 'sc_url_var', false, 'action' )->handle( 'RestoreController@index' ); |
| 573 | \SureCart::route()->post()->middleware( 'nonce:restore_missing_page' )->handle( 'RestoreController@restore' ); |
| 574 | } |
| 575 | ); |
| 576 |