1
0
Fork 0
mirror of synced 2025-04-07 07:43:39 +03:00

Compare commits

..

No commits in common. "master" and "v6.15.0" have entirely different histories.

50 changed files with 12 additions and 2230 deletions

View file

@ -17,30 +17,24 @@ jobs:
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
steps:
- name: Check out code into the workspace
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
- name: Composer cache
uses: actions/cache@v4
uses: actions/cache@v2
with:
path: ${{ env.HOME }}/.composer/cache
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
- name: Install dependencies
run: composer install -o
- name: Configure matchers
uses: mheap/phpunit-matcher-action@v1
- name: Run tests
run: composer run-script phpunit-ci
- name: Coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v2
with:
verbose: true

View file

@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the workspace
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Run PHPCS
uses: chekalsky/phpcs-action@v1
phpmd:
@ -21,7 +21,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the workspace
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Run PHPMD
uses: GeneaLabs/action-reviewdog-phpmd@1.0.0
with:
@ -35,7 +35,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out code into the workspace
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Run PHPStan
uses: docker://oskarstark/phpstan-ga:1.8.0
with:

View file

@ -19,7 +19,7 @@ jobs:
pages_threshold: major_outage
- name: Check out code into the workspace
if: success() && ${{ github.ref != 'refs/heads/master' }}
uses: actions/checkout@v4
uses: actions/checkout@v2
- name: Setup PHP 8.3
if: ${{ github.ref != 'refs/heads/master' }}
uses: shivammathur/setup-php@v2
@ -27,7 +27,7 @@ jobs:
php-version: "8.3"
- name: Cache phpDocumentor
id: cache-phpdocumentor
uses: actions/cache@v4
uses: actions/cache@v2
with:
path: phpDocumentor.phar
key: phpdocumentor

View file

@ -23,19 +23,19 @@
"psr/http-message": "^1.0 || ^2.0",
"psr/http-message-implementation": "^1.0",
"php-http/client-implementation": "^1.0",
"php-http/message-factory": "^1.0",
"php-http/discovery": "^1.13",
"doctrine/annotations": "^1.13|^2.0",
"liip/serializer": "2.2.* || 2.6.*",
"php-http/httplug": "^2.2",
"civicrm/composer-compile-plugin": "^0.20",
"symfony/console": "^4.0|^5.0|^6.0|^7.0",
"symfony/console": "^4.0|^5.0|^6.0",
"psr/event-dispatcher": "^1.0",
"neur0toxine/psr.http-client-implementation.php-http-curl": "*",
"neur0toxine/psr.http-factory-implementation.nyholm": "*",
"neur0toxine/psr.http-message-implementation.nyholm": "*",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"symfony/cache": ">=v3.1.0",
"psr/http-factory": "^1.1"
"symfony/cache": ">=v3.1.0"
},
"require-dev": {
"squizlabs/php_codesniffer": "^3.5",

View file

@ -18,7 +18,6 @@ use RetailCrm\Api\Interfaces\RequestTransformerInterface;
use RetailCrm\Api\Interfaces\ResponseTransformerInterface;
use RetailCrm\Api\ResourceGroup\Api;
use RetailCrm\Api\ResourceGroup\Costs;
use RetailCrm\Api\ResourceGroup\CustomerInteraction;
use RetailCrm\Api\ResourceGroup\Customers;
use RetailCrm\Api\ResourceGroup\CustomersCorporate;
use RetailCrm\Api\ResourceGroup\CustomFields;
@ -68,9 +67,6 @@ class Client
/** @var \RetailCrm\Api\ResourceGroup\CustomFields */
public $customFields;
/** @var \RetailCrm\Api\ResourceGroup\CustomerInteraction */
public $customerInteraction;
/** @var \RetailCrm\Api\ResourceGroup\Customers */
public $customers;
@ -191,14 +187,6 @@ class Client
$eventDispatcher,
$logger
);
$this->customerInteraction = new CustomerInteraction(
$url,
$httpClient,
$requestTransformer,
$responseTransformer,
$eventDispatcher,
$logger
);
$this->customers = new Customers(
$url,
$httpClient,

View file

@ -1,22 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category BySite
* @package RetailCrm\Api\Enum
*/
namespace RetailCrm\Api\Enum;
/**
* Class BySite
*
* @category BySite
* @package RetailCrm\Api\Enum
*/
final class BySite
{
public const ID = 'id';
public const CODE = 'code';
}

View file

@ -285,7 +285,6 @@ class ClientFactory implements ClientFactoryInterface, EventDispatcherAwareInter
->setStreamFactory($this->streamFactory)
->setRequestFactory($this->requestFactory)
->setUriFactory($this->uriFactory)
->setEventDispatcher($this->eventDispatcher)
->appendRequestHandlers($this->requestHandlers)
->appendResponseHandlers($this->responseHandlers)
->build();

View file

@ -1,86 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category Cart
* @package RetailCrm\Api\Model\Entity\CustomerInteraction
*/
namespace RetailCrm\Api\Model\Entity\CustomerInteraction;
use DateTime;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class Cart
*
* @category Cart
* @package RetailCrm\Api\Model\Entity\CustomerInteraction
*/
class Cart
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("currency")
*/
public $currency;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("externalId")
*/
public $externalId;
/**
* @var DateTime
*
* @JMS\Type("DateTime<'Y-m-d H:i:sP'>")
* @JMS\SerializedName("droppedAt")
*/
public $droppedAt;
/**
* @var DateTime
*
* @JMS\Type("DateTime<'Y-m-d H:i:sP'>")
* @JMS\SerializedName("clearedAt")
*/
public $clearedAt;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("link")
*/
public $link;
/**
* @var \RetailCrm\Api\Model\Entity\CustomerInteraction\CartCustomer
*
* @JMS\Type("RetailCrm\Api\Model\Entity\CustomerInteraction\CartCustomer")
* @JMS\SerializedName("customer")
*/
public $customer;
/**
* @var \RetailCrm\Api\Model\Entity\CustomerInteraction\CartItem[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\CustomerInteraction\CartItem>")
* @JMS\SerializedName("items")
*/
public $items;
/**
* @var \RetailCrm\Api\Model\Entity\CustomerInteraction\CartOrder
*
* @JMS\Type("RetailCrm\Api\Model\Entity\CustomerInteraction\CartOrder")
* @JMS\SerializedName("order")
*/
public $order;
}

View file

@ -1,61 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category CartCustomer
* @package RetailCrm\Api\Model\Entity\CustomerInteraction
*/
namespace RetailCrm\Api\Model\Entity\CustomerInteraction;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class CartCustomer
*
* @category CartCustomer
* @package RetailCrm\Api\Model\Entity\CustomerInteraction
*/
class CartCustomer
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("externalId")
*/
public $externalId;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("browserId")
*/
public $browserId;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("site")
*/
public $site;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("gaClientId")
*/
public $gaClientId;
}

View file

@ -1,53 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category CartItem
* @package RetailCrm\Api\Model\Entity\CustomerInteraction
*/
namespace RetailCrm\Api\Model\Entity\CustomerInteraction;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class CartItem
*
* @category CartItem
* @package RetailCrm\Api\Model\Entity\CustomerInteraction
*/
class CartItem
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;
/**
* @var \RetailCrm\Api\Model\Entity\Orders\Items\Offer
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Orders\Items\Offer")
* @JMS\SerializedName("offer")
*/
public $offer;
/**
* @var float
*
* @JMS\Type("float")
* @JMS\SerializedName("quantity")
*/
public $quantity;
/**
* @var float
*
* @JMS\Type("float")
* @JMS\SerializedName("price")
*/
public $price;
}

View file

@ -1,45 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category CartOrder
* @package RetailCrm\Api\Model\Entity\CustomerInteraction
*/
namespace RetailCrm\Api\Model\Entity\CustomerInteraction;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class CartOrder
*
* @category CartOrder
* @package RetailCrm\Api\Model\Entity\CustomerInteraction
*/
class CartOrder
{
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("externalId")
*/
public $externalId;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("number")
*/
public $number;
}

View file

@ -369,14 +369,6 @@ 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[]
*

View file

@ -1,46 +0,0 @@
<?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;
}

View file

@ -1,77 +0,0 @@
<?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;
}

View file

@ -1,45 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category EmbedJsConfiguration
* @package RetailCrm\Api\Model\Entity\Integration\EmbedJs
*/
namespace RetailCrm\Api\Model\Entity\Integration\EmbedJs;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class EmbedJsConfiguration
*
* @category EmbedJsConfiguration
* @package RetailCrm\Api\Model\Entity\Integration\EmbedJs
*/
class EmbedJsConfiguration
{
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("entrypoint")
*/
public $entrypoint;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("stylesheet")
*/
public $stylesheet;
/**
* @var string[]
*
* @JMS\Type("array<string>")
* @JMS\SerializedName("targets")
*/
public $targets;
}

View file

@ -74,12 +74,4 @@ class Integrations
* @JMS\SerializedName("mgBot")
*/
public $mgBot;
/**
* @var \RetailCrm\Api\Model\Entity\Integration\EmbedJs\EmbedJsConfiguration
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Integration\EmbedJs\EmbedJsConfiguration")
* @JMS\SerializedName("embedJs")
*/
public $embedJs;
}

View file

@ -43,14 +43,6 @@ class ApiUpdateInvoiceRequest
*/
public $amount;
/**
* @var float
*
* @JMS\Type("float")
* @JMS\SerializedName("discountAmount")
*/
public $discountAmount;
/**
* @var string
*

View file

@ -91,14 +91,6 @@ class Store
*/
public $phone;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("contact")
*/
public $contact;
/**
* @var string
*

View file

@ -1,190 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category OfferProduct
* @package RetailCrm\Api\Model\Entity\Store
*/
namespace RetailCrm\Api\Model\Entity\Store;
use DateTime;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class Product
*
* @category OfferProduct
* @package RetailCrm\Api\Model\Entity\Store
*/
class OfferProduct
{
/**
* @var float
*
* @JMS\Type("float")
* @JMS\SerializedName("minPrice")
*/
public $minPrice;
/**
* @var float
*
* @JMS\Type("float")
* @JMS\SerializedName("maxPrice")
*/
public $maxPrice;
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("id")
*/
public $id;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("article")
*/
public $article;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("name")
*/
public $name;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("url")
*/
public $url;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("imageUrl")
*/
public $imageUrl;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("description")
*/
public $description;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("popular")
*/
public $popular;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("stock")
*/
public $stock;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("novelty")
*/
public $novelty;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("recommended")
*/
public $recommended;
/**
* @var array<string, mixed>
*
* @JMS\Type("array")
* @JMS\SerializedName("properties")
*/
public $properties;
/**
* @var \RetailCrm\Api\Model\Entity\FixExternalRow[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\FixExternalRow>")
* @JMS\SerializedName("groups")
*/
public $groups;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("externalId")
*/
public $externalId;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("manufacturer")
*/
public $manufacturer;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("active")
*/
public $active;
/**
* @var float
*
* @JMS\Type("float")
* @JMS\SerializedName("quantity")
*/
public $quantity;
/**
* @var bool
*
* @JMS\Type("bool")
* @JMS\SerializedName("markable")
*/
public $markable;
/**
* @var DateTime
*
* @JMS\Type("DateTime<'Y-m-d H:i:s'>")
* @JMS\SerializedName("updatedAt")
*/
public $updatedAt;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("type")
*/
public $type;
}

View file

@ -36,14 +36,6 @@ class Product
*/
public $maxPrice;
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("catalogId")
*/
public $catalogId;
/**
* @var int
*

View file

@ -170,12 +170,4 @@ class ProductOffer
* @JMS\SerializedName("barcode")
*/
public $barcode;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("site")
*/
public $site;
}

View file

@ -1,45 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category ProductPropertyValue
* @package RetailCrm\Api\Model\Entity\Store
*/
namespace RetailCrm\Api\Model\Entity\Store;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class ProductPropertyValue
*
* @category ProductPropertyValue
* @package RetailCrm\Api\Model\Entity\Store
*/
class ProductPropertyValue
{
/**
* @var \RetailCrm\Api\Model\Entity\Store\ProductProperty
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Store\ProductProperty")
* @JMS\SerializedName("property")
*/
public $property;
/**
* @var string
*
* @JMS\Type("string")
* @JMS\SerializedName("value")
*/
public $value;
/**
* @var int
*
* @JMS\Type("int")
* @JMS\SerializedName("offersCount")
*/
public $offersCount;
}

View file

@ -1,34 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category StoreOffer
* @package RetailCrm\Api\Model\Entity\Store
*/
namespace RetailCrm\Api\Model\Entity\Store;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
/**
* Class StoreOffer
*
* @category StoreOffer
* @package RetailCrm\Api\Model\Entity\Store
*/
class StoreOffer extends ProductOffer
{
/**
* @JMS\Exclude()
*/
public $price;
/**
* @var \RetailCrm\Api\Model\Entity\Store\Product
*
* @JMS\Type("RetailCrm\Api\Model\Entity\Store\Product")
* @JMS\SerializedName("product")
*/
public $product;
}

View file

@ -494,12 +494,4 @@ 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;
}

View file

@ -1,45 +0,0 @@
<?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;
}

View file

@ -357,12 +357,4 @@ class CustomerCorporateFilter
* @Form\SerializedName("companyName")
*/
public $companyName;
/**
* @var array<string, mixed>
*
* @Form\Type("array")
* @Form\SerializedName("customFields")
*/
public $customFields;
}

View file

@ -1,142 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category OfferFilterType
* @package RetailCrm\Api\Model\Filter\Store
*/
namespace RetailCrm\Api\Model\Filter\Store;
use DateTime;
use RetailCrm\Api\Component\FormData\Mapping as Form;
/**
* Class OfferFilterType
*
* @category OfferFilterType
* @package RetailCrm\Api\Model\Filter\Store
*/
class OfferFilterType
{
/**
* @var int[]
*
* @Form\Type("int[]")
* @Form\SerializedName("ids")
*/
public $ids;
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("name")
*/
public $name;
/**
* @var string
*
* @Form\Type("string[]")
* @Form\SerializedName("externalIds")
*/
public $externalIds;
/**
* @var string
*
* @Form\Type("string[]")
* @Form\SerializedName("xmlIds")
*/
public $xmlIds;
/**
* @var string[]
*
* @Form\Type("string[]")
* @Form\SerializedName("properties")
*/
public $properties;
/**
* @var string[]
*
* @Form\Type("string[]")
* @Form\SerializedName("sites")
*/
public $sites;
/**
* @var int[]
*
* @Form\Type("int[]")
* @Form\SerializedName("catalogs")
*/
public $catalogs;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("active")
*/
public $active;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("sinceId")
*/
public $sinceId;
/**
* @var int[]
*
* @Form\Type("int[]")
* @Form\SerializedName("groups")
*/
public $groups;
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("priceType")
*/
public $priceType;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("minPrice")
*/
public $minPrice;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("maxPrice")
*/
public $maxPrice;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("minQuantity")
*/
public $minQuantity;
/**
* @var int
*
* @Form\Type("int")
* @Form\SerializedName("maxQuantity")
*/
public $maxQuantity;
}

View file

@ -124,14 +124,6 @@ class ProductFilterType
*/
public $url;
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("urlLike")
*/
public $urlLike;
/**
* @var string
*

View file

@ -66,12 +66,4 @@ class ProductPropertiesFilterType
* @Form\SerializedName("catalogs")
*/
public $catalogs;
/**
* @var int[]
*
* @Form\Type("int[]")
* @Form\SerializedName("groups")
*/
public $groups;
}

View file

@ -1,45 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category ProductPropertyValuesFilterType
* @package RetailCrm\Api\Model\Filter\Store
*/
namespace RetailCrm\Api\Model\Filter\Store;
use RetailCrm\Api\Component\FormData\Mapping as Form;
/**
* Class ProductPropertyValuesFilterType
*
* @category ProductPropertyValuesFilterType
* @package RetailCrm\Api\Model\Filter\Store
*/
class ProductPropertyValuesFilterType
{
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("propertyName")
*/
public $propertyName;
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("propertyCode")
*/
public $propertyCode;
/**
* @var int[]
*
* @Form\Type("int[]")
* @Form\SerializedName("groups")
*/
public $groups;
}

View file

@ -1,55 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category ByAndSiteByRequest
* @package RetailCrm\Api\Model\Request
*/
namespace RetailCrm\Api\Model\Request;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Interfaces\RequestInterface;
/**
* Class ByAndSiteByRequest
*
* @category ByAndSiteByRequest
* @package RetailCrm\Api\Model\Request
*/
class ByAndSiteByRequest implements RequestInterface
{
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("by")
*/
public $by;
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("siteBy")
*/
public $siteBy;
/**
* BySiteRequest constructor.
*
* @param string $by
* @param string $siteBy
*/
public function __construct(string $by = '', string $siteBy = '')
{
if ('' !== $by) {
$this->by = $by;
}
if ('' !== $siteBy) {
$this->siteBy = $siteBy;
}
}
}

View file

@ -1,39 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category CustomerInteractionCartClearRequest
* @package RetailCrm\Api\Model\Request\CustomerInteraction
*/
namespace RetailCrm\Api\Model\Request\CustomerInteraction;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Interfaces\RequestInterface;
/**
* Class CustomerInteractionCartClearRequest
*
* @category CustomerInteractionCartClearRequest
* @package RetailCrm\Api\Model\Request\CustomerInteraction
*/
class CustomerInteractionCartClearRequest implements RequestInterface
{
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("siteBy")
*/
public $siteBy;
/**
* @var \RetailCrm\Api\Model\Entity\CustomerInteraction\Cart
*
* @Form\Type("RetailCrm\Api\Model\Entity\CustomerInteraction\Cart")
* @Form\SerializedName("cart")
* @Form\JsonField()
*/
public $cart;
}

View file

@ -1,20 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category CustomerInteractionCartSetRequest
* @package RetailCrm\Api\Model\Request\CustomerInteraction
*/
namespace RetailCrm\Api\Model\Request\CustomerInteraction;
/**
* Class CustomerInteractionCartSetRequest
*
* @category CustomerInteractionCartSetRequest
* @package RetailCrm\Api\Model\Request\CustomerInteraction
*/
class CustomerInteractionCartSetRequest extends CustomerInteractionCartClearRequest
{
}

View file

@ -1,39 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category LoyaltyBonusChargeRequest
* @package RetailCrm\Api\Model\Request\Loyalty
*/
namespace RetailCrm\Api\Model\Request\Loyalty;
use DateTime;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Interfaces\RequestInterface;
/**
* Class LoyaltyBonusChargeRequest
*
* @category LoyaltyBonusChargeRequest
* @package RetailCrm\Api\Model\Request\Loyalty
*/
class LoyaltyBonusChargeRequest implements RequestInterface
{
/**
* @var float
*
* @Form\Type("float")
* @Form\SerializedName("amount")
*/
public $amount;
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("comment")
*/
public $comment;
}

View file

@ -1,33 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category OffersRequest
* @package RetailCrm\Api\Model\Request\Store
*/
namespace RetailCrm\Api\Model\Request\Store;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Interfaces\RequestInterface;
use RetailCrm\Api\Model\Request\Traits\PageLimitTrait;
/**
* Class OffersRequest
*
* @category OffersRequest
* @package RetailCrm\Api\Model\Request\Store
*/
class OffersRequest implements RequestInterface
{
use PageLimitTrait;
/**
* @var \RetailCrm\Api\Model\Filter\Store\OfferFilterType
*
* @Form\Type("RetailCrm\Api\Model\Filter\Store\OfferFilterType")
* @Form\SerializedName("filter")
*/
public $filter;
}

View file

@ -23,14 +23,6 @@ class ProductPropertiesRequest implements RequestInterface
{
use PageLimitTrait;
/**
* @var ProductPropertiesSort
*
* @Form\Type("ProductPropertiesSort")
* @Form\SerializedName("sort")
*/
public $sort;
/**
* @var \RetailCrm\Api\Model\Filter\Store\ProductPropertiesFilterType
*

View file

@ -1,31 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category ProductPropertiesRequest
* @package RetailCrm\Api\Model\Request\Store
*/
namespace RetailCrm\Api\Model\Request\Store;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Interfaces\RequestInterface;
use RetailCrm\Api\Model\Request\Traits\PageLimitTrait;
/**
* Class ProductPropertiesSort
*
* @category ProductPropertiesRequest
* @package RetailCrm\Api\Model\Request\Store
*/
class ProductPropertiesSort implements RequestInterface
{
/**
* @var string
*
* @Form\Type("string")
* @Form\SerializedName("offersCount")
*/
public $offersCount;
}

View file

@ -1,33 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category ProductPropertyValuesRequest
* @package RetailCrm\Api\Model\Request\Store
*/
namespace RetailCrm\Api\Model\Request\Store;
use RetailCrm\Api\Component\FormData\Mapping as Form;
use RetailCrm\Api\Interfaces\RequestInterface;
use RetailCrm\Api\Model\Request\Traits\PageLimitTrait;
/**
* Class ProductPropertyValuesRequest
*
* @category ProductPropertyValuesRequest
* @package RetailCrm\Api\Model\Request\Store
*/
class ProductPropertyValuesRequest implements RequestInterface
{
use PageLimitTrait;
/**
* @var \RetailCrm\Api\Model\Filter\Store\ProductPropertyValuesFilterType
*
* @Form\Type("RetailCrm\Api\Model\Filter\Store\ProductPropertyValuesFilterType")
* @Form\SerializedName("filter")
*/
public $filter;
}

View file

@ -1,30 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category CustomerInteractionCartGetResponse
* @package RetailCrm\Api\Model\Response\CustomerInteraction
*/
namespace RetailCrm\Api\Model\Response\CustomerInteraction;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
use RetailCrm\Api\Model\Response\SuccessResponse;
/**
* Class CustomerInteractionCartGetResponse
*
* @category CustomerInteractionCartGetResponse
* @package RetailCrm\Api\Model\Response\CustomerInteraction
*/
class CustomerInteractionCartGetResponse extends SuccessResponse
{
/**
* @var \RetailCrm\Api\Model\Entity\CustomerInteraction\Cart
*
* @JMS\Type("RetailCrm\Api\Model\Entity\CustomerInteraction\Cart")
* @JMS\SerializedName("cart")
*/
public $cart;
}

View file

@ -1,30 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category OffersResponse
* @package RetailCrm\Api\Model\Response\Store
*/
namespace RetailCrm\Api\Model\Response\Store;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
use RetailCrm\Api\Model\Response\AbstractPaginatedResponse;
/**
* Class OffersResponse
*
* @category OffersResponse
* @package RetailCrm\Api\Model\Response\Store
*/
class OffersResponse extends AbstractPaginatedResponse
{
/**
* @var \RetailCrm\Api\Model\Entity\Store\StoreOffer[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Store\StoreOffer>")
* @JMS\SerializedName("offers")
*/
public $offers;
}

View file

@ -1,31 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category ProductPropertyValuesResponse
* @package RetailCrm\Api\Model\Response\Store
*/
namespace RetailCrm\Api\Model\Response\Store;
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
use RetailCrm\Api\Model\Response\AbstractPaginatedResponse;
/**
* Class ProductPropertyValuesResponse
*
* @category ProductPropertyValuesResponse
* @package RetailCrm\Api\Model\Response\Store
* @SuppressWarnings(PHPMD.LongVariable)
*/
class ProductPropertyValuesResponse extends AbstractPaginatedResponse
{
/**
* @var \RetailCrm\Api\Model\Entity\Store\ProductPropertyValue[]
*
* @JMS\Type("array<RetailCrm\Api\Model\Entity\Store\ProductPropertyValue>")
* @JMS\SerializedName("productPropertyValues")
*/
public $productPropertyValues;
}

View file

@ -1,238 +0,0 @@
<?php
/**
* PHP version 7.3
*
* @category CustomerInteraction
* @package RetailCrm\Api\ResourceGroup
*/
namespace RetailCrm\Api\ResourceGroup;
use RetailCrm\Api\Enum\RequestMethod;
use RetailCrm\Api\Model\Request\ByAndSiteByRequest;
use RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartClearRequest;
use RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartSetRequest;
use RetailCrm\Api\Model\Response\CustomerInteraction\CustomerInteractionCartGetResponse;
use RetailCrm\Api\Model\Response\SuccessResponse;
/**
* Class CustomerInteraction
*
* @category CustomerInteraction
* @package RetailCrm\Api\ResourceGroup
*
* @SuppressWarnings(PHPMD.CouplingBetweenObjects)
*/
class CustomerInteraction extends AbstractApiResourceGroup
{
/**
* Makes POST "/api/v5/customer-interaction/{site}/cart/clear" request.
*
* Example:
* ```php
* use RetailCrm\Api\Enum\BySite;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Entity\CustomerInteraction\Cart;
* use RetailCrm\Api\Model\Entity\CustomerInteraction\CartCustomer;
* use RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartClearRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $cart = new Cart();
* $cart->clearedAt = new DateTime('now');
* $cart->customer = new CartCustomer();
* $cart->customer->id = 4770;
* $cart->customer->browserId = 'browserId';
* $cart->customer->gaClientId = 'gaClientId';
*
* $request = new CustomerInteractionCartClearRequest();
* $request->cart = $cart;
* $request->siteBy = BySite::CODE;
*
* try {
* $response = $client->customerInteraction->cartClear('testSite', $request);
* } catch (ApiExceptionInterface $exception) {
* echo sprintf(
* 'Error from RetailCRM API (status code: %d): %s',
* $exception->getStatusCode(),
* $exception->getMessage()
* );
*
* if (count($exception->getErrorResponse()->errors) > 0) {
* echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
* }
*
* return;
* }
* ```
*
* @param \RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartClearRequest $request
* @param string|int $site
*
* @return \RetailCrm\Api\Model\Response\SuccessResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
* @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface
* @throws \RetailCrm\Api\Exception\Api\AccountDoesNotExistException
* @throws \RetailCrm\Api\Exception\Api\ApiErrorException
* @throws \RetailCrm\Api\Exception\Api\MissingCredentialsException
* @throws \RetailCrm\Api\Exception\Api\MissingParameterException
* @throws \RetailCrm\Api\Exception\Api\ValidationException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/
public function cartClear(CustomerInteractionCartClearRequest $request, $site): SuccessResponse
{
/** @var SuccessResponse $response */
$response = $this->sendRequest(
RequestMethod::POST,
'customer-interaction/' . $site . '/cart/clear',
$request,
SuccessResponse::class
);
return $response;
}
/**
* Makes POST "/api/v5/customer-interaction/{site}/cart/set" request.
*
* Example:
* ```php
* use RetailCrm\Api\Enum\BySite;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Entity\CustomerInteraction\Cart;
* use RetailCrm\Api\Model\Entity\CustomerInteraction\CartCustomer;
* use RetailCrm\Api\Model\Entity\CustomerInteraction\CartItem;
* use RetailCrm\Api\Model\Entity\Orders\Items\Offer;
* use RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartSetRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $customer = new CartCustomer();
* $customer->id = 4770;
*
* $cartItem = new CartItem();
* $cartItem->price = 24.99;
* $cartItem->quantity = 2;
* $cartItem->offer = new Offer();
* $cartItem->offer->externalId = '47701234567890';
*
* $cart = new Cart();
* $cart->items[] = $cartItem;
* $cart->customer = $customer;
*
* $request = new CustomerInteractionCartSetRequest();
* $request->cart = $cart;
* $request->siteBy = BySite::CODE;
*
* try {
* $response = $client->customerInteraction->cartSet('testSite', $request);
* } catch (ApiExceptionInterface $exception) {
* echo sprintf(
* 'Error from RetailCRM API (status code: %d): %s',
* $exception->getStatusCode(),
* $exception->getMessage()
* );
*
* if (count($exception->getErrorResponse()->errors) > 0) {
* echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
* }
*
* return;
* }
* ```
*
* @param \RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartSetRequest $request
* @param string|int $site
*
* @return \RetailCrm\Api\Model\Response\SuccessResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
* @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface
* @throws \RetailCrm\Api\Exception\Api\AccountDoesNotExistException
* @throws \RetailCrm\Api\Exception\Api\ApiErrorException
* @throws \RetailCrm\Api\Exception\Api\MissingCredentialsException
* @throws \RetailCrm\Api\Exception\Api\MissingParameterException
* @throws \RetailCrm\Api\Exception\Api\ValidationException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/
public function cartSet(CustomerInteractionCartSetRequest $request, $site): SuccessResponse
{
/** @var SuccessResponse $response */
$response = $this->sendRequest(
RequestMethod::POST,
'customer-interaction/' . $site . '/cart/set',
$request,
SuccessResponse::class
);
return $response;
}
/**
* Makes GET "/api/v5/customer-interaction/{site}/cart/{customerId}" request.
*
* Example:
* ```php
* use RetailCrm\Api\Enum\ByIdentifier;
* use RetailCrm\Api\Enum\BySite;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Request\ByAndSiteByRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* try {
* $response = $client->customerInteraction->cartGet(
* 'testSite',
* 4200,
* new ByAndSiteByRequest(ByIdentifier::ID, BySite::CODE)
* );
* } catch (ApiExceptionInterface $exception) {
* echo sprintf(
* 'Error from RetailCRM API (status code: %d): %s',
* $exception->getStatusCode(),
* $exception->getMessage()
* );
*
* if (count($exception->getErrorResponse()->errors) > 0) {
* echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
* }
*
* return;
* }
*
* echo 'Cart: ' . print_r($response->cart, true);
* ```
*
* @param string|int $site
* @param string|int $customerId
* @param \RetailCrm\Api\Model\Request\ByAndSiteByRequest|null $request
*
* @return \RetailCrm\Api\Model\Response\CustomerInteraction\CustomerInteractionCartGetResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
* @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface
* @throws \RetailCrm\Api\Exception\Api\AccountDoesNotExistException
* @throws \RetailCrm\Api\Exception\Api\ApiErrorException
* @throws \RetailCrm\Api\Exception\Api\MissingCredentialsException
* @throws \RetailCrm\Api\Exception\Api\MissingParameterException
* @throws \RetailCrm\Api\Exception\Api\ValidationException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/
public function cartGet(
$site,
$customerId,
?ByAndSiteByRequest $request = null
): CustomerInteractionCartGetResponse {
/** @var CustomerInteractionCartGetResponse $response */
$response = $this->sendRequest(
RequestMethod::GET,
'customer-interaction/' . $site . '/cart/' . $customerId,
$request,
CustomerInteractionCartGetResponse::class
);
return $response;
}
}

View file

@ -16,7 +16,6 @@ use RetailCrm\Api\Model\Request\Loyalty\LoyaltiesRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountEditRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountsRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusChargeRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusCreditRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
@ -31,7 +30,6 @@ use RetailCrm\Api\Model\Response\Loyalty\LoyaltyBonusCreditResponse;
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyBonusOperationsResponse;
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyCalculateResponse;
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyResponse;
use RetailCrm\Api\Model\Response\SuccessResponse;
/**
* Class Loyalty
@ -165,66 +163,6 @@ class Loyalty extends AbstractApiResourceGroup
return $response;
}
/**
* Makes POST "/api/v5/loyalty/account/{id}/bonus/charge" request.
*
* Example:
* ```php
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusChargeRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $request = new LoyaltyBonusChargeRequest();
* $request->amount = 100;
* $request->comment = 'Payment for the goods.';
*
* try {
* $response = $client->loyalty->accountBonusCharge(159, $request);
* } catch (ApiExceptionInterface $exception) {
* echo sprintf(
* 'Error from RetailCRM API (status code: %d): %s',
* $exception->getStatusCode(),
* $exception->getMessage()
* );
*
* if (count($exception->getErrorResponse()->errors) > 0) {
* echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
* }
*
* return;
* }
*
* echo 'Status: ' . var_export($response->success, true);
* ```
*
* @param int $id
* @param \RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusChargeRequest $request
*
* @return \RetailCrm\Api\Model\Response\Loyalty\LoyaltyBonusCreditResponse
* @throws \RetailCrm\Api\Exception\Api\AccountDoesNotExistException
* @throws \RetailCrm\Api\Exception\Api\ApiErrorException
* @throws \RetailCrm\Api\Exception\Api\MissingCredentialsException
* @throws \RetailCrm\Api\Exception\Api\MissingParameterException
* @throws \RetailCrm\Api\Exception\Api\ValidationException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
* @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface
*/
public function accountBonusCharge(int $id, LoyaltyBonusChargeRequest $request): SuccessResponse
{
/** @var LoyaltyBonusCreditResponse $response */
$response = $this->sendRequest(
RequestMethod::POST,
'loyalty/account/' . $id . '/bonus/charge',
$request,
SuccessResponse::class
);
return $response;
}
/**
* Makes POST "/api/v5/loyalty/account/{id}/bonus/credit" request.
*

View file

@ -12,25 +12,21 @@ namespace RetailCrm\Api\ResourceGroup;
use RetailCrm\Api\Enum\RequestMethod;
use RetailCrm\Api\Model\Request\Store\InventoriesRequest;
use RetailCrm\Api\Model\Request\Store\InventoriesUploadRequest;
use RetailCrm\Api\Model\Request\Store\OffersRequest;
use RetailCrm\Api\Model\Request\Store\PricesUploadRequest;
use RetailCrm\Api\Model\Request\Store\ProductBatchEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertiesRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertyValuesRequest;
use RetailCrm\Api\Model\Request\Store\ProductsBatchCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductsRequest;
use RetailCrm\Api\Model\Response\IdResponse;
use RetailCrm\Api\Model\Response\Store\InventoriesResponse;
use RetailCrm\Api\Model\Response\Store\InventoriesUploadResponse;
use RetailCrm\Api\Model\Response\Store\OffersResponse;
use RetailCrm\Api\Model\Response\Store\PricesUploadResponse;
use RetailCrm\Api\Model\Response\Store\ProductBatchEditResponse;
use RetailCrm\Api\Model\Response\Store\ProductGroupsResponse;
use RetailCrm\Api\Model\Response\Store\ProductPropertiesResponse;
use RetailCrm\Api\Model\Response\Store\ProductPropertyValuesResponse;
use RetailCrm\Api\Model\Response\Store\ProductsBatchCreateResponse;
use RetailCrm\Api\Model\Response\Store\ProductsResponse;
@ -694,126 +690,4 @@ class Store extends AbstractApiResourceGroup
return $response;
}
/**
* Makes GET "/api/v5/store/offers" request.
*
* Example:
* ```php
* use RetailCrm\Api\Enum\NumericBoolean;
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Filter\Store\OfferFilterType;
* use RetailCrm\Api\Model\Request\Store\OffersRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $request = new OffersRequest();
* $request->filter = new OfferFilterType();
* $request->filter->active = NumericBoolean::TRUE;
* $request->filter->name = 'Test Offer';
*
* try {
* $response = $client->store->offers($request);
* } catch (ApiExceptionInterface $exception) {
* echo sprintf(
* 'Error from RetailCRM API (status code: %d): %s',
* $exception->getStatusCode(),
* $exception->getMessage()
* );
*
* if (count($exception->getErrorResponse()->errors) > 0) {
* echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
* }
*
* return;
* }
*
* echo 'Offers: ' . print_r($response->offers, true);
* ```
*
* @param \RetailCrm\Api\Model\Request\Store\OffersRequest|null $request
*
* @return \RetailCrm\Api\Model\Response\Store\OffersResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
* @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface
* @throws \RetailCrm\Api\Exception\Api\AccountDoesNotExistException
* @throws \RetailCrm\Api\Exception\Api\ApiErrorException
* @throws \RetailCrm\Api\Exception\Api\MissingCredentialsException
* @throws \RetailCrm\Api\Exception\Api\MissingParameterException
* @throws \RetailCrm\Api\Exception\Api\ValidationException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/
public function offers(?OffersRequest $request = null): OffersResponse
{
/** @var OffersResponse $response */
$response = $this->sendRequest(
RequestMethod::GET,
'store/offers',
$request,
OffersResponse::class
);
return $response;
}
/**
* Makes GET "/api/v5/store/products/properties/values" request.
*
* Example:
* ```php
* use RetailCrm\Api\Factory\SimpleClientFactory;
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
* use RetailCrm\Api\Model\Filter\Store\ProductPropertiesFilterType;
* use RetailCrm\Api\Model\Request\Store\ProductPropertiesRequest;
*
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
*
* $request = new ProductPropertyValuesRequest();
* $request->filter = new ProductPropertyValuesFilterType();
* $request->filter->propertyCode = 'property_code';
*
* try {
* $response = $client->store->productsPropertyValues($request);
* } catch (ApiExceptionInterface $exception) {
* echo sprintf(
* 'Error from RetailCRM API (status code: %d): %s',
* $exception->getStatusCode(),
* $exception->getMessage()
* );
*
* if (count($exception->getErrorResponse()->errors) > 0) {
* echo PHP_EOL . 'Errors: ' . implode(', ', $exception->getErrorResponse()->errors);
* }
*
* return;
* }
*
* echo 'Product property values: ' . print_r($response->productPropertyValues, true);
* ```
*
* @param \RetailCrm\Api\Model\Request\Store\ProductPropertyValuesRequest|null $request
*
* @return \RetailCrm\Api\Model\Response\Store\ProductPropertyValuesResponse
* @throws \RetailCrm\Api\Interfaces\ApiExceptionInterface
* @throws \RetailCrm\Api\Interfaces\ClientExceptionInterface
* @throws \RetailCrm\Api\Exception\Api\AccountDoesNotExistException
* @throws \RetailCrm\Api\Exception\Api\ApiErrorException
* @throws \RetailCrm\Api\Exception\Api\MissingCredentialsException
* @throws \RetailCrm\Api\Exception\Api\MissingParameterException
* @throws \RetailCrm\Api\Exception\Api\ValidationException
* @throws \RetailCrm\Api\Exception\Client\HandlerException
* @throws \RetailCrm\Api\Exception\Client\HttpClientException
*/
public function productsPropertyValues(?ProductPropertyValuesRequest $request = null): ProductPropertyValuesResponse
{
/** @var ProductPropertyValuesResponse $response */
$response = $this->sendRequest(
RequestMethod::GET,
'store/products/properties/values',
$request,
ProductPropertyValuesResponse::class
);
return $response;
}
}

View file

@ -27,7 +27,7 @@ trait EventDispatcherAwareTrait
*
* @param \Psr\EventDispatcher\EventDispatcherInterface|null $eventDispatcher
*
* @return static
* @return object
*/
public function setEventDispatcher(?EventDispatcherInterface $eventDispatcher): object
{

View file

@ -1,138 +0,0 @@
<?php
namespace RetailCrm\Tests\ResourceGroup;
use DateTime;
use RetailCrm\Api\Enum\ByIdentifier;
use RetailCrm\Api\Enum\BySite;
use RetailCrm\Api\Enum\RequestMethod;
use RetailCrm\Api\Model\Entity\CustomerInteraction\Cart;
use RetailCrm\Api\Model\Entity\CustomerInteraction\CartCustomer;
use RetailCrm\Api\Model\Entity\CustomerInteraction\CartItem;
use RetailCrm\Api\Model\Entity\Orders\Items\Offer;
use RetailCrm\Api\Model\Request\ByAndSiteByRequest;
use RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartClearRequest;
use RetailCrm\Api\Model\Request\CustomerInteraction\CustomerInteractionCartSetRequest;
use RetailCrm\TestUtils\Factory\TestClientFactory;
use RetailCrm\TestUtils\TestCase\AbstractApiResourceGroupTestCase;
class CustomerInteractionTest extends AbstractApiResourceGroupTestCase
{
public static function testCustomerInteractionCartClear(): void
{
$json = <<<'EOF'
{
"success": true
}
EOF;
$cart = new Cart();
$cart->clearedAt = new DateTime('now');
$cart->customer = new CartCustomer();
$cart->customer->id = 4770;
$cart->customer->browserId = 'browserId';
$cart->customer->gaClientId = 'gaClientId';
$request = new CustomerInteractionCartClearRequest();
$request->cart = $cart;
$request->siteBy = BySite::CODE;
$mock = static::createApiMockBuilder('customer-interaction/testSite/cart/clear');
$mock->matchMethod(RequestMethod::POST)
->matchPath('/api/v5/customer-interaction/testSite/cart/clear')
->matchBody(static::encodeForm($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->customerInteraction->cartClear($request, 'testSite');
self::assertModelEqualsToResponse($json, $response);
}
public static function testCustomerInteractionCartSet(): void
{
$json = <<<'EOF'
{
"success": true
}
EOF;
$customer = new CartCustomer();
$customer->id = 4770;
$cartItem = new CartItem();
$cartItem->price = 24.99;
$cartItem->quantity = 2;
$cartItem->offer = new Offer();
$cartItem->offer->externalId = '47701234567890';
$cart = new Cart();
$cart->items[] = $cartItem;
$cart->customer = $customer;
$request = new CustomerInteractionCartSetRequest();
$request->cart = $cart;
$request->siteBy = BySite::CODE;
$mock = static::createApiMockBuilder('customer-interaction/testSite/cart/set');
$mock->matchMethod(RequestMethod::POST)
->matchPath('/api/v5/customer-interaction/testSite/cart/set')
->matchBody(static::encodeForm($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->customerInteraction->cartSet($request, 'testSite');
self::assertModelEqualsToResponse($json, $response);
}
public static function testCustomerInteractionCartGet(): void
{
$json = <<<'EOF'
{
"success": true,
"cart": {
"externalId": "12345678901234",
"droppedAt": "2024-05-08 15:10:30-05:00",
"link": "https:/shop.myshopify.com/recover?key=1234",
"items": [
{
"id": "1",
"offer": {
"displayName": "Some sample product",
"id": 11,
"externalId": "01234567890123",
"name": "Some sample product",
"vatRate": "20.00",
"properties": [],
"unit": {
"code": "pc",
"name": "Piece",
"sym": "pc"
}
},
"quantity": 2,
"price": 24.99
}
],
"currency": "EUR"
}
}
EOF;
$request = new ByAndSiteByRequest(ByIdentifier::ID, BySite::CODE);
$mock = static::createApiMockBuilder('customer-interaction/testSite/cart/4770');
$mock->matchMethod(RequestMethod::GET)
->matchPath('/api/v5/customer-interaction/testSite/cart/4770')
->matchQuery(static::encodeFormArray($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->customerInteraction->cartGet('testSite', 4770, $request);
self::assertModelEqualsToResponse($json, $response);
}
}

View file

@ -180,33 +180,6 @@ class CustomersTest extends AbstractApiResourceGroupTestCase
"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,
@ -2697,33 +2670,6 @@ EOF;
"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,

View file

@ -38,7 +38,6 @@ use RetailCrm\Api\Model\Request\Loyalty\LoyaltiesRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountEditRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountsRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusChargeRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusCreditRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
@ -122,29 +121,6 @@ EOF;
self::assertModelEqualsToResponse($json, $response);
}
public function testAccountBonusCharge(): void
{
$json = <<<EOF
{
"success": true
}
EOF;
$request = new LoyaltyBonusChargeRequest();
$request->amount = 100;
$request->comment = 'Monthly membership bonuses.';
$mock = static::createApiMockBuilder('loyalty/account/159/bonus/charge');
$mock->matchMethod(RequestMethod::POST)
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->loyalty->accountBonusCharge(159, $request);
self::assertModelEqualsToResponse($json, $response);
}
public function testAccountBonusCredit(): void
{
$activationDate = new DateTime();

View file

@ -99,7 +99,6 @@ EOF;
$invoiceRequest->paymentId = 'd6458333-fff3-4fd0-9b23-4e6344451f8e';
$invoiceRequest->invoiceUuid = '5b1b2e9d-b7f1-48f4-acb9-4bfce04b30cf';
$invoiceRequest->invoiceUrl = 'https://example.com/newUrl';
$invoiceRequest->discountAmount = 20.0;
$request = new PaymentUpdateInvoiceRequest($invoiceRequest);

View file

@ -22,22 +22,17 @@ use RetailCrm\Api\Model\Entity\Store\ProductEditGroupInput;
use RetailCrm\Api\Model\Entity\Store\ProductEditInput;
use RetailCrm\Api\Model\Entity\Store\SerializedProductGroup;
use RetailCrm\Api\Model\Filter\Store\InventoryFilterType;
use RetailCrm\Api\Model\Filter\Store\OfferFilterType;
use RetailCrm\Api\Model\Filter\Store\ProductFilterType;
use RetailCrm\Api\Model\Filter\Store\ProductGroupFilterType;
use RetailCrm\Api\Model\Filter\Store\ProductPropertiesFilterType;
use RetailCrm\Api\Model\Filter\Store\ProductPropertyValuesFilterType;
use RetailCrm\Api\Model\Request\Store\InventoriesRequest;
use RetailCrm\Api\Model\Request\Store\InventoriesUploadRequest;
use RetailCrm\Api\Model\Request\Store\OffersRequest;
use RetailCrm\Api\Model\Request\Store\PricesUploadRequest;
use RetailCrm\Api\Model\Request\Store\ProductBatchEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsEditRequest;
use RetailCrm\Api\Model\Request\Store\ProductGroupsRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertiesRequest;
use RetailCrm\Api\Model\Request\Store\ProductPropertiesSort;
use RetailCrm\Api\Model\Request\Store\ProductPropertyValuesRequest;
use RetailCrm\Api\Model\Request\Store\ProductsBatchCreateRequest;
use RetailCrm\Api\Model\Request\Store\ProductsRequest;
use RetailCrm\TestUtils\Factory\TestClientFactory;
@ -621,14 +616,10 @@ EOF;
EOF;
$request = new ProductPropertiesRequest();
$request->sort = new ProductPropertiesSort();
$request->sort->offersCount = 'desc';
$request->filter = new ProductPropertiesFilterType();
$request->filter->sites = ['moysklad', 'aliexpress'];
$request->filter->visible = NumericBoolean::TRUE;
$request->filter->variative = NumericBoolean::TRUE;
$request->filter->groups = [3676, 3679, 3680, 3724];
$mock = static::createApiMockBuilder('store/products/properties');
$mock->matchMethod(RequestMethod::GET)
@ -787,186 +778,4 @@ EOF;
self::assertModelEqualsToResponse($json, $response);
}
public function testProductPropertyValues(): void
{
$json = <<<'EOF'
{
"success": true,
"pagination": {
"limit": 20,
"totalCount": 1,
"currentPage": 1,
"totalPageCount": 1
},
"productPropertyValues": [
{
"property": {
"sites": [
"e-mapper",
"sendpulse",
"glavpunkt",
"retailcrm-services-peshkariki",
"vk-com",
"moysklad",
"eftestshop-ru"
],
"groups": [
{
"id": 3676,
"name": "warehouseRoot"
},
{
"id": 3679,
"name": "Входящая в группу"
},
{
"id": 3680,
"name": "test"
},
{
"id": 3724,
"name": "Услуги"
}
],
"code": "code",
"name": "Код",
"isNumeric": false,
"visible": true,
"variative": true
},
"value": "testValue",
"offersCount": 10
}
]
}
EOF;
$request = new ProductPropertyValuesRequest();
$request->filter = new ProductPropertyValuesFilterType();
$request->filter->propertyName = "testName";
$request->filter->propertyCode = "testCode";
$request->filter->groups = [1, 2, 3];
$mock = static::createApiMockBuilder('store/products/properties/values');
$mock->matchMethod(RequestMethod::GET)
->matchQuery(self::encodeFormArray($request))
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->store->productsPropertyValues($request);
self::assertModelEqualsToResponse($json, $response);
}
public function testOffers(): void
{
$json = <<<'EOF'
{
"success": true,
"pagination": {
"limit": 20,
"totalCount": 1,
"currentPage": 1,
"totalPageCount": 1
},
"offers": [
{
"name": "Test Offer",
"images": [
"https://example.com/image.jpg"
],
"id": 1941833,
"externalId": "38311",
"xmlId": "38311",
"article": "38311",
"prices": [
{
"priceType": "base",
"price": 624,
"ordering": 991
}
],
"purchasePrice": 272.64,
"vatRate": "none",
"properties": {
"ves": "33",
"brend": "Test",
"image": "https://example.com/image.jpg",
"ves_g": "33",
"artikul": "38311"
},
"quantity": 0.0,
"weight": 33.0,
"active": true,
"unit": {
"code": "pc",
"name": "Штука",
"sym": "шт."
},
"product": {
"minPrice": 624,
"maxPrice": 624,
"id": 828272,
"article": "38311",
"type": "product",
"name": "Test Product",
"url": "https://example.com",
"imageUrl": "https://example.com/image.jpg",
"description": "Test Description",
"groups": [
{
"id": 4050,
"externalId": "368"
},
{
"id": 4154,
"externalId": "391"
},
{
"id": 4279,
"externalId": "394"
}
],
"externalId": "38311",
"manufacturer": "Test",
"active": true,
"quantity": 0,
"markable": false
}
}
]
}
EOF;
$request = new OffersRequest();
$request->filter = new OfferFilterType();
$request->filter->active = NumericBoolean::TRUE;
$request->filter->minPrice = 1;
$request->filter->maxPrice = 120000;
$request->filter->sites = ['main'];
$request->filter->maxQuantity = 5;
$request->filter->catalogs = [2];
$mock = static::createApiMockBuilder('store/offers');
$mock->matchMethod(RequestMethod::GET)
->matchQuery([
'filter' => [
'sites' => ['main'],
'catalogs' => ['2'],
'active' => '1',
'minPrice' => '1',
'maxPrice' => '120000',
'maxQuantity' => '5',
]
])
->reply(200)
->withBody($json);
$client = TestClientFactory::createClient($mock->getClient());
$response = $client->store->offers($request);
self::assertModelEqualsToResponse($json, $response);
}
}