diff --git a/VERSION.txt b/VERSION.txt index d758bc62f66a..769f5e0bec78 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/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php b/app/Http/Requests/Gateways/Checkout3ds/Checkout3dsRequest.php index 021379542094..c0d5e16c547f 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/Import/Transformers/Zoho/InvoiceTransformer.php b/app/Import/Transformers/Zoho/InvoiceTransformer.php index c3659d77e61d..49a416bd422c 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; } } + diff --git a/app/Jobs/Util/Import.php b/app/Jobs/Util/Import.php index d2ebc5dc9483..66b38f2216df 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/Mail/SupportMessageSent.php b/app/Mail/SupportMessageSent.php index e88251389091..7ea23586ef73 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'); diff --git a/app/Models/ClientContact.php b/app/Models/ClientContact.php index 7e532178c555..05f1c7392b86 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/PaymentDrivers/StripePaymentDriver.php b/app/PaymentDrivers/StripePaymentDriver.php index 7deb0b433dcb..891bb9697a80 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); diff --git a/app/Repositories/ClientContactRepository.php b/app/Repositories/ClientContactRepository.php index f2dc62691e43..e43539e1d657 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'])) @@ -88,5 +90,7 @@ class ClientContactRepository extends BaseRepository $new_contact->email = ' '; $new_contact->save(); } + + $client = null; } } diff --git a/config/ninja.php b/config/ninja.php index 15096ac5dad9..89d7ba65bf3e 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', ''),