Skip to content

Commit

Permalink
Offline Payment modified.
Browse files Browse the repository at this point in the history
  • Loading branch information
cuneytsenturk committed Nov 16, 2017
1 parent a3dbdaf commit 5b9d9d1
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 0 deletions.
22 changes: 22 additions & 0 deletions app/Events/PaymentGatewayConfirm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace App\Events;

class PaymentGatewayConfirm
{
public $gateway;

public $invoice;

/**
* Create a new event instance.
*
* @param $gateway
* @param $invoice
*/
public function __construct($gateway, $invoice)
{
$this->gateway = $gateway;
$this->invoice = $invoice;
}
}
31 changes: 31 additions & 0 deletions app/Http/Requests/Customer/InvoicePayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

namespace App\Http\Requests\Customer;

use App\Http\Requests\Request;

class InvoicePayment extends Request
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'invoice_id' => 'required|integer',
'payment_method' => 'required|string',
];
}
}
28 changes: 28 additions & 0 deletions modules/OfflinePayment/Events/Handlers/OfflinePaymentConfirm.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

namespace Modules\OfflinePayment\Events\Handlers;

use App\Events\PaymentGatewayConfirm;

class OfflinePaymentConfirm
{
/**
* Handle the event.
*
* @param PaymentGatewayConfirm $event
* @return void
*/
public function handle(PaymentGatewayConfirm $event)
{
/*if (strpos($event->gateway, 'offlinepayment') === false) {
return false;
}
return [
'code' => $event->gateway,
'name' => $event->gateway,
'redirect' => false,
'html' => true,
];*/
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@
use App\Events\PaymentGatewayListing;
use Modules\OfflinePayment\Events\Handlers\OfflinePaymentGateway;

use App\Events\PaymentGatewayConfirm;
use Modules\OfflinePayment\Events\Handlers\OfflinePaymentConfirm;

class OfflinePaymentServiceProvider extends ServiceProvider
{
/**
Expand All @@ -36,6 +39,7 @@ public function boot()

$this->app['events']->listen(AdminMenuCreated::class, OfflinePaymentAdminMenu::class);
$this->app['events']->listen(PaymentGatewayListing::class, OfflinePaymentGateway::class);
$this->app['events']->listen(PaymentGatewayConfirm::class, OfflinePaymentConfirm::class);
}

/**
Expand Down

0 comments on commit 5b9d9d1

Please sign in to comment.