From 4af8557a9ee5fab105ebaa809dd0e3463a9333c3 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Sat, 21 Dec 2019 13:05:33 +0300 Subject: [PATCH 1/2] fixed omnipay --- app/Abstracts/Http/PaymentController.php | 4 +- app/Traits/Omnipay.php | 47 +++++++++++++++---- .../payment_method/redirect/show.blade.php | 46 +++++++++--------- .../payment_method/redirect/signed.blade.php | 3 +- 4 files changed, 67 insertions(+), 33 deletions(-) diff --git a/app/Abstracts/Http/PaymentController.php b/app/Abstracts/Http/PaymentController.php index a523364e1..5a6a8ad43 100644 --- a/app/Abstracts/Http/PaymentController.php +++ b/app/Abstracts/Http/PaymentController.php @@ -2,9 +2,9 @@ namespace App\Abstracts\Http; +use App\Events\Income\PaymentReceived; use App\Http\Requests\Portal\InvoicePayment as PaymentRequest; use App\Models\Income\Invoice; -use Illuminate\Http\Request; use Illuminate\Routing\Controller as BaseController; use Illuminate\Support\Facades\URL; use Monolog\Logger; @@ -169,7 +169,7 @@ abstract class PaymentController extends BaseController $request['payment_method'] = $this->alias; $request['reference'] = $this->getReference($invoice); - event(new \App\Events\Income\PaymentReceived($invoice, $request)); + event(new PaymentReceived($invoice, $request)); } public function setReference($invoice, $reference) diff --git a/app/Traits/Omnipay.php b/app/Traits/Omnipay.php index 0a804b85c..3b28d2e2f 100644 --- a/app/Traits/Omnipay.php +++ b/app/Traits/Omnipay.php @@ -2,18 +2,11 @@ namespace App\Traits; -use Omnipay\Omnipay as Library; - trait Omnipay { - use Library; - public $gateway; - public function create($name) - { - $this->gateway = Library::create($name); - } + public $factory; public function authorize($invoice, $request, $extra_options = []) { @@ -156,4 +149,42 @@ trait Omnipay 'data' => false, ]); } + + public function all() + { + return $this->callFactory('all'); + } + + public function replace($gateways) + { + return $this->callFactory('replace', [$gateways]); + } + + public function register($class_name) + { + return $this->callFactory('register', [$class_name]); + } + + public function create($class, $http_client = null, $http_request = null) + { + $this->gateway = $this->callFactory('create', [$class, $http_client, $http_request]); + + return $this->gateway; + } + + public function callFactory($method, $parameters = []) + { + $factory = $this->getFactory(); + + return call_user_func_array(array($factory, $method), (array) $parameters); + } + + public function getFactory() + { + if (is_null($this->factory)) { + $this->factory = new \Omnipay\Common\GatewayFactory(); + } + + return $this->factory; + } } diff --git a/resources/views/partials/portal/payment_method/redirect/show.blade.php b/resources/views/partials/portal/payment_method/redirect/show.blade.php index eab710a0b..d61f93ceb 100644 --- a/resources/views/partials/portal/payment_method/redirect/show.blade.php +++ b/resources/views/partials/portal/payment_method/redirect/show.blade.php @@ -1,26 +1,28 @@ -
- @if (!empty($setting['name'])) -

{{ $setting['name'] }}

- @endif +
+
+ @if (!empty($setting['name'])) +

{{ $setting['name'] }}

+ @endif - @if (!empty($setting['description'])) -
{{ $setting['description'] }}
- @endif -
-
+ @if (!empty($setting['description'])) +
{{ $setting['description'] }}
+ @endif +
+
-
-
- {!! Form::open([ - 'url' => $confirm_url, - 'id' => 'redirect-form', - 'role' => 'form', - 'autocomplete' => "off", - 'novalidate' => 'true' - ]) !!} - - {!! Form::close() !!} +
+
+ {!! Form::open([ + 'url' => $confirm_url, + 'id' => 'redirect-form', + 'role' => 'form', + 'autocomplete' => "off", + 'novalidate' => 'true' + ]) !!} + + {!! Form::close() !!} +
diff --git a/resources/views/partials/portal/payment_method/redirect/signed.blade.php b/resources/views/partials/portal/payment_method/redirect/signed.blade.php index fbafc5e99..d61f93ceb 100644 --- a/resources/views/partials/portal/payment_method/redirect/signed.blade.php +++ b/resources/views/partials/portal/payment_method/redirect/signed.blade.php @@ -1,3 +1,4 @@ +
@if (!empty($setting['name']))

{{ $setting['name'] }}

@@ -24,4 +25,4 @@ {!! Form::close() !!}
- +
From 925ffdf7da202863b62eb46b123ef3127cfd2b88 Mon Sep 17 00:00:00 2001 From: denisdulici Date: Sat, 21 Dec 2019 15:57:13 +0300 Subject: [PATCH 2/2] readme badges --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index faefefa37..e96a2823e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,10 @@ # Akaunting™ - ![Latest Stable Version](https://img.shields.io/github/release/akaunting/akaunting.svg) ![Total Downloads](https://img.shields.io/github/downloads/akaunting/akaunting/total.svg) [![Translation Status](https://d322cqt584bo4o.cloudfront.net/akaunting/localized.svg)](https://crowdin.com/project/akaunting) ![Tests Status](https://img.shields.io/github/workflow/status/akaunting/akaunting/Tests?label=tests) +[![Release](https://img.shields.io/github/v/release/akaunting/akaunting?label=release)](https://github.com/akaunting/akaunting/releases) +![Downloads](https://img.shields.io/github/downloads/akaunting/akaunting/total?label=downloads) +[![Translations](https://badges.crowdin.net/akaunting/localized.svg)](https://crowdin.com/project/akaunting) +[![Tests](https://img.shields.io/github/workflow/status/akaunting/akaunting/Tests?label=tests)](https://github.com/akaunting/akaunting/actions) +[![License](https://img.shields.io/github/license/akaunting/akaunting?label=license)](LICENSE.txt) Akaunting is a free, open source and online accounting software designed for small businesses and freelancers. It is built with modern technologies such as Laravel, VueJS, Bootstrap 4, RESTful API etc. Thanks to its modular structure, Akaunting provides an awesome App Store for users and developers.