forked from Vugario/External-Services
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First version of the External Service demo.
- Loading branch information
Menno
committed
May 25, 2015
0 parents
commit 44f9dfb
Showing
103 changed files
with
6,604 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
APP_ENV=local | ||
APP_DEBUG=true | ||
APP_KEY=SomeRandomString | ||
|
||
DB_HOST=localhost | ||
DB_DATABASE=homestead | ||
DB_USERNAME=homestead | ||
DB_PASSWORD=secret | ||
|
||
CACHE_DRIVER=file | ||
SESSION_DRIVER=file | ||
QUEUE_DRIVER=sync | ||
|
||
MAIL_DRIVER=smtp | ||
MAIL_HOST=mailtrap.io | ||
MAIL_PORT=2525 | ||
MAIL_USERNAME=null | ||
MAIL_PASSWORD=null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
* text=auto | ||
*.css linguist-vendored | ||
*.less linguist-vendored |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
/vendor | ||
/node_modules | ||
.env | ||
.idea |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php namespace App\Commands; | ||
|
||
abstract class Command { | ||
|
||
// | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php namespace App\Console\Commands; | ||
|
||
use Illuminate\Console\Command; | ||
use Illuminate\Foundation\Inspiring; | ||
|
||
class Inspire extends Command { | ||
|
||
/** | ||
* The console command name. | ||
* | ||
* @var string | ||
*/ | ||
protected $name = 'inspire'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Display an inspiring quote'; | ||
|
||
/** | ||
* Execute the console command. | ||
* | ||
* @return mixed | ||
*/ | ||
public function handle() | ||
{ | ||
$this->comment(PHP_EOL.Inspiring::quote().PHP_EOL); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php namespace App\Console; | ||
|
||
use Illuminate\Console\Scheduling\Schedule; | ||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel; | ||
|
||
class Kernel extends ConsoleKernel { | ||
|
||
/** | ||
* The Artisan commands provided by your application. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
'App\Console\Commands\Inspire', | ||
]; | ||
|
||
/** | ||
* Define the application's command schedule. | ||
* | ||
* @param \Illuminate\Console\Scheduling\Schedule $schedule | ||
* @return void | ||
*/ | ||
protected function schedule(Schedule $schedule) | ||
{ | ||
$schedule->command('inspire') | ||
->hourly(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<?php namespace App\Events; | ||
|
||
abstract class Event { | ||
|
||
// | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php namespace App\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler; | ||
|
||
class Handler extends ExceptionHandler { | ||
|
||
/** | ||
* A list of the exception types that should not be reported. | ||
* | ||
* @var array | ||
*/ | ||
protected $dontReport = [ | ||
'Symfony\Component\HttpKernel\Exception\HttpException' | ||
]; | ||
|
||
/** | ||
* Report or log an exception. | ||
* | ||
* This is a great spot to send exceptions to Sentry, Bugsnag, etc. | ||
* | ||
* @param \Exception $e | ||
* @return void | ||
*/ | ||
public function report(Exception $e) | ||
{ | ||
return parent::report($e); | ||
} | ||
|
||
/** | ||
* Render an exception into an HTTP response. | ||
* | ||
* @param \Illuminate\Http\Request $request | ||
* @param \Exception $e | ||
* @return \Illuminate\Http\Response | ||
*/ | ||
public function render($request, Exception $e) | ||
{ | ||
return parent::render($request, $e); | ||
} | ||
|
||
} |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php namespace App\Helpers; | ||
|
||
class Code | ||
{ | ||
/** | ||
* Fetch a payload example | ||
* | ||
* @param $file | ||
* @return string | ||
*/ | ||
public static function payload($file) | ||
{ | ||
if (preg_match('/^([a-zA-Z0-9\_]+)$/', $file)) | ||
{ | ||
return file_get_contents(base_path().'/resources/json/'.$file.'_payload.json'); | ||
} | ||
|
||
return 'Incorrect filename'; | ||
} | ||
|
||
/** | ||
* Fetch a response example | ||
* | ||
* @param $file | ||
* @return string | ||
*/ | ||
public static function response($file) | ||
{ | ||
if (preg_match('/^([a-zA-Z0-9\_]+)$/', $file)) | ||
{ | ||
return file_get_contents(base_path().'/resources/json/'.$file.'_response.json'); | ||
} | ||
|
||
return 'Incorrect filename'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<?php namespace App\Http\Controllers; | ||
|
||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
class AppController extends Controller { | ||
|
||
/** | ||
* The homepage of the application to explain its purpose | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function home() | ||
{ | ||
return view('app/home'); | ||
} | ||
|
||
/** | ||
* This url is called when a SEOshop customer installs this application | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function install() | ||
{ | ||
return view('app/install'); | ||
} | ||
|
||
/** | ||
* This url is called when a SEOshop customer uninstalls the application | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function uninstall() | ||
{ | ||
return view('app/uninstall'); | ||
} | ||
|
||
/** | ||
* This url is called when a SEOshop customer cancels the application, this does not yet uninstall the app | ||
* Uninstalling will only happen at the end of the billing cycle (once a month) | ||
* | ||
* @return \Illuminate\View\View | ||
*/ | ||
public function cancel() | ||
{ | ||
return view('app/cancel'); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php namespace App\Http\Controllers; | ||
|
||
use Illuminate\Foundation\Bus\DispatchesCommands; | ||
use Illuminate\Routing\Controller as BaseController; | ||
use Illuminate\Foundation\Validation\ValidatesRequests; | ||
|
||
abstract class Controller extends BaseController { | ||
|
||
use DispatchesCommands, ValidatesRequests; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php namespace App\Http\Controllers; | ||
|
||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
|
||
use App\Payment; | ||
use App\Transaction; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Input; | ||
|
||
class PaymentsController extends Controller { | ||
|
||
public function index() | ||
{ | ||
return response()->json(['payment_methods' => Payment::all()]); | ||
} | ||
|
||
public function create(Request $request) | ||
{ | ||
$order = $request->input('order'); | ||
|
||
$transaction = Transaction::create([ | ||
'status' => 'unpaid', | ||
'order_id' => array_get($order, 'id'), | ||
'price_incl' => array_get($order, 'price_incl'), | ||
'price_excl' => array_get($order, 'price_excl'), | ||
'redirect_url' => Input::get('redirect_url') | ||
]); | ||
|
||
return response()->json(['payment_url' => url('pay/'.$transaction->id)]); | ||
} | ||
|
||
public function show($id) | ||
{ | ||
if ($transaction = Transaction::find($id)) | ||
{ | ||
return view('payments.show', ['transaction' => $transaction]); | ||
} | ||
|
||
return redirect('/'); | ||
} | ||
|
||
public function one($id) | ||
{ | ||
if ($transaction = Transaction::where(['order_id' => $id])->orderBy('updated_at', 'desc')->first()) | ||
{ | ||
return response()->json(['status' => $transaction->status]); | ||
} | ||
|
||
return false; | ||
} | ||
|
||
public function update($id, $status) | ||
{ | ||
if ($transaction = Transaction::find($id)) | ||
{ | ||
$transaction->status = $status; | ||
$transaction->save(); | ||
} | ||
|
||
// Redirect back to the checkout | ||
return redirect($transaction->redirect_url); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php namespace App\Http\Controllers; | ||
|
||
use App\Http\Requests; | ||
use App\Http\Controllers\Controller; | ||
|
||
use App\Shipment; | ||
use Illuminate\Http\Request; | ||
|
||
class ShipmentsController extends Controller { | ||
|
||
public function index() | ||
{ | ||
return response()->json(['shipment_methods' => Shipment::all()]); | ||
} | ||
|
||
public function create() | ||
{ | ||
return response()->json(['redirect_url' => 'http://google.nl/']); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
<?php namespace App\Http; | ||
|
||
use Illuminate\Foundation\Http\Kernel as HttpKernel; | ||
|
||
class Kernel extends HttpKernel { | ||
|
||
/** | ||
* The application's global HTTP middleware stack. | ||
* | ||
* @var array | ||
*/ | ||
protected $middleware = [ | ||
'Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode', | ||
'Illuminate\Cookie\Middleware\EncryptCookies', | ||
'Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse', | ||
'Illuminate\Session\Middleware\StartSession', | ||
'Illuminate\View\Middleware\ShareErrorsFromSession', | ||
// 'App\Http\Middleware\VerifyCsrfToken', | ||
]; | ||
|
||
/** | ||
* The application's route middleware. | ||
* | ||
* @var array | ||
*/ | ||
protected $routeMiddleware = [ | ||
'auth' => 'App\Http\Middleware\Authenticate', | ||
'auth.basic' => 'Illuminate\Auth\Middleware\AuthenticateWithBasicAuth', | ||
'guest' => 'App\Http\Middleware\RedirectIfAuthenticated', | ||
]; | ||
|
||
} |
Oops, something went wrong.