Merge pull request #6428 from turbo124/v5-develop
Minor fixes for deleting payment methods
This commit is contained in:
commit
37d3b7d64c
1 changed files with 9 additions and 10 deletions
|
|
@ -118,25 +118,24 @@ class PaymentMethodController extends Controller
|
|||
*/
|
||||
public function destroy(ClientGatewayToken $payment_method)
|
||||
{
|
||||
// $gateway = $this->getClientGateway();
|
||||
|
||||
if($payment_method->gateway()->exists()){
|
||||
|
||||
$payment_method->gateway
|
||||
->driver(auth()->user()->client)
|
||||
->setPaymentMethod(request()->query('method'))
|
||||
->detach($payment_method);
|
||||
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
$payment_method->gateway
|
||||
->driver(auth()->user()->client)
|
||||
->setPaymentMethod(request()->query('method'))
|
||||
->detach($payment_method);
|
||||
|
||||
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars(auth('contact')->user()->id)));
|
||||
|
||||
$payment_method->delete();
|
||||
|
||||
} catch (Exception $e) {
|
||||
|
||||
event(new MethodDeleted($payment_method, auth('contact')->user()->company, Ninja::eventVars(auth('contact')->user()->id)));
|
||||
|
||||
$payment_method->delete();
|
||||
|
||||
nlog($e->getMessage());
|
||||
|
||||
return back();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue