fixes for refundS

This commit is contained in:
David Bomba 2021-08-27 09:56:42 +10:00
parent ea38fb2b37
commit 97c58bcf70
2 changed files with 11 additions and 2 deletions

View File

@ -72,6 +72,9 @@ class CompanyController extends BaseController
parent::__construct(); parent::__construct();
$this->company_repo = $company_repo; $this->company_repo = $company_repo;
// $this->middleware('password_protected')->only(['destroy']);
} }
/** /**
@ -477,7 +480,7 @@ class CompanyController extends BaseController
*/ */
public function destroy(DestroyCompanyRequest $request, Company $company) public function destroy(DestroyCompanyRequest $request, Company $company)
{ {
if(Ninja::isHosted() && config('ninja.ninja_default_company_id') == $company->id) if(Ninja::isHosted() && config('ninja.ninja_default_company_id') == $company->id)
return response()->json(['message' => 'Cannot purge this company'], 400); return response()->json(['message' => 'Cannot purge this company'], 400);

View File

@ -81,8 +81,14 @@ class RefundPayment
if ($response['success'] == false) { if ($response['success'] == false) {
$this->payment->save(); $this->payment->save();
throw new PaymentRefundFailed($response['description']);
if(array_key_exists('description', $response))
throw new PaymentRefundFailed($response['description']);
else
throw new PaymentRefundFailed();
} }
} }
} else { } else {
$this->payment->refunded += $this->total_refund; $this->payment->refunded += $this->total_refund;