Skip to content

Commit

Permalink
refact: sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kaioken committed Jul 30, 2024
1 parent eef13a0 commit 6539c7c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 6539c7c

Please sign in to comment.