bebeboutik-api/routes/web.php
2017-11-30 10:14:12 +01:00

165 lines
6.9 KiB
PHP

<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$app->middleware([
Barryvdh\Cors\HandleCors::class,
]);
/** SWGGER DOCUMENTATION */
$app->get('/documentation', 'GeneratorController@index');
$app->post('/signup', 'AuthController@signup');
$app->post('/signout', 'AuthController@signout');
$app->post('/recover', 'AuthController@recover');
/*
|--------------------------------------------------------------------------
| SALE ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/sales', 'SaleController@lists');
$app->get('/tags', 'TagController@lists');
$app->get('/product/{id_product}', 'ProductController@get');
$app->get('/category/{id_category}', 'CategoryController@get');
$app->get('/category/{id_category}/products', 'CategoryController@list_products');
/*
|--------------------------------------------------------------------------
| CMS
|--------------------------------------------------------------------------
*/
$app->get('/cms', 'CmsController@lists');
$app->get('/cms/{id_cms}', 'CmsController@get');
$app->get('/countries', 'CountryController@lists');
$app->group(['middleware' => 'auth'], function() use ($app) {
$app->group(['middleware' => 'version'], function() use ($app) {
/*
|--------------------------------------------------------------------------
| AUTH ROUTES
|--------------------------------------------------------------------------
*/
$app->post('/signin', 'AuthController@signin');
/*
|--------------------------------------------------------------------------
| CATEGORY ROUTES
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| PRODUCT ROUTES
|--------------------------------------------------------------------------
*/
/*
|--------------------------------------------------------------------------
| CART ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/cart', 'CartController@get');
$app->get('/cart/validate', 'CartController@validateCart');
/* CART CARRIERS */
$app->get('/cart/carriers', 'CartController@getCarriers');
$app->put('/cart/carrier', 'CartController@setCarrier');
$app->post('/cart/carrier/socol', 'CartController@setSocolInfos');
/* CART PRODUCTS */
$app->put('/cart/product', 'CartController@addProduct');
$app->delete('/cart/product', 'CartController@removeProduct');
/* CART DISCOUNTS */
$app->put('/cart/discount', 'CartController@addDiscount');
$app->get('/cart/discounts', 'CartController@getAvailableDiscounts');
$app->delete('/cart/discount', 'CartController@removeDiscount');
/* CART ADDRESS */
$app->put('/cart/address', 'CartController@setAddress');
/*
|--------------------------------------------------------------------------
| PAYMENT ROUTES
|--------------------------------------------------------------------------
*/
$app->post('/payment/cheque', 'Payments\\ChequeController@execPayment');
$app->get('/payment/paybox', 'Payments\\PayboxController@get');
$app->get('/payment/paybox/numquestion', 'Payments\\PayboxController@getQuestion');
$app->post('/payment/paybox/{type:normal|card}', 'Payments\\PayboxController@validateOrder');
$app->get('/payment/paypal', 'Payments\\PaypalController@getUrl');
$app->post('/payment/paypal', 'Payments\\PaypalController@execPayement');
// $app->post('/payment/paybox/{type:normal|save_card}', 'Payments\\PayboxController@execPayment');
// $app->post('/payment/paybox/card', 'Payments\\PayboxController@execPaymentWithSavedCard');
/*
|--------------------------------------------------------------------------
| CONTACT ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/contacts', 'ContactController@lists');
$app->post('/contact', 'ContactController@create');
/*
|--------------------------------------------------------------------------
| SPONSOR
|--------------------------------------------------------------------------
*/
$app->get('/sponsors', 'SponsorController@lists');
$app->post('/sponsors', 'SponsorController@invite');
$app->post('/sponsor/{id_invite}/revive', 'SponsorController@revive');
/*
|--------------------------------------------------------------------------
| RELAYS
|--------------------------------------------------------------------------
*/
$app->get('/relays/socolissimo/{type:office|pickup}', 'Relays\\SocolissimoController@lists');
$app->put('/relays/socolissimo/{type:office|pickup}/address', 'Relays\\SocolissimoController@setAddressRelay');
$app->get('/relays/mondialrelay', 'Relays\\MondialRelayController@lists');
$app->put('/relays/mondialrelay/address', 'Relays\\MondialRelayController@setAddressRelay');
/*
|--------------------------------------------------------------------------
| USER ROUTES
|--------------------------------------------------------------------------
*/
$app->get('/user', 'UserController@get');
$app->put('/user', 'UserController@update');
$app->put('/user/newsletter', 'UserController@updateNewsletter');
$app->get('/user/discounts', 'DiscountController@lists');
$app->get('/user/discount/{id_discount}', 'DiscountController@get');
$app->get('/user/orders', 'OrderController@lists');
$app->get('/user/refunds', 'OrderController@list_refunds');
$app->get('/user/order/{id_order}', 'OrderController@get');
$app->get('/user/addresses', 'AddressController@lists');
$app->get('/user/address/{id_address}', 'AddressController@get');
$app->put('/user/address/{id_address}', 'AddressController@update');
$app->post('/user/address', 'AddressController@create');
$app->delete('/user/address/{id_address}', 'AddressController@delete');
$app->get('/user/accounts', 'AccountPaymentController@list_accounts');
$app->delete('/user/account/paypal/{id_paypal}', 'AccountPaymentController@delete_paypal');
$app->delete('/user/account/paybox/{id_paybox_card}', 'AccountPaymentController@delete_paybox');
});
});