<?php

use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/', function () {
    return view('welcome');
});

Route::get('/pay', 'PayController@index')->name('pay.index');
Route::get('/account', 'PayController@account')->name('pay.account');
Route::get('/pay_fixed', 'PayController@fixed')->name('pay.fixed');
Route::post('/choose_pay', 'PayController@choosePay')->name('pay.choose_pay');
Route::post('/check_account', 'PayController@checkAccount')->name('pay.check_account');
Route::post('/check_fixed', 'PayController@checkFixed')->name('pay.check_fixed');
Route::any('/card_payment', 'PayController@cardPayment')->name('pay.card_payment');
Route::get('/paypal', 'PayController@paypal')->name('pay.paypal');
Route::post('/invoices_list', 'PayController@invoices')->name('pay.invoices');
Route::get('/download_invoice', 'PayController@downloadInvoice')->name('pay.invoices.download');
Route::get('/paypal-callback', 'PayController@paypalCallback')->name('pay.paypal.callback');

Auth::routes(['register' => false]);

Route::group(['middleware' => 'auth'], function (){
    Route::get('/home', 'HomeController@index')->name('home');

    Route::get('parse-xero-customers', 'ParseXeroCustomersController@parseCustomersFromXero')->name('parse-xero-customers');

    Route::get('xero-customers', 'XeroCustomersController@index')->name('xero-customers.index');

    Route::get('xero-customer/{id}', 'XeroCustomersController@show')->name('xero-customers.show');

    Route::get('xero-customers-edit/{id}', 'XeroCustomersController@edit')->name('xero-customers.edit');

    Route::post('xero-customers-edit/update/{id}', 'XeroCustomersController@update')->name('xero-customers.update');

    Route::post('xero-customers-edit/search', 'XeroCustomersController@search')->name('xero-customers.search');

    Route::get('billing-services', 'BillingServicesController@index')->name('billing-services.index');

    Route::get('unlinked-billing-services', 'BillingServicesController@unlinked')->name('billing-services.unlinked');

    Route::get('billing-service/{id}', 'BillingServicesController@show')->name('billing-services.show');

    Route::get('billing-services/{id}', 'BillingServicesController@edit')->name('billing-services.edit');

    Route::get('create-billing-service', 'BillingServicesController@create')->name('billing-services.create');

    Route::post('billing-services/store', 'BillingServicesController@store')->name('billing-services.store');

    Route::delete('billing-services/destroy/{id}', 'BillingServicesController@destroy')->name('billing-services.destroy');

    Route::post('billing-services/update/{id}', 'BillingServicesController@update')->name('billing-services.update');

    Route::post('billing-service/search', 'BillingServicesController@search')->name('billing-services.search');

    Route::get('test', 'BillingServicesController@test')->name('test');

    Route::get('miscellaneous-charges', 'MiscellaneousChargesController@index')->name('charges.index');

    Route::get('create-miscellaneous-charges', 'MiscellaneousChargesController@create')->name('charges.create');

    Route::post('miscellaneous-charges/search', 'MiscellaneousChargesController@search')->name('charges.search');

    Route::get('edit-miscellaneous-charges/{id}', 'MiscellaneousChargesController@edit')->name('charges.edit');

    Route::post('miscellaneous-charge/store', 'MiscellaneousChargesController@store')->name('charges.store');

    Route::get('miscellaneous-charge/{id}', 'MiscellaneousChargesController@show')->name('charges.show');

    Route::post('miscellaneous-charge/update/{id}', 'MiscellaneousChargesController@update')->name('charges.update');

    Route::delete('miscellaneous-charge/destroy/{id}', 'MiscellaneousChargesController@destroy')->name('charges.destroy');

    Route::get('domains', 'DomainsController@index')->name('domains.index');

    Route::get('unlinked-domains', 'DomainsController@unlinked')->name('domains.unlinked');

    Route::post('domains/search', 'DomainsController@search')->name('domains.search');

    Route::get('domain/{id}', 'DomainsController@show')->name('domains.show');

    Route::get('xero-customers-without-emails', 'XeroCustomersController@xeroCustomersWithoutEmail')->name('xer_customers_without_email');

    Route::get('domain-edit/{id}', 'DomainsController@edit')->name('domains.edit');

    Route::delete('domains/destroy/{id}', 'DomainsController@destroy')->name('domains.destroy');

    Route::post('domains/update/{id}', 'DomainsController@update')->name('domains.update');

    Route::get('edit-nominet-price', 'DomainsController@nominetPrice')->name('domains.edit_nominet_price');

    Route::get('import-possible-periods', 'DomainsController@importPossiblePeriods')->name('domains.import-possible-periods');

    Route::post('update-nominet-price', 'DomainsController@updateNominetPrice')->name('domains.update_nominet_price');

    Route::get('view-notify-email/{id}', 'DomainsController@viewNotifyEmail')->name('domains.view-notify-email');

    Route::get('/xero', 'XeroController@redirectUserToXero')->name('xero.login');
    Route::get('/xero-callback', 'XeroController@handleCallbackFromXero')->name('xero.redirect');
});

Route::get('billing-script', 'BillingScriptController@billing')->name('billing');

Route::get('thank-you', 'DomainsController@thankYou')->name('thank_you_page');

Route::get('/import-nominet', 'DomainsController@importNominet')->name('import.nominet');

Route::get('/import-opensrs', 'DomainsController@importOpensrs')->name('import.opensrs');

Route::get('notify-expiry', 'DomainsController@notifyExpiry')->name('notify');

Route::get('renew/{token}', 'DomainsController@renewPage')->name('domains.renew');

Route::post('domains/renew', 'DomainsController@renew')->name('domains.renew_request');

Route::post('/calculate-price', 'DomainsController@calculatePrice')->name('calculatePrice');

Route::post('payment-for-renewal', 'PaymentController@paymentForRenewal')->name('payment_for_renewal');

Route::post('renew-direct-debit', 'DomainsController@renewalDirectDebit')->name('renewal_direct_debit');





