forked from anvargear/LaravelPayuLatam
-
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.
- Loading branch information
1 parent
9755387
commit 9d0984b
Showing
8 changed files
with
148 additions
and
61 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
migrations/2015_08_25_093443_PayUlatamConfirmationData.php
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,41 @@ | ||
<?php | ||
|
||
use Illuminate\Database\Schema\Blueprint; | ||
use Illuminate\Database\Migrations\Migration; | ||
|
||
class PayUlatamConfirmationData extends Migration | ||
{ | ||
/** | ||
* Run the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function up() | ||
{ | ||
Schema::create('payu_confirmations', function($table) | ||
{ | ||
$table->increments('id'); | ||
$table->integer('reference_sale')->unsigned(); | ||
$table->integer('state_pol'); | ||
$table->string('response_code_pol'); | ||
$table->string('reference_pol'); | ||
$table->string('sign'); | ||
$table->string('payment_method'); | ||
$table->decimal('value'); | ||
$table->decimal('tax'); | ||
$table->datetime('transaction_date'); | ||
$table->timestamps(); | ||
$table->softdeletes(); | ||
}); | ||
} | ||
|
||
/** | ||
* Reverse the migrations. | ||
* | ||
* @return void | ||
*/ | ||
public function down() | ||
{ | ||
Schema::dropIfExists('payu_confirmations'); | ||
} | ||
} |
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,23 @@ | ||
<?php | ||
|
||
namespace AnvarCO\PayuLatam\Confirmation; | ||
|
||
use Illuminate\Database\Eloquent\Model; | ||
|
||
class PayUConfirmation extends Model{ | ||
|
||
protected $table = "payu_confirmations"; | ||
|
||
protected $fillable = [ | ||
'reference_sale', | ||
'state_pol', | ||
'response_code_pol', | ||
'reference_pol', | ||
'sign', | ||
'payment_method', | ||
'value', | ||
'tax', | ||
'transaction_date' | ||
]; | ||
|
||
} |
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,28 @@ | ||
<?php | ||
|
||
namespace AnvarCO\PayuLatam\Events; | ||
|
||
use Illuminate\Http\Request; | ||
|
||
|
||
/** | ||
* Class ConfirmationArrived | ||
* @package AnvarCO\PayuLatam\Events | ||
*/ | ||
class ConfirmationArrived { | ||
|
||
/** | ||
* @var Request | ||
*/ | ||
public $confirmationRequest; | ||
|
||
/** | ||
* @param Request $confirmationRequest | ||
*/ | ||
function __construct(Request $confirmationRequest) | ||
{ | ||
$this->confirmationRequest = $confirmationRequest; | ||
} | ||
|
||
|
||
} |
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,27 @@ | ||
<?php | ||
|
||
namespace AnvarCO\PayuLatam\Events; | ||
|
||
|
||
use AnvarCO\PayuLatam\Confirmation\PayUConfirmation; | ||
|
||
/** | ||
* Class ConfirmationSaved | ||
* @package AnvarCO\PayuLatam\Events | ||
*/ | ||
class ConfirmationSaved { | ||
|
||
/** | ||
* @var | ||
*/ | ||
public $confirmation; | ||
|
||
/** | ||
* @param PayUConfirmation $model | ||
*/ | ||
public function __construct(PayUConfirmation $model) | ||
{ | ||
$this->confirmation = $model; | ||
} | ||
|
||
} |
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 |
---|---|---|
@@ -1,19 +1,34 @@ | ||
<?php namespace AnvarCO\Payulatam\Http\Controllers; | ||
|
||
use AnvarCO\PayuLatam\Confirmation\PayUConfirmation; | ||
use AnvarCO\PayuLatam\Events\ConfirmationArrived; | ||
use AnvarCO\PayuLatam\Events\ConfirmationSaved; | ||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Facades\Config; | ||
|
||
|
||
/** | ||
* Class PayuLatamController | ||
* @package AnvarCO\Payulatam\Http\Controllers | ||
*/ | ||
class PayuLatamController extends Controller | ||
{ | ||
/** | ||
* Show the application welcome screen to the user. | ||
* | ||
* @return Response | ||
*/ | ||
public function index() | ||
{ | ||
//dd(Config::get("payulatam.message")); | ||
return view('payulatam::payulatam'); | ||
} | ||
|
||
public function response() | ||
{ | ||
return view('payulatam::response'); | ||
} | ||
|
||
/** | ||
* @param Request $request | ||
* @return \Illuminate\Http\JsonResponse | ||
*/ | ||
public function confirmation(Request $request) | ||
{ | ||
event(new ConfirmationArrived($request)); | ||
$confirmation = PayUConfirmation::create($request->all()); | ||
event(new ConfirmationSaved($confirmation)); | ||
return response()->json(['ok' => true]); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<?php | ||
|
||
Route::get('payulatam', 'PayuLatamController@index'); | ||
// Confirmation | ||
Route::post('payu/confirmation', 'PayuLatamController@confirmation'); | ||
Route::get('payu/response', 'PayuLatamController@response'); |
This file was deleted.
Oops, something went wrong.
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 @@ | ||
<h1>Thanks!</h1> |