From 090d4c994aae0fccf5f312836410d813c69ca5f3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 16 Sep 2022 12:49:09 +1000 Subject: [PATCH 1/9] Fixes for send now functionality of recurring invoice --- .../RecurringInvoiceController.php | 2 +- app/Jobs/RecurringInvoice/SendRecurring.php | 6 +-- app/Services/Recurring/RecurringService.php | 8 +++- composer.lock | 40 ++++++++++--------- 4 files changed, 31 insertions(+), 25 deletions(-) diff --git a/app/Http/Controllers/RecurringInvoiceController.php b/app/Http/Controllers/RecurringInvoiceController.php index 6eb6d12d200d..00b56e385914 100644 --- a/app/Http/Controllers/RecurringInvoiceController.php +++ b/app/Http/Controllers/RecurringInvoiceController.php @@ -210,7 +210,7 @@ class RecurringInvoiceController extends BaseController event(new RecurringInvoiceWasCreated($recurring_invoice, $recurring_invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); - return $this->itemResponse($recurring_invoice); + return $this->itemResponse($recurring_invoice->fresh()); } /** diff --git a/app/Jobs/RecurringInvoice/SendRecurring.php b/app/Jobs/RecurringInvoice/SendRecurring.php index a1452f2f15ee..529ed3df5dd5 100644 --- a/app/Jobs/RecurringInvoice/SendRecurring.php +++ b/app/Jobs/RecurringInvoice/SendRecurring.php @@ -99,7 +99,7 @@ class SendRecurring implements ShouldQueue /* 09-01-2022 ensure we create the PDFs at this point in time! */ $invoice->service()->touchPdf(true); - nlog('updating recurring invoice dates'); + //nlog('updating recurring invoice dates'); /* Set next date here to prevent a recurring loop forming */ $this->recurring_invoice->next_send_date = $this->recurring_invoice->nextSendDate(); $this->recurring_invoice->next_send_date_client = $this->recurring_invoice->nextSendDateClient(); @@ -111,9 +111,9 @@ class SendRecurring implements ShouldQueue $this->recurring_invoice->setCompleted(); } - nlog('next send date = '.$this->recurring_invoice->next_send_date); + //nlog('next send date = '.$this->recurring_invoice->next_send_date); // nlog('remaining cycles = '.$this->recurring_invoice->remaining_cycles); - nlog('last send date = '.$this->recurring_invoice->last_sent_date); + //nlog('last send date = '.$this->recurring_invoice->last_sent_date); $this->recurring_invoice->save(); diff --git a/app/Services/Recurring/RecurringService.php b/app/Services/Recurring/RecurringService.php index a1d9193550b4..045eab8afd72 100644 --- a/app/Services/Recurring/RecurringService.php +++ b/app/Services/Recurring/RecurringService.php @@ -109,6 +109,8 @@ class RecurringService if ($request->has('send_now') && $request->input('send_now') == 'true' && $this->recurring_entity->invoices()->count() == 0) { $this->sendNow(); + + return $this; } if(isset($this->recurring_entity->client)) @@ -125,10 +127,12 @@ class RecurringService if($this->recurring_entity instanceof RecurringInvoice && $this->recurring_entity->status_id == RecurringInvoice::STATUS_DRAFT){ $this->start()->save(); - SendRecurring::dispatch($this->recurring_entity, $this->recurring_entity->company->db); + SendRecurring::dispatchSync($this->recurring_entity, $this->recurring_entity->company->db); } - return $this->recurring_entity; + $this->recurring_entity = $this->recurring_entity->fresh(); + + return $this; } diff --git a/composer.lock b/composer.lock index 2a1246227db9..d20997125d21 100644 --- a/composer.lock +++ b/composer.lock @@ -378,16 +378,16 @@ }, { "name": "aws/aws-sdk-php", - "version": "3.235.8", + "version": "3.235.9", "source": { "type": "git", "url": "https://github.com/aws/aws-sdk-php.git", - "reference": "cc33d53d735a3835adff212598f2a20ee9ac9531" + "reference": "103d38254ef7fc6659ecb08f4b18bc1299011f8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/cc33d53d735a3835adff212598f2a20ee9ac9531", - "reference": "cc33d53d735a3835adff212598f2a20ee9ac9531", + "url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/103d38254ef7fc6659ecb08f4b18bc1299011f8a", + "reference": "103d38254ef7fc6659ecb08f4b18bc1299011f8a", "shasum": "" }, "require": { @@ -466,9 +466,9 @@ "support": { "forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80", "issues": "https://github.com/aws/aws-sdk-php/issues", - "source": "https://github.com/aws/aws-sdk-php/tree/3.235.8" + "source": "https://github.com/aws/aws-sdk-php/tree/3.235.9" }, - "time": "2022-09-14T18:18:31+00:00" + "time": "2022-09-15T18:22:15+00:00" }, { "name": "bacon/bacon-qr-code", @@ -3483,16 +3483,16 @@ }, { "name": "laravel/framework", - "version": "v9.30.0", + "version": "v9.30.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "2ca2b168a3e995a8ec6ea2805906379095d20080" + "reference": "9533f7926f31939f25a620fbbf545318c18c943f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/2ca2b168a3e995a8ec6ea2805906379095d20080", - "reference": "2ca2b168a3e995a8ec6ea2805906379095d20080", + "url": "https://api.github.com/repos/laravel/framework/zipball/9533f7926f31939f25a620fbbf545318c18c943f", + "reference": "9533f7926f31939f25a620fbbf545318c18c943f", "shasum": "" }, "require": { @@ -3585,7 +3585,8 @@ "phpstan/phpstan": "^1.4.7", "phpunit/phpunit": "^9.5.8", "predis/predis": "^1.1.9|^2.0", - "symfony/cache": "^6.0" + "symfony/cache": "^6.0", + "symfony/uid": "^6.0" }, "suggest": { "ably/ably-php": "Required to use the Ably broadcast driver (^1.0).", @@ -3620,7 +3621,8 @@ "symfony/http-client": "Required to enable support for the Symfony API mail transports (^6.0).", "symfony/mailgun-mailer": "Required to enable support for the Mailgun mail transport (^6.0).", "symfony/postmark-mailer": "Required to enable support for the Postmark mail transport (^6.0).", - "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0)." + "symfony/psr-http-message-bridge": "Required to use PSR-7 bridging features (^2.0).", + "symfony/uid": "Required to generate ULIDs for Eloquent (^6.0)." }, "type": "library", "extra": { @@ -3664,7 +3666,7 @@ "issues": "https://github.com/laravel/framework/issues", "source": "https://github.com/laravel/framework" }, - "time": "2022-09-13T14:06:14+00:00" + "time": "2022-09-15T13:15:47+00:00" }, { "name": "laravel/serializable-closure", @@ -4891,16 +4893,16 @@ }, { "name": "microsoft/microsoft-graph", - "version": "1.74.0", + "version": "1.75.0", "source": { "type": "git", "url": "https://github.com/microsoftgraph/msgraph-sdk-php.git", - "reference": "a43deb66661917d92bf62de1f29f6799b30ea91c" + "reference": "e14d68d8e78f217ab0c303169c389c4ebf5d9e11" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/microsoftgraph/msgraph-sdk-php/zipball/a43deb66661917d92bf62de1f29f6799b30ea91c", - "reference": "a43deb66661917d92bf62de1f29f6799b30ea91c", + "url": "https://api.github.com/repos/microsoftgraph/msgraph-sdk-php/zipball/e14d68d8e78f217ab0c303169c389c4ebf5d9e11", + "reference": "e14d68d8e78f217ab0c303169c389c4ebf5d9e11", "shasum": "" }, "require": { @@ -4936,9 +4938,9 @@ "homepage": "https://developer.microsoft.com/en-us/graph", "support": { "issues": "https://github.com/microsoftgraph/msgraph-sdk-php/issues", - "source": "https://github.com/microsoftgraph/msgraph-sdk-php/tree/1.74.0" + "source": "https://github.com/microsoftgraph/msgraph-sdk-php/tree/1.75.0" }, - "time": "2022-08-31T12:12:48+00:00" + "time": "2022-09-15T14:43:49+00:00" }, { "name": "mollie/mollie-api-php", From 774a05b1483b1d059eb1207ebf2480b4a70f14f5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 16 Sep 2022 13:01:04 +1000 Subject: [PATCH 2/9] Single root element for wepay signups --- app/Jobs/Util/ReminderJob.php | 3 ++- .../portal/ninja2020/gateways/wepay/signup/index.blade.php | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Jobs/Util/ReminderJob.php b/app/Jobs/Util/ReminderJob.php index 78d233d357bd..6df012026b58 100644 --- a/app/Jobs/Util/ReminderJob.php +++ b/app/Jobs/Util/ReminderJob.php @@ -62,7 +62,8 @@ class ReminderJob implements ShouldQueue { nlog('Sending invoice reminders '.now()->format('Y-m-d h:i:s')); - Invoice::where('is_deleted', 0) + Invoice::query() + ->where('is_deleted', 0) ->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL]) ->whereNull('deleted_at') ->where('balance', '>', 0) diff --git a/resources/views/portal/ninja2020/gateways/wepay/signup/index.blade.php b/resources/views/portal/ninja2020/gateways/wepay/signup/index.blade.php index 9c30c242083c..bf0a08e2d9f6 100644 --- a/resources/views/portal/ninja2020/gateways/wepay/signup/index.blade.php +++ b/resources/views/portal/ninja2020/gateways/wepay/signup/index.blade.php @@ -1,6 +1,7 @@ @extends('portal.ninja2020.layout.clean', ['custom_body_class' => 'bg-gray-50']) @section('meta_title', ctrans('texts.sign_up_with_wepay')) +
@section('body')
We Pay @@ -8,6 +9,7 @@ @livewire('wepay-signup', ['user_id' => $user_id, 'company' => $company]) @endsection +
@push('footer') +