From c3f9addeca2f572114e1b83653d25dc3efa3cfdc Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 19 Jul 2022 07:59:20 +1000 Subject: [PATCH 1/6] Update Stripe responses for redirect_status --- app/PaymentDrivers/Stripe/Alipay.php | 2 +- app/PaymentDrivers/Stripe/Bancontact.php | 2 +- app/PaymentDrivers/Stripe/EPS.php | 2 +- app/PaymentDrivers/Stripe/FPX.php | 2 +- app/PaymentDrivers/Stripe/GIROPAY.php | 2 +- app/PaymentDrivers/Stripe/PRZELEWY24.php | 2 +- app/PaymentDrivers/Stripe/SOFORT.php | 3 ++- app/PaymentDrivers/Stripe/iDeal.php | 2 +- 8 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/PaymentDrivers/Stripe/Alipay.php b/app/PaymentDrivers/Stripe/Alipay.php index 3c18cb9bc9c5..5fee7aeac458 100644 --- a/app/PaymentDrivers/Stripe/Alipay.php +++ b/app/PaymentDrivers/Stripe/Alipay.php @@ -59,7 +59,7 @@ class Alipay $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); - if ($request->redirect_status == 'succeeded') { + if (in_array($request->redirect_status, ['succeeded', 'pending'])) { return $this->processSuccesfulRedirect($request->source); } diff --git a/app/PaymentDrivers/Stripe/Bancontact.php b/app/PaymentDrivers/Stripe/Bancontact.php index 6e4a640678d3..fcc257d9bf5f 100644 --- a/app/PaymentDrivers/Stripe/Bancontact.php +++ b/app/PaymentDrivers/Stripe/Bancontact.php @@ -81,7 +81,7 @@ class Bancontact $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); - if ($request->redirect_status == 'succeeded') { + if (in_array($request->redirect_status, ['succeeded','pending'])) { return $this->processSuccessfulPayment($request->payment_intent); } diff --git a/app/PaymentDrivers/Stripe/EPS.php b/app/PaymentDrivers/Stripe/EPS.php index baaf8f180763..677397b21593 100644 --- a/app/PaymentDrivers/Stripe/EPS.php +++ b/app/PaymentDrivers/Stripe/EPS.php @@ -80,7 +80,7 @@ class EPS $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); - if ($request->redirect_status == 'succeeded') { + if (in_array($request->redirect_status, ['succeeded','pending'])) { return $this->processSuccessfulPayment($request->payment_intent); } diff --git a/app/PaymentDrivers/Stripe/FPX.php b/app/PaymentDrivers/Stripe/FPX.php index f669de5c3646..dd415ea39808 100644 --- a/app/PaymentDrivers/Stripe/FPX.php +++ b/app/PaymentDrivers/Stripe/FPX.php @@ -81,7 +81,7 @@ class FPX $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); - if ($request->redirect_status == 'succeeded') { + if (in_array($request->redirect_status, ['succeeded','pending'])) { return $this->processSuccessfulPayment($request->payment_intent); } diff --git a/app/PaymentDrivers/Stripe/GIROPAY.php b/app/PaymentDrivers/Stripe/GIROPAY.php index 0457a9b6de4d..5dfc098f5446 100644 --- a/app/PaymentDrivers/Stripe/GIROPAY.php +++ b/app/PaymentDrivers/Stripe/GIROPAY.php @@ -80,7 +80,7 @@ class GIROPAY $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); - if ($request->redirect_status == 'succeeded') { + if (in_array($request->redirect_status, ['succeeded','pending'])) { return $this->processSuccessfulPayment($request->payment_intent); } diff --git a/app/PaymentDrivers/Stripe/PRZELEWY24.php b/app/PaymentDrivers/Stripe/PRZELEWY24.php index 6e497bb98bff..871a1697c924 100644 --- a/app/PaymentDrivers/Stripe/PRZELEWY24.php +++ b/app/PaymentDrivers/Stripe/PRZELEWY24.php @@ -80,7 +80,7 @@ class PRZELEWY24 $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); - if ($request->redirect_status == 'succeeded') { + if (in_array($request->redirect_status, ['succeeded','pending'])) { return $this->processSuccessfulPayment($request->payment_intent); } diff --git a/app/PaymentDrivers/Stripe/SOFORT.php b/app/PaymentDrivers/Stripe/SOFORT.php index b40f216c8d42..aed9f5a91e94 100644 --- a/app/PaymentDrivers/Stripe/SOFORT.php +++ b/app/PaymentDrivers/Stripe/SOFORT.php @@ -77,10 +77,11 @@ class SOFORT public function paymentResponse($request) { + $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); - if ($request->redirect_status == 'succeeded') { + if (in_array($request->redirect_status, ['succeeded','pending'])) { return $this->processSuccessfulPayment($request->payment_intent); } diff --git a/app/PaymentDrivers/Stripe/iDeal.php b/app/PaymentDrivers/Stripe/iDeal.php index 1009f9a0c2ea..eecd2ce60aac 100644 --- a/app/PaymentDrivers/Stripe/iDeal.php +++ b/app/PaymentDrivers/Stripe/iDeal.php @@ -80,7 +80,7 @@ class iDeal $this->stripe->payment_hash->data = array_merge((array) $this->stripe->payment_hash->data, $request->all()); $this->stripe->payment_hash->save(); - if ($request->redirect_status == 'succeeded') { + if (in_array($request->redirect_status, ['succeeded','pending'])) { return $this->processSuccessfulPayment($request->payment_intent); } From 852fe26cc1d1477f02eb21d72f5024c64ebae36f Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 19 Jul 2022 08:34:39 +1000 Subject: [PATCH 2/6] minor fixes for stripe --- app/Http/Controllers/StripeConnectController.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/Http/Controllers/StripeConnectController.php b/app/Http/Controllers/StripeConnectController.php index faafe25feeba..e9547414404c 100644 --- a/app/Http/Controllers/StripeConnectController.php +++ b/app/Http/Controllers/StripeConnectController.php @@ -120,7 +120,7 @@ class StripeConnectController extends BaseController $company_gateway->setConfig($payload); $company_gateway->save(); - StripeWebhook::dispatch($company->company_key, $company_gateway->id); + // StripeWebhook::dispatch($company->company_key, $company_gateway->id); //response here return view('auth.connect.completed'); From c1352e700da9252a53d2e4bf1386b3ebcd1057b3 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 19 Jul 2022 09:39:54 +1000 Subject: [PATCH 3/6] Fixes for purging company data --- app/Http/Controllers/MigrationController.php | 2 ++ app/Http/Requests/Company/StoreCompanyRequest.php | 4 ---- app/Jobs/Company/CompanyImport.php | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/MigrationController.php b/app/Http/Controllers/MigrationController.php index 2edaf042b933..c50868b85c42 100644 --- a/app/Http/Controllers/MigrationController.php +++ b/app/Http/Controllers/MigrationController.php @@ -179,6 +179,7 @@ class MigrationController extends BaseController $company->tasks()->forceDelete(); $company->vendors()->forceDelete(); $company->expenses()->forceDelete(); + $company->purchase_orders()->forceDelete(); $settings = $company->settings; @@ -196,6 +197,7 @@ class MigrationController extends BaseController $settings->ticket_number_counter = 1; $settings->payment_number_counter = 1; $settings->project_number_counter = 1; + $settings->purchase_order_number_counter = 1; $company->settings = $settings; diff --git a/app/Http/Requests/Company/StoreCompanyRequest.php b/app/Http/Requests/Company/StoreCompanyRequest.php index 0b8d72c69e70..684dca281740 100644 --- a/app/Http/Requests/Company/StoreCompanyRequest.php +++ b/app/Http/Requests/Company/StoreCompanyRequest.php @@ -63,10 +63,6 @@ class StoreCompanyRequest extends Request { $input = $this->all(); - //https not sure i should be forcing this. - // if(array_key_exists('portal_domain', $input) && strlen($input['portal_domain']) > 1) - // $input['portal_domain'] = str_replace("http:", "https:", $input['portal_domain']); - if (array_key_exists('google_analytics_url', $input)) { $input['google_analytics_key'] = $input['google_analytics_url']; } diff --git a/app/Jobs/Company/CompanyImport.php b/app/Jobs/Company/CompanyImport.php index 4977b11368a6..6ce29bbaaf24 100644 --- a/app/Jobs/Company/CompanyImport.php +++ b/app/Jobs/Company/CompanyImport.php @@ -458,7 +458,7 @@ class CompanyImport implements ShouldQueue $settings->ticket_number_counter = 1; $settings->payment_number_counter = 1; $settings->project_number_counter = 1; - $settings->purchase_order_counter = 1; + $settings->purchase_order_number_counter = 1; $this->company->settings = $co->settings; // $this->company->settings = $this->backup_file->company->settings; $this->company->save(); From c5b8c97b57bb2a6343e7c6e46d789a13f2414fe4 Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 19 Jul 2022 19:36:55 +1000 Subject: [PATCH 4/6] Fixes for invoice status if balance changes to negative --- app/Services/Invoice/InvoiceService.php | 3 +++ app/Utils/Traits/ClientGroupSettingsSaver.php | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/app/Services/Invoice/InvoiceService.php b/app/Services/Invoice/InvoiceService.php index 234392313b31..6da6423975b5 100644 --- a/app/Services/Invoice/InvoiceService.php +++ b/app/Services/Invoice/InvoiceService.php @@ -310,6 +310,9 @@ class InvoiceService elseif ($this->invoice->balance > 0 && $this->invoice->balance < $this->invoice->amount) { $this->invoice->status_id = Invoice::STATUS_PARTIAL; } + elseif ($this->invoice->balance < 0) { + $this->invoice->status_id = Invoice::STATUS_SENT; + } return $this; } diff --git a/app/Utils/Traits/ClientGroupSettingsSaver.php b/app/Utils/Traits/ClientGroupSettingsSaver.php index 985e0b69b30c..7d819d754ef6 100644 --- a/app/Utils/Traits/ClientGroupSettingsSaver.php +++ b/app/Utils/Traits/ClientGroupSettingsSaver.php @@ -89,8 +89,9 @@ trait ClientGroupSettingsSaver if(property_exists($settings, 'translations')) unset($settings->translations); + //18-07-2022 removed || empty($settings->{$key}) from this check to allow "0" values to persist foreach ($settings as $key => $value) { - if (! isset($settings->{$key}) || empty($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) { + if (! isset($settings->{$key}) || (! is_object($settings->{$key}) && strlen($settings->{$key}) == 0)) { unset($settings->{$key}); } } From a73e9611234070e3dbafd5cf96d9c7ac8f07d0ed Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 19 Jul 2022 20:07:23 +1000 Subject: [PATCH 5/6] Fixes for relations --- app/Listeners/Invoice/InvoiceArchivedActivity.php | 2 +- app/Listeners/Invoice/InvoicePaidActivity.php | 2 +- app/Models/Task.php | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/Listeners/Invoice/InvoiceArchivedActivity.php b/app/Listeners/Invoice/InvoiceArchivedActivity.php index 785983123fbf..5118ac5a29c9 100644 --- a/app/Listeners/Invoice/InvoiceArchivedActivity.php +++ b/app/Listeners/Invoice/InvoiceArchivedActivity.php @@ -21,7 +21,7 @@ class InvoiceArchivedActivity implements ShouldQueue { protected $activity_repo; - public $delay = 5; + public $delay = 15; /** * Create the event listener. diff --git a/app/Listeners/Invoice/InvoicePaidActivity.php b/app/Listeners/Invoice/InvoicePaidActivity.php index ec162331cbc2..040b12317a1c 100644 --- a/app/Listeners/Invoice/InvoicePaidActivity.php +++ b/app/Listeners/Invoice/InvoicePaidActivity.php @@ -21,7 +21,7 @@ class InvoicePaidActivity implements ShouldQueue { protected $activity_repo; - public $delay = 5; + public $delay = 10; /** * Create the event listener. diff --git a/app/Models/Task.php b/app/Models/Task.php index 1829b5011c97..0693eb0041c7 100644 --- a/app/Models/Task.php +++ b/app/Models/Task.php @@ -71,22 +71,22 @@ class Task extends BaseModel public function client() { - return $this->belongsTo(Client::class); + return $this->belongsTo(Client::class)->withTrashed(); } public function status() { - return $this->belongsTo(TaskStatus::class); + return $this->belongsTo(TaskStatus::class)->withTrashed(); } public function invoice() { - return $this->belongsTo(Invoice::class); + return $this->belongsTo(Invoice::class)->withTrashed(); } public function project() { - return $this->belongsTo(Project::class); + return $this->belongsTo(Project::class)->withTrashed(); } From 5b8e7685e5be5a27e335f75cb7a41556b5c6e5bf Mon Sep 17 00:00:00 2001 From: David Bomba Date: Tue, 19 Jul 2022 20:08:49 +1000 Subject: [PATCH 6/6] v5.4.11 --- VERSION.txt | 2 +- config/ninja.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/VERSION.txt b/VERSION.txt index 0403edcfe884..b01dcc14f856 100644 --- a/VERSION.txt +++ b/VERSION.txt @@ -1 +1 @@ -5.4.10 \ No newline at end of file +5.4.11 \ No newline at end of file diff --git a/config/ninja.php b/config/ninja.php index ebab634dc8e3..d51e80987306 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.4.10', - 'app_tag' => '5.4.10', + 'app_version' => '5.4.11', + 'app_tag' => '5.4.11', 'minimum_client_version' => '5.0.16', 'terms_version' => '1.0.1', 'api_secret' => env('API_SECRET', ''),