From bee623af758a6e701d4ee32ea49e825fc35698c7 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 16 Jan 2022 19:09:46 +1100 Subject: [PATCH 1/5] Fixes for locale middleware --- app/Http/Middleware/Locale.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/Http/Middleware/Locale.php b/app/Http/Middleware/Locale.php index e8c9e4e148..d9f5513b8f 100644 --- a/app/Http/Middleware/Locale.php +++ b/app/Http/Middleware/Locale.php @@ -35,7 +35,13 @@ class Locale } elseif (auth('contact')->user()) { App::setLocale(auth('contact')->user()->client->locale()); } elseif (auth()->user()) { - App::setLocale(auth()->user()->company()->getLocale()); + + try{ + App::setLocale(auth()->user()->company()->getLocale()); + } + catch(\Exception $e){ + } + } else { App::setLocale(config('ninja.i18n.locale')); } From c507bc8203cce8533b7ca09d2b2b2df6de3d0780 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Sun, 16 Jan 2022 19:55:16 +1100 Subject: [PATCH 2/5] Remove locale from companydeleted mailable --- app/Mail/Company/CompanyDeleted.php | 1 - 1 file changed, 1 deletion(-) diff --git a/app/Mail/Company/CompanyDeleted.php b/app/Mail/Company/CompanyDeleted.php index 5f32f7d607..30af1c606a 100644 --- a/app/Mail/Company/CompanyDeleted.php +++ b/app/Mail/Company/CompanyDeleted.php @@ -48,7 +48,6 @@ class CompanyDeleted extends Mailable */ public function build() { - App::setLocale($this->company->getLocale()); return $this->from(config('mail.from.address'), config('mail.from.name')) ->subject(ctrans('texts.company_deleted')) From 36d957f7684ce812f705a6a1d9ba6b344fb592a4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 17 Jan 2022 10:46:16 +1100 Subject: [PATCH 3/5] Add DB options for configuring db_mode SSL for CI/CD --- app/Jobs/Mail/NinjaMailerJob.php | 6 ++++++ config/database.php | 22 ++++++++++------------ config/ninja.php | 6 ++++++ 3 files changed, 22 insertions(+), 12 deletions(-) diff --git a/app/Jobs/Mail/NinjaMailerJob.php b/app/Jobs/Mail/NinjaMailerJob.php index 83a5b62bff..fc7eb61059 100644 --- a/app/Jobs/Mail/NinjaMailerJob.php +++ b/app/Jobs/Mail/NinjaMailerJob.php @@ -210,6 +210,12 @@ class NinjaMailerJob implements ShouldQueue $user = $user->fresh(); } + //17-01-2022 - ensure we have a token otherwise we fail gracefully to default sending engine + if(strlen($user->oauth_user_token) == 0){ + $this->nmo->settings->email_sending_method = 'default'; + return $this->setMailDriver(); + } + $google->getClient()->setAccessToken(json_encode($user->oauth_user_token)); //need to slow down gmail requests otherwise we hit 429's diff --git a/config/database.php b/config/database.php index 8c0d15cdf9..b5305f4d65 100644 --- a/config/database.php +++ b/config/database.php @@ -1,5 +1,7 @@ true, 'strict' => env('DB_STRICT', false), 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', - // 'options' => array( - // PDO::ATTR_EMULATE_PREPARES => true - // ), + 'ssl_mode' => env('SSL_MODE',''), + // 'options' => Ninja::isHosted() ? config('ninja.db_options') : [], ], 'db-ninja-01a' => [ @@ -112,9 +113,8 @@ return [ 'prefix_indexes' => true, 'strict' => env('DB_STRICT', false), 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', - // 'options' => array( - // PDO::ATTR_EMULATE_PREPARES => true - // ), + 'ssl_mode' => env('SSL_MODE',''), //required + // 'options' => Ninja::isHosted() ? config('ninja.db_options') : [], ], 'db-ninja-02' => [ @@ -130,9 +130,8 @@ return [ 'prefix_indexes' => true, 'strict' => env('DB_STRICT', false), 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', - // 'options' => array( - // PDO::ATTR_EMULATE_PREPARES => true - // ), + 'ssl_mode' => env('SSL_MODE',''), + // 'options' => Ninja::isHosted() ? config('ninja.db_options') : [], ], 'db-ninja-02a' => [ @@ -148,9 +147,8 @@ return [ 'prefix_indexes' => true, 'strict' => env('DB_STRICT', false), 'engine' => 'InnoDB ROW_FORMAT=DYNAMIC', - // 'options' => array( - // PDO::ATTR_EMULATE_PREPARES => true - // ), + 'ssl_mode' => env('SSL_MODE',''), + // 'options' => Ninja::isHosted() ? config('ninja.db_options') : [], ], ], diff --git a/config/ninja.php b/config/ninja.php index d8292a5e64..f2d1b9ab3a 100644 --- a/config/ninja.php +++ b/config/ninja.php @@ -59,6 +59,12 @@ return [ 'default' => env('DB_CONNECTION', 'mysql'), ], + 'db_options' => [ + PDO::MYSQL_ATTR_SSL_KEY => env("DB_CLIENT_KEY", ''), + PDO::MYSQL_ATTR_SSL_CERT => env("DB_CLIENT_CERT", ''), + PDO::MYSQL_ATTR_SSL_CA => env("DB_CA_CERT", ''), + ], + 'i18n' => [ 'timezone_id' => env('DEFAULT_TIMEZONE', 1), 'country_id' => env('DEFAULT_COUNTRY', 840), // United Stated From 44719ac996ad4445133fc3d0e9dc4ef963904b2b Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 17 Jan 2022 14:58:37 +1100 Subject: [PATCH 4/5] Add transaction reference to eWay response --- app/PaymentDrivers/Eway/Token.php | 6 ++++-- app/PaymentDrivers/EwayPaymentDriver.php | 6 ------ 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/app/PaymentDrivers/Eway/Token.php b/app/PaymentDrivers/Eway/Token.php index 63b83b9c48..b49bf12a14 100644 --- a/app/PaymentDrivers/Eway/Token.php +++ b/app/PaymentDrivers/Eway/Token.php @@ -43,6 +43,8 @@ class Token $amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total; + $this->eway_driver->payment_hash = $payment_hash; + $transaction = [ 'Customer' => [ 'TokenCustomerID' => $cgt->token, @@ -74,10 +76,10 @@ class Token $data = [ 'gateway_type_id' => GatewayType::CREDIT_CARD, 'payment_type' => PaymentType::CREDIT_CARD_OTHER, - 'transaction_reference' => $response->Customer->Reference, + 'transaction_reference' => $response->TransactionID, 'amount' => $amount, ]; - + $payment = $this->eway_driver->createPayment($data); $payment->meta = $cgt->meta; $payment->save(); diff --git a/app/PaymentDrivers/EwayPaymentDriver.php b/app/PaymentDrivers/EwayPaymentDriver.php index 65559abd41..4c25496c85 100644 --- a/app/PaymentDrivers/EwayPaymentDriver.php +++ b/app/PaymentDrivers/EwayPaymentDriver.php @@ -167,12 +167,6 @@ class EwayPaymentDriver extends BaseDriver $fields[] = ['name' => 'client_name', 'label' => ctrans('texts.client_name'), 'type' => 'text', 'validation' => 'required']; } - // if ($this->company_gateway->require_contact_name) { - // } - - // if ($this->company_gateway->require_contact_email) { - // } - if ($this->company_gateway->require_client_phone) { $fields[] = ['name' => 'client_phone', 'label' => ctrans('texts.client_phone'), 'type' => 'tel', 'validation' => 'required']; } From 7a12968b288001bd75f13d5ecfb8c287fcf84669 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Mon, 17 Jan 2022 15:28:25 +1100 Subject: [PATCH 5/5] v5.3.47 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index a0155533fe..2caede1122 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.3.46 \ No newline at end of file +5.3.47 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index f2d1b9ab3a..3f9f4a8e1b 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.46', - 'app_tag' => '5.3.46', + 'app_version' => '5.3.47', + 'app_tag' => '5.3.47', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),