From 6539c7ccb03399c41f0cb2d3e1893ed7e1d0b7bc Mon Sep 17 00:00:00 2001 From: kaioken Date: Tue, 30 Jul 2024 17:02:54 -0400 Subject: [PATCH] refact: sync --- .../Shopify/ShopifyInventorySyncCommand.php | 12 +++++++++--- .../Connectors/Zoho/ZohoLeadsDownloadCommand.php | 6 +++++- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/Connectors/Shopify/ShopifyInventorySyncCommand.php b/app/Console/Commands/Connectors/Shopify/ShopifyInventorySyncCommand.php index f0f506c37..8fa878950 100644 --- a/app/Console/Commands/Connectors/Shopify/ShopifyInventorySyncCommand.php +++ b/app/Console/Commands/Connectors/Shopify/ShopifyInventorySyncCommand.php @@ -13,6 +13,7 @@ use Kanvas\Inventory\Products\Models\Products; use Kanvas\Inventory\Warehouses\Models\Warehouses; use Kanvas\Users\Models\UserCompanyApps; +use Throwable; class ShopifyInventorySyncCommand extends Command { @@ -53,11 +54,16 @@ public function handle() ->get(); foreach ($products as $product) { - $this->info("Checking product {$product->getId()} {$product->name} \n"); + try { + $this->info("Checking product {$product->getId()} {$product->name} \n"); - $shopifyService = new ShopifyInventoryService($product->app, $product->company, $warehouses); - $shopifyService->saveProduct($product, StatusEnum::ACTIVE, $channel); + $shopifyService = new ShopifyInventoryService($product->app, $product->company, $warehouses); + $shopifyService->saveProduct($product, StatusEnum::ACTIVE, $channel); + } catch (Throwable $e) { + $this->error("Error syncing product {$product->getId()} {$product->name} \n"); + } } + return; } } diff --git a/app/Console/Commands/Connectors/Zoho/ZohoLeadsDownloadCommand.php b/app/Console/Commands/Connectors/Zoho/ZohoLeadsDownloadCommand.php index 15da2638d..0d62e7d23 100644 --- a/app/Console/Commands/Connectors/Zoho/ZohoLeadsDownloadCommand.php +++ b/app/Console/Commands/Connectors/Zoho/ZohoLeadsDownloadCommand.php @@ -43,7 +43,11 @@ public function handle() $leadsPerPage = (int) $this->argument('leadsPerPage'); $downloadAllLeads = new DownloadAllZohoLeadAction($app, $company, $leadReceiver); - $downloadAllLeads->execute($page, $leadsPerPage); + $leads = $downloadAllLeads->execute($page, $leadsPerPage); + + foreach ($leads as $lead) { + echo 'Lead ' . $lead->id . ' downloaded' . PHP_EOL; + } $this->info($downloadAllLeads->getTotalLeadsProcessed() . ' leads downloaded from Zoho to ' . $leadReceiver->name);