Add working with customer utm
This commit is contained in:
parent
6682b9b02c
commit
5aaed7ab7d
@ -167,6 +167,15 @@ class Customer implements ModelInterface
|
||||
*/
|
||||
private $email;
|
||||
|
||||
/**
|
||||
* @var Utm $utm
|
||||
*
|
||||
* @Type("RetailCrm\Mg\Bot\Model\Entity\Utm")
|
||||
* @Accessor(getter="getUtm",setter="setUtm")
|
||||
* @SkipWhenEmpty()
|
||||
*/
|
||||
private $utm;
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
@ -406,4 +415,21 @@ class Customer implements ModelInterface
|
||||
{
|
||||
$this->email = $email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Utm|null
|
||||
*/
|
||||
public function getUtm(): ?Utm
|
||||
{
|
||||
return $this->utm;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Utm $utm
|
||||
* @return void
|
||||
*/
|
||||
public function setUtm(Utm $utm): void
|
||||
{
|
||||
$this->utm = $utm;
|
||||
}
|
||||
}
|
||||
|
154
src/Bot/Model/Entity/Utm.php
Normal file
154
src/Bot/Model/Entity/Utm.php
Normal file
@ -0,0 +1,154 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* PHP version 7.1
|
||||
*
|
||||
* Utm entity
|
||||
*
|
||||
* @package Retailcrm\Mg\Bot\Model\Entity
|
||||
*/
|
||||
|
||||
namespace RetailCrm\Mg\Bot\Model\Entity;
|
||||
|
||||
use JMS\Serializer\Annotation\Accessor;
|
||||
use JMS\Serializer\Annotation\SkipWhenEmpty;
|
||||
use JMS\Serializer\Annotation\Type;
|
||||
use RetailCrm\Mg\Bot\Model\ModelInterface;
|
||||
|
||||
/**
|
||||
* Utm class
|
||||
*
|
||||
* @package RetailCrm\Mg\Bot\Model\Entity
|
||||
*/
|
||||
class Utm implements ModelInterface
|
||||
{
|
||||
/**
|
||||
* @var string $campaign
|
||||
*
|
||||
* @Type("string")
|
||||
* @Accessor(getter="getCampaign",setter="setCampaign")
|
||||
* @SkipWhenEmpty()
|
||||
*/
|
||||
private $campaign;
|
||||
|
||||
/**
|
||||
* @var string $content
|
||||
*
|
||||
* @Type("string")
|
||||
* @Accessor(getter="getContent",setter="setContent")
|
||||
* @SkipWhenEmpty()
|
||||
*/
|
||||
private $content;
|
||||
|
||||
/**
|
||||
* @var string $medium
|
||||
*
|
||||
* @Type("string")
|
||||
* @Accessor(getter="getMedium",setter="setMedium")
|
||||
* @SkipWhenEmpty()
|
||||
*/
|
||||
private $medium;
|
||||
|
||||
/**
|
||||
* @var string $source
|
||||
*
|
||||
* @Type("string")
|
||||
* @Accessor(getter="getSource",setter="setSource")
|
||||
* @SkipWhenEmpty()
|
||||
*/
|
||||
private $source;
|
||||
|
||||
/**
|
||||
* @var string $term
|
||||
*
|
||||
* @Type("string")
|
||||
* @Accessor(getter="getTerm",setter="setTerm")
|
||||
* @SkipWhenEmpty()
|
||||
*/
|
||||
private $term;
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getCampaign(): ?string
|
||||
{
|
||||
return $this->campaign;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $campaign
|
||||
* @return void
|
||||
*/
|
||||
public function setCampaign(string $campaign): void
|
||||
{
|
||||
$this->campaign = $campaign;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getContent(): ?string
|
||||
{
|
||||
return $this->content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $content
|
||||
* @return void
|
||||
*/
|
||||
public function setContent(string $content): void
|
||||
{
|
||||
$this->content = $content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getMedium(): ?string
|
||||
{
|
||||
return $this->medium;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $medium
|
||||
* @return void
|
||||
*/
|
||||
public function setMedium(string $medium): void
|
||||
{
|
||||
$this->medium = $medium;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getSource(): ?string
|
||||
{
|
||||
return $this->source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $source
|
||||
* @return void
|
||||
*/
|
||||
public function setSource(string $source): void
|
||||
{
|
||||
$this->source = $source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string|null
|
||||
*/
|
||||
public function getTerm(): ?string
|
||||
{
|
||||
return $this->term;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $term
|
||||
* @return void
|
||||
*/
|
||||
public function setTerm(string $term): void
|
||||
{
|
||||
$this->term = $term;
|
||||
}
|
||||
}
|
@ -252,5 +252,8 @@ class ClientListTest extends TestCase
|
||||
|
||||
self::assertCount(3, $response);
|
||||
self::assertInstanceOf(Customer::class, $response[0]);
|
||||
|
||||
$utm = $response[0]->getUtm()->getCampaign();
|
||||
static::assertEquals('spring_sale', $utm, "Incorrect utm data");
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,14 @@
|
||||
"country": "",
|
||||
"language": "en",
|
||||
"phone": "",
|
||||
"email": ""
|
||||
"email": "",
|
||||
"utm": {
|
||||
"campaign": "spring_sale",
|
||||
"content": "textlink",
|
||||
"medium": "cpc",
|
||||
"source": "Google",
|
||||
"term": "running"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 38,
|
||||
@ -29,7 +36,14 @@
|
||||
"country": "",
|
||||
"language": "ru",
|
||||
"phone": "",
|
||||
"email": ""
|
||||
"email": "",
|
||||
"utm": {
|
||||
"campaign": "test",
|
||||
"content": "test",
|
||||
"medium": "test",
|
||||
"source": "test",
|
||||
"term": "test"
|
||||
}
|
||||
},
|
||||
{
|
||||
"id": 37,
|
||||
@ -45,6 +59,13 @@
|
||||
"country": "",
|
||||
"language": "ru",
|
||||
"phone": "",
|
||||
"email": ""
|
||||
"email": "",
|
||||
"utm": {
|
||||
"campaign": "",
|
||||
"content": "",
|
||||
"medium": "",
|
||||
"source": "",
|
||||
"term": ""
|
||||
}
|
||||
}
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user