diff --git a/app/Models/Invoice.php b/app/Models/Invoice.php index 7d2257c6b19a..93ada7f481c5 100644 --- a/app/Models/Invoice.php +++ b/app/Models/Invoice.php @@ -409,7 +409,19 @@ class Invoice extends BaseModel $file_path = $this->client->invoice_filepath($invitation).$this->numberFormatter().'.pdf'; - if(Ninja::isHosted() && $portal && Storage::disk(config('filesystems.default'))->exists($file_path)){ + $file_exists = false; + + /* Flysystem throws an exception if the path is "corrupted" so lets wrap it in a try catch and return a bool 06/01/2022*/ + try{ + $file_exists = Storage::disk(config('filesystems.default'))->exists($file_path); + } + catch(\Exception $e){ + + nlog($e->getMessage()); + + } + + if(Ninja::isHosted() && $portal && $file_exists){ return Storage::disk(config('filesystems.default'))->{$type}($file_path); } elseif(Ninja::isHosted()){ @@ -417,7 +429,16 @@ class Invoice extends BaseModel return Storage::disk(config('filesystems.default'))->{$type}($file_path); } - if(Storage::disk('public')->exists($file_path)) + try{ + $file_exists = Storage::disk('public')->exists($file_path); + } + catch(\Exception $e){ + + nlog($e->getMessage()); + + } + + if($file_exists) return Storage::disk('public')->{$type}($file_path); $file_path = CreateEntityPdf::dispatchNow($invitation); diff --git a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php index e2cb1e6613d1..ba359b259443 100644 --- a/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php +++ b/app/PaymentDrivers/Authorize/AuthorizePaymentMethod.php @@ -157,7 +157,8 @@ class AuthorizePaymentMethod $paymentOne->setOpaqueData($op); $contact = $this->authorize->client->primary_contact()->first(); - + $billto = false; + if ($contact) { // Create the Bill To info for new payment type $billto = new CustomerAddressType();