From b7feb1e71b419cf36760f180ecce4f9db4100f7c Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 16 Apr 2023 16:41:40 +1000 Subject: [PATCH 1/2] Additional translations --- app/Services/Invoice/AutoBillInvoice.php | 8 ++++++++ lang/en/texts.php | 2 ++ 2 files changed, 10 insertions(+) diff --git a/app/Services/Invoice/AutoBillInvoice.php b/app/Services/Invoice/AutoBillInvoice.php index 5d10f2e74fff..4e54c27ee3f9 100644 --- a/app/Services/Invoice/AutoBillInvoice.php +++ b/app/Services/Invoice/AutoBillInvoice.php @@ -12,6 +12,7 @@ namespace App\Services\Invoice; use App\DataMapper\InvoiceItem; +use App\Events\Invoice\InvoiceWasPaid; use App\Events\Payment\PaymentWasCreated; use App\Factory\PaymentFactory; use App\Libraries\MultiDB; @@ -225,6 +226,13 @@ class AutoBillInvoice extends AbstractService event('eloquent.created: App\Models\Payment', $payment); event(new PaymentWasCreated($payment, $payment->company, Ninja::eventVars())); + //if we have paid the invoice in full using credits, then we need to fire the event + if($this->invoice->balance == 0){ + + event(new InvoiceWasPaid($this->invoice, $payment, $payment->company, Ninja::eventVars())); + + } + return $this->invoice ->service() ->setCalculatedStatus() diff --git a/lang/en/texts.php b/lang/en/texts.php index 7904d66e5738..d20fd1dea3d3 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -5040,6 +5040,8 @@ $LANG = array( 'aged_receivable_summary_report' => 'Aged Receivable Summary Report', 'taxable_amount' => 'Taxable Amount', 'tax_summary' => 'Tax Summary', + 'oauth_mail' => 'OAuth / Mail', + 'preferences' => 'Preferences', ); From 3f622f20fdc1040d149943acd7ef0230ba725c0a Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 17 Apr 2023 08:20:12 +1000 Subject: [PATCH 2/2] Update transaltions --- app/Http/Controllers/PreviewController.php | 5 +---- app/PaymentDrivers/CheckoutComPaymentDriver.php | 7 ------- lang/en/texts.php | 1 + 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/app/Http/Controllers/PreviewController.php b/app/Http/Controllers/PreviewController.php index 7e2ca56994a6..830a8fc3156f 100644 --- a/app/Http/Controllers/PreviewController.php +++ b/app/Http/Controllers/PreviewController.php @@ -177,10 +177,7 @@ class PreviewController extends BaseController public function design(DesignPreviewRequest $request) { - // if (Ninja::isHosted() && !in_array($request->getHost(), ['preview.invoicing.co','staging.invoicing.co'])) { - // return response()->json(['message' => 'This server cannot handle this request.'], 400); - // } - + $pdf = (new PdfMock($request->all(), auth()->user()->company()))->build()->getPdf(); $response = Response::make($pdf, 200); diff --git a/app/PaymentDrivers/CheckoutComPaymentDriver.php b/app/PaymentDrivers/CheckoutComPaymentDriver.php index d9c2dab2d5c2..e54d76dd6881 100644 --- a/app/PaymentDrivers/CheckoutComPaymentDriver.php +++ b/app/PaymentDrivers/CheckoutComPaymentDriver.php @@ -302,13 +302,6 @@ class CheckoutComPaymentDriver extends BaseDriver throw new PaymentFailed($human_exception); } - - - // catch (\Exception $e) { - // // API error - // throw new PaymentFailed($e->getMessage(), $e->getCode()); - // } - return $response; } } diff --git a/lang/en/texts.php b/lang/en/texts.php index d20fd1dea3d3..24b9a668f5e2 100644 --- a/lang/en/texts.php +++ b/lang/en/texts.php @@ -5042,6 +5042,7 @@ $LANG = array( 'tax_summary' => 'Tax Summary', 'oauth_mail' => 'OAuth / Mail', 'preferences' => 'Preferences', + 'analytics' => 'Analytics', );