From a6c9e0e8b3383b460a79632606cae08ec4fb61af Mon Sep 17 00:00:00 2001 From: David Bomba Date: Wed, 27 Oct 2021 15:40:14 +1100 Subject: [PATCH 1/5] Fix for double Update Entity Webhook call --- app/Listeners/Credit/CreditEmailedNotification.php | 2 +- app/Listeners/Invoice/InvoiceEmailedNotification.php | 2 +- app/Listeners/Quote/QuoteEmailedNotification.php | 2 +- app/PaymentDrivers/BaseDriver.php | 5 ++++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Listeners/Credit/CreditEmailedNotification.php b/app/Listeners/Credit/CreditEmailedNotification.php index c3a1ef17bf93..ad259f781ebe 100644 --- a/app/Listeners/Credit/CreditEmailedNotification.php +++ b/app/Listeners/Credit/CreditEmailedNotification.php @@ -42,7 +42,7 @@ class CreditEmailedNotification implements ShouldQueue $credit = $event->invitation->credit; $credit->last_sent_date = now(); - $credit->save(); + $credit->saveQuietly(); $nmo = new NinjaMailerObject; $nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'credit', $event->template))->build() ); diff --git a/app/Listeners/Invoice/InvoiceEmailedNotification.php b/app/Listeners/Invoice/InvoiceEmailedNotification.php index 59ac94e2c3ef..3918c630f1da 100644 --- a/app/Listeners/Invoice/InvoiceEmailedNotification.php +++ b/app/Listeners/Invoice/InvoiceEmailedNotification.php @@ -42,7 +42,7 @@ class InvoiceEmailedNotification implements ShouldQueue $invoice = $event->invitation->invoice; $invoice->last_sent_date = now(); - $invoice->save(); + $invoice->saveQuietly(); $nmo = new NinjaMailerObject; $nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'invoice', $event->template))->build() ); diff --git a/app/Listeners/Quote/QuoteEmailedNotification.php b/app/Listeners/Quote/QuoteEmailedNotification.php index c601dbfa18ef..68d1264c11b6 100644 --- a/app/Listeners/Quote/QuoteEmailedNotification.php +++ b/app/Listeners/Quote/QuoteEmailedNotification.php @@ -42,7 +42,7 @@ class QuoteEmailedNotification implements ShouldQueue $quote = $event->invitation->quote; $quote->last_sent_date = now(); - $quote->save(); + $quote->saveQuietly(); $nmo = new NinjaMailerObject; $nmo->mailable = new NinjaMailer( (new EntitySentObject($event->invitation, 'quote', $event->template))->build() ); diff --git a/app/PaymentDrivers/BaseDriver.php b/app/PaymentDrivers/BaseDriver.php index 397583bd6e43..9c6238c506c3 100644 --- a/app/PaymentDrivers/BaseDriver.php +++ b/app/PaymentDrivers/BaseDriver.php @@ -405,6 +405,10 @@ class BaseDriver extends AbstractPaymentDriver public function sendFailureMail(string $error) { + if (!is_null($this->payment_hash)) { + $this->unWindGatewayFees($this->payment_hash); + } + PaymentFailedMailer::dispatch( $this->payment_hash, $this->client->company, @@ -419,7 +423,6 @@ class BaseDriver extends AbstractPaymentDriver if ($this->payment_hash && is_array($this->payment_hash->invoices())) { - $nmo = new NinjaMailerObject; $nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($this->client, $error, $this->client->company, $this->payment_hash))->build()); $nmo->company = $this->client->company; From 9a973c76c71640a95aceadc0741fd779f85eccd4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 28 Oct 2021 04:58:24 +1100 Subject: [PATCH 2/5] Save quietly for payment model --- app/Services/Payment/UpdateInvoicePayment.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Services/Payment/UpdateInvoicePayment.php b/app/Services/Payment/UpdateInvoicePayment.php index 88aa81856818..a267d1f41b74 100644 --- a/app/Services/Payment/UpdateInvoicePayment.php +++ b/app/Services/Payment/UpdateInvoicePayment.php @@ -89,7 +89,7 @@ class UpdateInvoicePayment event(new InvoiceWasUpdated($invoice, $invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null))); }); - $this->payment->save(); + $this->payment->saveQuietly(); return $this->payment; } From 0a46c1aae1d9979f80fd335587c870ff104a1a65 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 28 Oct 2021 11:19:46 +1100 Subject: [PATCH 3/5] remove .env from base package --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 1a2953163f39..fd5bd28620d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,6 +49,7 @@ jobs: sudo rm -rf bootstrap/cache/* sudo rm -rf node_modules sudo rm -rf .git + sudo rm .env - name: Build project run: | From 00af1bb7b5f496605dd7f6eb20e830c913ab138b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 28 Oct 2021 11:20:30 +1100 Subject: [PATCH 4/5] Rollbank --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd5bd28620d1..1a2953163f39 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -49,7 +49,6 @@ jobs: sudo rm -rf bootstrap/cache/* sudo rm -rf node_modules sudo rm -rf .git - sudo rm .env - name: Build project run: | From 8ea4b668571f9ff1f3a1147168a71ec2d48556eb Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sat, 30 Oct 2021 08:30:48 +1100 Subject: [PATCH 5/5] Minor fixes --- app/Jobs/Util/VersionCheck.php | 2 +- app/PaymentDrivers/PayFastPaymentDriver.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/Jobs/Util/VersionCheck.php b/app/Jobs/Util/VersionCheck.php index 32dc7a2ac674..262d2cec82d4 100644 --- a/app/Jobs/Util/VersionCheck.php +++ b/app/Jobs/Util/VersionCheck.php @@ -37,7 +37,7 @@ class VersionCheck implements ShouldQueue { $version_file = trim(file_get_contents(config('ninja.version_url'))); - info("latest version = {$version_file}"); + nlog("latest version = {$version_file}"); if ($version_file) { Account::whereNotNull('id')->update(['latest_version' => $version_file]); diff --git a/app/PaymentDrivers/PayFastPaymentDriver.php b/app/PaymentDrivers/PayFastPaymentDriver.php index 591c6d347741..30a550e58dbe 100644 --- a/app/PaymentDrivers/PayFastPaymentDriver.php +++ b/app/PaymentDrivers/PayFastPaymentDriver.php @@ -79,7 +79,7 @@ class PayFastPaymentDriver extends BaseDriver } catch(\Exception $e) { - echo '##PAYFAST## There was an exception: '.$e->getMessage(); + nlog('##PAYFAST## There was an exception: '.$e->getMessage()); }