From b0510ad680bd7e0554a6b14c9d60ed08eb788889 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Thu, 9 Sep 2021 20:59:58 +1000 Subject: [PATCH 1/6] Fixes for support message --- app/Mail/SupportMessageSent.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/Mail/SupportMessageSent.php b/app/Mail/SupportMessageSent.php index e882513890..7ea23586ef 100644 --- a/app/Mail/SupportMessageSent.php +++ b/app/Mail/SupportMessageSent.php @@ -62,9 +62,10 @@ class SupportMessageSent extends Mailable $company = auth()->user()->company(); $user = auth()->user(); $db = str_replace("db-ninja-", "", $company->db); - + $is_large = $company->is_large ? "L" : ""; + if(Ninja::isHosted()) - $subject = "{$priority}Hosted-{$db}-[{$company->is_large}] :: {$plan} :: ".date('M jS, g:ia'); + $subject = "{$priority}Hosted-{$db}{$is_large} :: {$plan} :: ".date('M jS, g:ia'); else $subject = "{$priority}Self Hosted :: {$plan} :: ".date('M jS, g:ia'); From b3b579370302ee35fdef6946dc2594a93675beb6 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 9 Sep 2021 21:18:04 +1000 Subject: [PATCH 2/6] Fixes for MultiDB payment gateways --- .../Requests/Gateways/Checkout3ds/Checkout3dsRequest.php | 2 ++ app/Jobs/Util/Import.php | 7 +++++-- app/Repositories/ClientContactRepository.php | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php b/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php index 0213795420..c0d5e16c54 100644 --- a/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php +++ b/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php @@ -2,6 +2,7 @@ namespace App\Http\Requests\Gateways\Checkout3ds; +use App\Libraries\MultiDB; use App\Models\Client; use App\Models\Company; use App\Models\CompanyGateway; @@ -37,6 +38,7 @@ class Checkout3dsRequest extends FormRequest public function getCompany() { + MultiDB::findAndSetDbByCompanyKey($this->company_key); return Company::where('company_key', $this->company_key)->first(); } diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index d2ebc5dc94..66b38f2216 100644 --- a/app/Jobs/Util/Import.php +++ b/app/Jobs/Util/Import.php @@ -640,7 +640,8 @@ class Import implements ShouldQueue $client->updated_at = Carbon::parse($modified['updated_at']); $client->save(['timestamps' => false]); - + $client->fresh(); + $client->contacts()->forceDelete(); if (array_key_exists('contacts', $resource)) { // need to remove after importing new migration.json @@ -650,7 +651,7 @@ class Import implements ShouldQueue $modified_contacts[$key]['company_id'] = $this->company->id; $modified_contacts[$key]['user_id'] = $this->processUserId($resource); $modified_contacts[$key]['client_id'] = $client->id; - $modified_contacts[$key]['password'] = 'mysuperpassword'; // @todo, and clean up the code.. + $modified_contacts[$key]['password'] = Str::random(8); unset($modified_contacts[$key]['id']); } @@ -685,6 +686,8 @@ class Import implements ShouldQueue 'old' => $resource['id'], 'new' => $client->id, ]; + + $client = null; } Client::reguard(); diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php index f2dc62691e..2dd7d7a63b 100644 --- a/app/Repositories/ClientContactRepository.php +++ b/app/Repositories/ClientContactRepository.php @@ -88,5 +88,7 @@ class ClientContactRepository extends BaseRepository $new_contact->email = ' '; $new_contact->save(); } + + $client = null; } } From 03ec5e042d156fc71923af09e75a12d9d59836b2 Mon Sep 17 00:00:00 2001 From: = Date: Thu, 9 Sep 2021 21:46:03 +1000 Subject: [PATCH 3/6] Stripe Connect Compatible refunds --- app/PaymentDrivers/StripePaymentDriver.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/app/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index 7deb0b433d..891bb9697a 100644 --- a/app/PaymentDrivers/StripePaymentDriver.php +++ b/app/PaymentDrivers/StripePaymentDriver.php @@ -362,9 +362,14 @@ class StripePaymentDriver extends BaseDriver $response = null; try { - $response = $this->stripe - ->refunds - ->create(['charge' => $payment->transaction_reference, 'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision, $this->client->currency())], $meta); + // $response = $this->stripe + // ->refunds + // ->create(['charge' => $payment->transaction_reference, 'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision, $this->client->currency())], $meta); + + $response = \Stripe\Refund::create([ + 'charge' => $payment->transaction_reference, + 'amount' => $this->convertToStripeAmount($amount, $this->client->currency()->precision, $this->client->currency()) + ], $meta); if ($response->status == $response::STATUS_SUCCEEDED) { SystemLogger::dispatch(['server_response' => $response, 'data' => request()->all(),], SystemLog::CATEGORY_GATEWAY_RESPONSE, SystemLog::EVENT_GATEWAY_SUCCESS, SystemLog::TYPE_STRIPE, $this->client, $this->client->company); From f3a3e63ccb5bb92d2bcc94c29ee36e3e92ba60c5 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 10 Sep 2021 07:44:58 +1000 Subject: [PATCH 4/6] fixes for client contact enforcement --- app/Models/ClientContact.php | 2 +- app/Repositories/ClientContactRepository.php | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Models/ClientContact.php b/app/Models/ClientContact.php index 7e532178c5..05f1c7392b 100644 --- a/app/Models/ClientContact.php +++ b/app/Models/ClientContact.php @@ -92,7 +92,7 @@ class ClientContact extends Authenticatable implements HasLocalePreference 'custom_value4', 'email', 'is_primary', - 'client_id', + // 'client_id', ]; /** diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php index 2dd7d7a63b..e43539e1d6 100644 --- a/app/Repositories/ClientContactRepository.php +++ b/app/Repositories/ClientContactRepository.php @@ -56,8 +56,10 @@ class ClientContactRepository extends BaseRepository if (! $update_contact) { $update_contact = ClientContactFactory::create($client->company_id, $client->user_id); - $update_contact->client_id = $client->id; } + + //10-09-2021 - enforce the client->id and remove client_id from fillables + $update_contact->client_id = $client->id; /* We need to set NULL email addresses to blank strings to pass authentication*/ if(array_key_exists('email', $contact) && is_null($contact['email'])) From 494ddc1624dc99d7af77abb9cf98e208bffe94e8 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 10 Sep 2021 15:34:17 +1000 Subject: [PATCH 5/6] Fixes for zoho payment imports --- app/Import/Transformers/Zoho/InvoiceTransformer.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/Import/Transformers/Zoho/InvoiceTransformer.php b/app/Import/Transformers/Zoho/InvoiceTransformer.php index c3659d77e6..49a416bd42 100644 --- a/app/Import/Transformers/Zoho/InvoiceTransformer.php +++ b/app/Import/Transformers/Zoho/InvoiceTransformer.php @@ -67,7 +67,7 @@ class InvoiceTransformer extends BaseTransformer { if ( $transformed['balance'] < $transformed['amount'] ) { $transformed['payments'] = [[ - 'date' => date( 'Y-m-d' ), + 'date' => isset( $invoice_data['Last Payment Date'] ) ? date( 'Y-m-d', strtotime( $invoice_data['Invoice Date'] ) ) : date( 'Y-m-d' ), 'amount' => $transformed['amount'] - $transformed['balance'], ]]; } @@ -75,3 +75,4 @@ class InvoiceTransformer extends BaseTransformer { return $transformed; } } + From 668817478cb25597e405132f82b1f3e64f89cb73 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Fri, 10 Sep 2021 17:44:43 +1000 Subject: [PATCH 6/6] V5.3.9 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index d758bc62f6..769f5e0bec 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.3.8 \ No newline at end of file +5.3.9 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index 15096ac5da..89d7ba65bf 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -14,8 +14,8 @@ return [ 'require_https' => env('REQUIRE_HTTPS', true), 'app_url' => rtrim(env('APP_URL', ''), '/'), 'app_domain' => env('APP_DOMAIN', 'invoicing.co'), - 'app_version' => '5.3.8', - 'app_tag' => '5.3.8', + 'app_version' => '5.3.9', + 'app_tag' => '5.3.9', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),