Merge pull request #6426 from turbo124/v5-develop

Fixes for removing payment methods
This commit is contained in:
David Bomba 2021-08-07 14:58:19 +10:00 committed by GitHub
commit 39363713b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -120,16 +120,23 @@ class PaymentMethodController extends Controller
{ {
// $gateway = $this->getClientGateway(); // $gateway = $this->getClientGateway();
try {
$payment_method->gateway $payment_method->gateway
->driver(auth()->user()->client) ->driver(auth()->user()->client)
->setPaymentMethod(request()->query('method')) ->setPaymentMethod(request()->query('method'))
->detach($payment_method); ->detach($payment_method);
try {
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars(auth('contact')->user()->id))); event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars(auth('contact')->user()->id)));
$payment_method->delete(); $payment_method->delete();
} catch (Exception $e) { } catch (Exception $e) {
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars(auth('contact')->user()->id)));
$payment_method->delete();
nlog($e->getMessage()); nlog($e->getMessage());
return back(); return back();