Fixed Offline Payment method for Customer

This commit is contained in:
Cüneyt Şentürk
2017-11-19 02:52:01 +03:00
parent 994998dc0b
commit 021b853127
14 changed files with 212 additions and 146 deletions

View File

@@ -1,45 +0,0 @@
<?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 [];
}
$invoice = $event->invoice;
$gateway = [];
$payment_methods = json_decode(setting('offlinepayment.methods'), true);
foreach ($payment_methods as $payment_method) {
if ($payment_method['code'] == $event->gateway) {
$gateway = $payment_method;
break;
}
}
$html = view('offlinepayment::confirm', compact('gateway', 'invoice'))->render();
return [
'code' => $gateway['code'],
'name' => $gateway['name'],
'description' => $gateway['description'],
'redirect' => false,
'html' => $html,
];
}
}