Skip to content

Commit

Permalink
Add customerSubscriptions to Customer entity
Browse files Browse the repository at this point in the history
  • Loading branch information
Neur0toxine authored Dec 20, 2024
2 parents 47edbda + 1881dd3 commit 068a9d0
Show file tree
Hide file tree
Showing 6 changed files with 238 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/Model/Entity/Customers/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,14 @@ class Customer implements CustomerInterface
*/
public $subscribed;

/**
* @var \RetailCrm\Api\Model\Entity\Customers\CustomerSubscription[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Customers\CustomerSubscription>")
* @JMS\SerializedName("customerSubscriptions")
*/
public $customerSubscriptions;

/**
* @var \RetailCrm\Api\Model\Entity\Customers\MGCustomer[]
*
Expand Down
46 changes: 46 additions & 0 deletions src/Model/Entity/Customers/CustomerSubscription.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
<?php

/**
* PHP version 7.3
*
* @category CustomerSubscription
* @package RetailCrm\Api\Model\Entity\Customers
*/

namespace RetailCrm\Api\Model\Entity\Customers;

use DateTime;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;

/**
* Class CustomerSubscription
*
* @category CustomerSubscription
* @package RetailCrm\Api\Model\Entity\Customers
*/
class CustomerSubscription
{
/**
* @var \RetailCrm\Api\Model\Entity\Customers\SubscriptionCategory
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Customers\SubscriptionCategory")
* @JMS\SerializedName("subscription")
*/
public $subscription;

/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("subscribed")
*/
public $subscribed;

/**
* @var DateTime
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("changedAt")
*/
public $changedAt;
}
77 changes: 77 additions & 0 deletions src/Model/Entity/Customers/SubscriptionCategory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
<?php

/**
* PHP version 7.3
*
* @category SubscriptionCategory
* @package RetailCrm\Api\Model\Entity\Customers
*/

namespace RetailCrm\Api\Model\Entity\Customers;

use RetailCrm\Api\Component\Serializer\Annotation as JMS;

/**
* Class SubscriptionCategory
*
* @category SubscriptionCategory
* @package RetailCrm\Api\Model\Entity\Customers
*/
class SubscriptionCategory
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("channel")
*/
public $channel;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("name")
*/
public $name;

/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("code")
*/
public $code;

/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("active")
*/
public $active;

/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("autoSubscribe")
*/
public $autoSubscribe;

/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("ordering")
*/
public $ordering;
}
8 changes: 8 additions & 0 deletions src/Model/Filter/Customers/CustomerFilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -494,4 +494,12 @@ class CustomerFilter
* @Form\SerializedName("attachedTags")
*/
public $attachedTags;

/**
* @var \RetailCrm\Api\Model\Filter\Customers\CustomerSubscriptionFilter[]
*
* @Form\Type("array<RetailCrm\Api\Model\Filter\Customers\CustomerSubscriptionFilter>")
* @Form\SerializedName("subscriptions")
*/
public $subscriptions;
}
45 changes: 45 additions & 0 deletions src/Model/Filter/Customers/CustomerSubscriptionFilter.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

/**
* PHP version 7.3
*
* @category CustomerSubscriptionFilter
* @package RetailCrm\Api\Model\Filter\Customers
*/

namespace RetailCrm\Api\Model\Filter\Customers;

use RetailCrm\Api\Component\FormData\Mapping as Form;

/**
* Class CustomerSubscriptionFilter
*
* @category CustomerSubscriptionFilter
* @package RetailCrm\Api\Model\Filter\Customers
*/
class CustomerSubscriptionFilter
{
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("channel")
*/
public $channel;

/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("subscription")
*/
public $subscription;

/**
* @var bool
*
* @Form\Type("bool")
* @Form\SerializedName("subscribed")
*/
public $subscribed;
}
54 changes: 54 additions & 0 deletions tests/src/ResourceGroup/CustomersTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,33 @@ public function testCustomersList(): void
"number": "89229112322"
}
],
"customerSubscriptions": [
{
"subscription": {
"id": 2,
"channel": "email",
"name": "Без тематики",
"code": "default_marketing",
"active": true,
"autoSubscribe": true,
"ordering": 1
},
"subscribed": true
},
{
"subscription": {
"id": 4,
"channel": "waba",
"name": "Без тематики",
"code": "default_marketing",
"active": true,
"autoSubscribe": true,
"ordering": 1
},
"subscribed": false,
"changedAt": "2024-12-17 11:50:43"
}
],
"mgCustomers": [
{
"id": 1,
Expand Down Expand Up @@ -2670,6 +2697,33 @@ public function testCustomersGet(): void
"number": "+79094055044"
}
],
"customerSubscriptions": [
{
"subscription": {
"id": 2,
"channel": "email",
"name": "Без тематики",
"code": "default_marketing",
"active": true,
"autoSubscribe": true,
"ordering": 1
},
"subscribed": true
},
{
"subscription": {
"id": 4,
"channel": "waba",
"name": "Без тематики",
"code": "default_marketing",
"active": true,
"autoSubscribe": true,
"ordering": 1
},
"subscribed": false,
"changedAt": "2024-12-17 11:50:43"
}
],
"mgCustomers": [
{
"id": 1,
Expand Down

0 comments on commit 068a9d0

Please sign in to comment.