Skip to content

Commit

Permalink
Merge pull request #1781 from bakaphp/hotfix-sync
Browse files Browse the repository at this point in the history
refact: synz
  • Loading branch information
kaioken committed Aug 5, 2024
2 parents 2763496 + 3e123b2 commit 93033ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/Domains/Connectors/Zoho/Actions/SyncLeadToZohoAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
namespace Kanvas\Connectors\Zoho\Actions;

use Baka\Contracts\AppInterface;
use Baka\Contracts\CompanyInterface;
use Kanvas\Companies\Models\Companies;
use Kanvas\Connectors\Zoho\Client;
use Kanvas\Connectors\Zoho\DataTransferObject\ZohoLead;
Expand All @@ -14,7 +13,6 @@
use Kanvas\Guild\Agents\Models\Agent;
use Kanvas\Guild\Leads\Models\Lead;
use Throwable;
use Webleit\ZohoCrmApi\Models\Model;
use Webleit\ZohoCrmApi\Modules\Leads as ZohoLeadModule;

class SyncLeadToZohoAction
Expand All @@ -25,7 +23,7 @@ public function __construct(
) {
}

public function execute(): Model
public function execute(): array
{
$zohoLead = ZohoLead::fromLead($this->lead);
$zohoData = $zohoLead->toArray();
Expand Down Expand Up @@ -63,7 +61,7 @@ public function execute(): Model

$this->uploadAttachments($zohoCrm->leads, $lead);

return $zohoLead;
return $zohoData;
}

protected function assignAgent(
Expand Down
8 changes: 4 additions & 4 deletions src/Domains/Connectors/Zoho/Workflows/ZohoLeadActivity.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ class ZohoLeadActivity extends Activity implements WorkflowActivityInterface
public function execute(Model $lead, AppInterface $app, array $params): array
{
$this->overwriteAppService($app);
$zohoLead = ZohoLead::fromLead($lead);
$zohoData = $zohoLead->toArray();
//$zohoLead = ZohoLead::fromLead($lead);
//$zohoData = $zohoLead->toArray();
//$company = Companies::getById($lead->companies_id);

$syncLeadWithZoho = new SyncLeadToZohoAction($app, $lead);
$zohoLead = $syncLeadWithZoho->execute();

return [
'zohoLeadId' => $zohoLead->getId(),
'zohoRequest' => $zohoData,
'zohoLeadId' => $lead->getId(),
'zohoRequest' => $zohoLead,
'leadId' => $lead->getId(),
'status' => $lead->status()->first()->name,
];
Expand Down

0 comments on commit 93033ce

Please sign in to comment.