Skip to content
This repository was archived by the owner on Jan 26, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions src/LooplineSystems/CloseIoApiWrapper/Model/Opportunity.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,26 @@ class Opportunity implements \JsonSerializable
*/
private $value;

/**
* @var string
*/
private $value_currency;

/**
* @var string
*/
private $contact_name;

/**
* @var string
*/
private $value_formatted;

/**
* @var array
*/
private $integration_links = [];

/**
* @param array $data
*/
Expand Down Expand Up @@ -569,4 +589,80 @@ public function setValue($value)

return $this;
}

/**
* @return string
*/
public function getValueCurrency()
{
return $this->value_currency;
}

/**
* @param string $value_currency
* @return $this
*/
public function setValueCurrency($value_currency)
{
$this->value_currency = $value_currency;

return $this;
}

/**
* @return string
*/
public function getContactName()
{
return $this->contact_name;
}

/**
* @param string $contact_name
* @return $this
*/
public function setContactName($contact_name)
{
$this->contact_name = $contact_name;

return $this;
}

/**
* @return string
*/
public function getValueFormatted()
{
return $this->value_formatted;
}

/**
* @param string $value_formatted
* @return $this
*/
public function setValueFormatted($value_formatted)
{
$this->value_formatted = $value_formatted;

return $this;
}

/**
* @return array
*/
public function getIntegrationLinks()
{
return $this->integration_links;
}

/**
* @param array $integration_links
* @return $this
*/
public function setIntegrationLinks($integration_links)
{
$this->integration_links = $integration_links;

return $this;
}
}
49 changes: 49 additions & 0 deletions src/LooplineSystems/CloseIoApiWrapper/Model/Task.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,22 @@ class Task implements \JsonSerializable
* @var string
*/
private $lead_id;

/**
* @var string
*/
private $date_created;

/**
* @var string
*/
private $date;

/**
* @var string
*/
private $view;

/**
* @param array $data
*/
Expand Down Expand Up @@ -409,4 +420,42 @@ public function setDateCreated($date_created)

return $this;
}

/**
* @return string
*/
public function getDate()
{
return $this->date;
}

/**
* @param string $date
* @return $this
*/
public function setDate($date)
{
$this->date = $date;

return $this;
}

/**
* @return string
*/
public function getView()
{
return $this->view;
}

/**
* @param string $view
* @return $this
*/
public function setView($view)
{
$this->view = $view;

return $this;
}
}
33 changes: 26 additions & 7 deletions tests/LooplineSystems/CloseIoApi/Api/LeadTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

namespace LooplineSystems\CloseIoApiWrapper\Tests;

use LooplineSystems\CloseIoApiWrapper\Model\Address;
use LooplineSystems\CloseIoApiWrapper\Model\Contact;
use LooplineSystems\CloseIoApiWrapper\Model\Email;
use LooplineSystems\CloseIoApiWrapper\Model\Lead;
use LooplineSystems\CloseIoApiWrapper\Model\Opportunity;
Expand Down Expand Up @@ -51,31 +53,44 @@ public function testCreateDynamicLead($data)
$tasks[] = new Task($task);
}

$opportunities = [];
foreach ($data['opportunities'] as $opportunity) {
$opportunities[] = new Opportunity($opportunity);
}

$addresses = [];
foreach ($data['addresses'] as $address) {
$addresses[] = new Address($address);
}

$contacts = [];
foreach ($data['contacts'] as $contact) {
$contacts[] = new Contact($contact);
}


$dynamicLead->setId($data['id']);
$dynamicLead->setStatusId($data['status_id']);
$dynamicLead->setStatusLabel($data['status_label']);
$dynamicLead->setDescription($data['description']);
$dynamicLead->setDisplayName($data['display_name']);
$dynamicLead->setAddresses($data['addresses']);
$dynamicLead->setAddresses($addresses);
$dynamicLead->setOrganization($data['organization']);
$dynamicLead->setCreatedBy($data['created_by']);
$dynamicLead->setUrl($data['url']);
$dynamicLead->setTasks($tasks);
$dynamicLead->setName($data['name']);
$dynamicLead->setContacts($data['contacts']);
$dynamicLead->setContacts($contacts);
$dynamicLead->setDateCreated($data['date_created']);
$dynamicLead->setCustom($data['custom']);
$dynamicLead->setUpdatedByName($data['updated_by_name']);
$dynamicLead->setCreatedByName($data['created_by_name']);
$dynamicLead->setOpportunities($data['opportunities']);
$dynamicLead->setOpportunities($opportunities);
$dynamicLead->setHtmlUrl($data['html_url']);
$dynamicLead->setUpdatedBy($data['updated_by']);
$dynamicLead->setDateUpdated($data['date_updated']);
$dynamicLead->setOrganizationId($data['organization_id']);

$dynamicLead = json_decode(json_encode($dynamicLead));
$hydratedLead = json_decode(json_encode($hydratedLead));

$this->assertTrue($hydratedLead == $dynamicLead);
}

Expand Down Expand Up @@ -215,7 +230,11 @@ public function fullLeadProvider()
'organization_id' => 'llk3j4lkjkla',
'lead_id' => '32lkjsdalfkj34lkj',
'status_label' => Opportunity::OPPORTUNITY_STATUS_WON,
'value' => '42342'
'value' => '42342',
"value_currency" => "USD",
"contact_name" => 'name',
"value_formatted" => "$500",
"integration_links" => [],
]
],
'html_url' => 'test.com',
Expand Down