Compare commits
29 commits
Author | SHA1 | Date | |
---|---|---|---|
fc78e5897b | |||
|
0a862dd86b | ||
5a3547894a | |||
1d05f3efeb | |||
831ed64871 | |||
502a0c8641 | |||
4a99094294 | |||
|
c379815f76 | ||
27e9e8eaa5 | |||
|
c21a89c761 | ||
068a9d0e0b | |||
|
1881dd3499 | ||
|
47edbda927 | ||
|
91c3ca8ce5 | ||
|
6d05a1af3f | ||
|
16cdc6ce49 | ||
cdca2b6d6d | |||
|
ecaac435cc | ||
|
e3cc485873 | ||
4880ed9930 | |||
7b393e961b | |||
3a3d00aeb8 | |||
60624dad9b | |||
121dcebb32 | |||
|
80396691dd | ||
|
3d5e3e92e6 | ||
|
6130b265fe | ||
|
da8ce13736 | ||
|
a7d071af28 |
26 changed files with 555 additions and 14 deletions
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
@ -17,24 +17,30 @@ jobs:
|
||||||
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
|
php-version: ['7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code into the workspace
|
- name: Check out code into the workspace
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Setup PHP ${{ matrix.php-version }}
|
- name: Setup PHP ${{ matrix.php-version }}
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php-version }}
|
php-version: ${{ matrix.php-version }}
|
||||||
coverage: pcov
|
coverage: pcov
|
||||||
|
|
||||||
- name: Composer cache
|
- name: Composer cache
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: ${{ env.HOME }}/.composer/cache
|
path: ${{ env.HOME }}/.composer/cache
|
||||||
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install -o
|
run: composer install -o
|
||||||
|
|
||||||
- name: Configure matchers
|
- name: Configure matchers
|
||||||
uses: mheap/phpunit-matcher-action@v1
|
uses: mheap/phpunit-matcher-action@v1
|
||||||
|
|
||||||
- name: Run tests
|
- name: Run tests
|
||||||
run: composer run-script phpunit-ci
|
run: composer run-script phpunit-ci
|
||||||
|
|
||||||
- name: Coverage
|
- name: Coverage
|
||||||
uses: codecov/codecov-action@v2
|
uses: codecov/codecov-action@v4
|
||||||
with:
|
with:
|
||||||
verbose: true
|
verbose: true
|
||||||
|
|
6
.github/workflows/code_quality.yml
vendored
6
.github/workflows/code_quality.yml
vendored
|
@ -13,7 +13,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code into the workspace
|
- name: Check out code into the workspace
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
- name: Run PHPCS
|
- name: Run PHPCS
|
||||||
uses: chekalsky/phpcs-action@v1
|
uses: chekalsky/phpcs-action@v1
|
||||||
phpmd:
|
phpmd:
|
||||||
|
@ -21,7 +21,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code into the workspace
|
- name: Check out code into the workspace
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
- name: Run PHPMD
|
- name: Run PHPMD
|
||||||
uses: GeneaLabs/action-reviewdog-phpmd@1.0.0
|
uses: GeneaLabs/action-reviewdog-phpmd@1.0.0
|
||||||
with:
|
with:
|
||||||
|
@ -35,7 +35,7 @@ jobs:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out code into the workspace
|
- name: Check out code into the workspace
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
- name: Run PHPStan
|
- name: Run PHPStan
|
||||||
uses: docker://oskarstark/phpstan-ga:1.8.0
|
uses: docker://oskarstark/phpstan-ga:1.8.0
|
||||||
with:
|
with:
|
||||||
|
|
4
.github/workflows/documentation.yml
vendored
4
.github/workflows/documentation.yml
vendored
|
@ -19,7 +19,7 @@ jobs:
|
||||||
pages_threshold: major_outage
|
pages_threshold: major_outage
|
||||||
- name: Check out code into the workspace
|
- name: Check out code into the workspace
|
||||||
if: success() && ${{ github.ref != 'refs/heads/master' }}
|
if: success() && ${{ github.ref != 'refs/heads/master' }}
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
- name: Setup PHP 8.3
|
- name: Setup PHP 8.3
|
||||||
if: ${{ github.ref != 'refs/heads/master' }}
|
if: ${{ github.ref != 'refs/heads/master' }}
|
||||||
uses: shivammathur/setup-php@v2
|
uses: shivammathur/setup-php@v2
|
||||||
|
@ -27,7 +27,7 @@ jobs:
|
||||||
php-version: "8.3"
|
php-version: "8.3"
|
||||||
- name: Cache phpDocumentor
|
- name: Cache phpDocumentor
|
||||||
id: cache-phpdocumentor
|
id: cache-phpdocumentor
|
||||||
uses: actions/cache@v2
|
uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
path: phpDocumentor.phar
|
path: phpDocumentor.phar
|
||||||
key: phpdocumentor
|
key: phpdocumentor
|
||||||
|
|
|
@ -23,19 +23,19 @@
|
||||||
"psr/http-message": "^1.0 || ^2.0",
|
"psr/http-message": "^1.0 || ^2.0",
|
||||||
"psr/http-message-implementation": "^1.0",
|
"psr/http-message-implementation": "^1.0",
|
||||||
"php-http/client-implementation": "^1.0",
|
"php-http/client-implementation": "^1.0",
|
||||||
"php-http/message-factory": "^1.0",
|
|
||||||
"php-http/discovery": "^1.13",
|
"php-http/discovery": "^1.13",
|
||||||
"doctrine/annotations": "^1.13|^2.0",
|
"doctrine/annotations": "^1.13|^2.0",
|
||||||
"liip/serializer": "2.2.* || 2.6.*",
|
"liip/serializer": "2.2.* || 2.6.*",
|
||||||
"php-http/httplug": "^2.2",
|
"php-http/httplug": "^2.2",
|
||||||
"civicrm/composer-compile-plugin": "^0.20",
|
"civicrm/composer-compile-plugin": "^0.20",
|
||||||
"symfony/console": "^4.0|^5.0|^6.0",
|
"symfony/console": "^4.0|^5.0|^6.0|^7.0",
|
||||||
"psr/event-dispatcher": "^1.0",
|
"psr/event-dispatcher": "^1.0",
|
||||||
"neur0toxine/psr.http-client-implementation.php-http-curl": "*",
|
"neur0toxine/psr.http-client-implementation.php-http-curl": "*",
|
||||||
"neur0toxine/psr.http-factory-implementation.nyholm": "*",
|
"neur0toxine/psr.http-factory-implementation.nyholm": "*",
|
||||||
"neur0toxine/psr.http-message-implementation.nyholm": "*",
|
"neur0toxine/psr.http-message-implementation.nyholm": "*",
|
||||||
"psr/cache": "^1.0 || ^2.0 || ^3.0",
|
"psr/cache": "^1.0 || ^2.0 || ^3.0",
|
||||||
"symfony/cache": ">=v3.1.0"
|
"symfony/cache": ">=v3.1.0",
|
||||||
|
"psr/http-factory": "^1.1"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"squizlabs/php_codesniffer": "^3.5",
|
"squizlabs/php_codesniffer": "^3.5",
|
||||||
|
|
|
@ -285,6 +285,7 @@ class ClientFactory implements ClientFactoryInterface, EventDispatcherAwareInter
|
||||||
->setStreamFactory($this->streamFactory)
|
->setStreamFactory($this->streamFactory)
|
||||||
->setRequestFactory($this->requestFactory)
|
->setRequestFactory($this->requestFactory)
|
||||||
->setUriFactory($this->uriFactory)
|
->setUriFactory($this->uriFactory)
|
||||||
|
->setEventDispatcher($this->eventDispatcher)
|
||||||
->appendRequestHandlers($this->requestHandlers)
|
->appendRequestHandlers($this->requestHandlers)
|
||||||
->appendResponseHandlers($this->responseHandlers)
|
->appendResponseHandlers($this->responseHandlers)
|
||||||
->build();
|
->build();
|
||||||
|
|
|
@ -369,6 +369,14 @@ class Customer implements CustomerInterface
|
||||||
*/
|
*/
|
||||||
public $subscribed;
|
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[]
|
* @var \RetailCrm\Api\Model\Entity\Customers\MGCustomer[]
|
||||||
*
|
*
|
||||||
|
|
46
src/Model/Entity/Customers/CustomerSubscription.php
Normal file
46
src/Model/Entity/Customers/CustomerSubscription.php
Normal file
|
@ -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
src/Model/Entity/Customers/SubscriptionCategory.php
Normal file
77
src/Model/Entity/Customers/SubscriptionCategory.php
Normal file
|
@ -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;
|
||||||
|
}
|
|
@ -0,0 +1,45 @@
|
||||||
|
<?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;
|
||||||
|
}
|
|
@ -74,4 +74,12 @@ class Integrations
|
||||||
* @JMS\SerializedName("mgBot")
|
* @JMS\SerializedName("mgBot")
|
||||||
*/
|
*/
|
||||||
public $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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,14 @@ class ApiUpdateInvoiceRequest
|
||||||
*/
|
*/
|
||||||
public $amount;
|
public $amount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*
|
||||||
|
* @JMS\Type("float")
|
||||||
|
* @JMS\SerializedName("discountAmount")
|
||||||
|
*/
|
||||||
|
public $discountAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
|
|
|
@ -91,6 +91,14 @@ class Store
|
||||||
*/
|
*/
|
||||||
public $phone;
|
public $phone;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("contact")
|
||||||
|
*/
|
||||||
|
public $contact;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
|
|
|
@ -36,6 +36,14 @@ class Product
|
||||||
*/
|
*/
|
||||||
public $maxPrice;
|
public $maxPrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("catalogId")
|
||||||
|
*/
|
||||||
|
public $catalogId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*
|
*
|
||||||
|
|
|
@ -170,4 +170,12 @@ class ProductOffer
|
||||||
* @JMS\SerializedName("barcode")
|
* @JMS\SerializedName("barcode")
|
||||||
*/
|
*/
|
||||||
public $barcode;
|
public $barcode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("site")
|
||||||
|
*/
|
||||||
|
public $site;
|
||||||
}
|
}
|
||||||
|
|
|
@ -494,4 +494,12 @@ class CustomerFilter
|
||||||
* @Form\SerializedName("attachedTags")
|
* @Form\SerializedName("attachedTags")
|
||||||
*/
|
*/
|
||||||
public $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
src/Model/Filter/Customers/CustomerSubscriptionFilter.php
Normal file
45
src/Model/Filter/Customers/CustomerSubscriptionFilter.php
Normal file
|
@ -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;
|
||||||
|
}
|
|
@ -357,4 +357,12 @@ class CustomerCorporateFilter
|
||||||
* @Form\SerializedName("companyName")
|
* @Form\SerializedName("companyName")
|
||||||
*/
|
*/
|
||||||
public $companyName;
|
public $companyName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array<string, mixed>
|
||||||
|
*
|
||||||
|
* @Form\Type("array")
|
||||||
|
* @Form\SerializedName("customFields")
|
||||||
|
*/
|
||||||
|
public $customFields;
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,6 +68,14 @@ class OfferFilterType
|
||||||
*/
|
*/
|
||||||
public $sites;
|
public $sites;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int[]
|
||||||
|
*
|
||||||
|
* @Form\Type("int[]")
|
||||||
|
* @Form\SerializedName("catalogs")
|
||||||
|
*/
|
||||||
|
public $catalogs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*
|
*
|
||||||
|
@ -83,4 +91,52 @@ class OfferFilterType
|
||||||
* @Form\SerializedName("sinceId")
|
* @Form\SerializedName("sinceId")
|
||||||
*/
|
*/
|
||||||
public $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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -124,6 +124,14 @@ class ProductFilterType
|
||||||
*/
|
*/
|
||||||
public $url;
|
public $url;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @Form\Type("string")
|
||||||
|
* @Form\SerializedName("urlLike")
|
||||||
|
*/
|
||||||
|
public $urlLike;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
|
|
39
src/Model/Request/Loyalty/LoyaltyBonusChargeRequest.php
Normal file
39
src/Model/Request/Loyalty/LoyaltyBonusChargeRequest.php
Normal file
|
@ -0,0 +1,39 @@
|
||||||
|
<?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;
|
||||||
|
}
|
|
@ -16,6 +16,7 @@ use RetailCrm\Api\Model\Request\Loyalty\LoyaltiesRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountEditRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountsRequest;
|
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\LoyaltyBonusCreditRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
|
||||||
|
@ -30,6 +31,7 @@ use RetailCrm\Api\Model\Response\Loyalty\LoyaltyBonusCreditResponse;
|
||||||
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyBonusOperationsResponse;
|
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyBonusOperationsResponse;
|
||||||
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyCalculateResponse;
|
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyCalculateResponse;
|
||||||
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyResponse;
|
use RetailCrm\Api\Model\Response\Loyalty\LoyaltyResponse;
|
||||||
|
use RetailCrm\Api\Model\Response\SuccessResponse;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class Loyalty
|
* Class Loyalty
|
||||||
|
@ -163,6 +165,66 @@ class Loyalty extends AbstractApiResourceGroup
|
||||||
return $response;
|
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.
|
* Makes POST "/api/v5/loyalty/account/{id}/bonus/credit" request.
|
||||||
*
|
*
|
||||||
|
|
|
@ -27,7 +27,7 @@ trait EventDispatcherAwareTrait
|
||||||
*
|
*
|
||||||
* @param \Psr\EventDispatcher\EventDispatcherInterface|null $eventDispatcher
|
* @param \Psr\EventDispatcher\EventDispatcherInterface|null $eventDispatcher
|
||||||
*
|
*
|
||||||
* @return object
|
* @return static
|
||||||
*/
|
*/
|
||||||
public function setEventDispatcher(?EventDispatcherInterface $eventDispatcher): object
|
public function setEventDispatcher(?EventDispatcherInterface $eventDispatcher): object
|
||||||
{
|
{
|
||||||
|
|
|
@ -180,6 +180,33 @@ class CustomersTest extends AbstractApiResourceGroupTestCase
|
||||||
"number": "89229112322"
|
"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": [
|
"mgCustomers": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
|
@ -2670,6 +2697,33 @@ EOF;
|
||||||
"number": "+79094055044"
|
"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": [
|
"mgCustomers": [
|
||||||
{
|
{
|
||||||
"id": 1,
|
"id": 1,
|
||||||
|
|
|
@ -38,6 +38,7 @@ use RetailCrm\Api\Model\Request\Loyalty\LoyaltiesRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountCreateRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountEditRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyAccountsRequest;
|
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\LoyaltyBonusCreditRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyBonusOperationsRequest;
|
||||||
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
|
use RetailCrm\Api\Model\Request\Loyalty\LoyaltyCalculateRequest;
|
||||||
|
@ -121,6 +122,29 @@ EOF;
|
||||||
self::assertModelEqualsToResponse($json, $response);
|
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
|
public function testAccountBonusCredit(): void
|
||||||
{
|
{
|
||||||
$activationDate = new DateTime();
|
$activationDate = new DateTime();
|
||||||
|
|
|
@ -99,6 +99,7 @@ EOF;
|
||||||
$invoiceRequest->paymentId = 'd6458333-fff3-4fd0-9b23-4e6344451f8e';
|
$invoiceRequest->paymentId = 'd6458333-fff3-4fd0-9b23-4e6344451f8e';
|
||||||
$invoiceRequest->invoiceUuid = '5b1b2e9d-b7f1-48f4-acb9-4bfce04b30cf';
|
$invoiceRequest->invoiceUuid = '5b1b2e9d-b7f1-48f4-acb9-4bfce04b30cf';
|
||||||
$invoiceRequest->invoiceUrl = 'https://example.com/newUrl';
|
$invoiceRequest->invoiceUrl = 'https://example.com/newUrl';
|
||||||
|
$invoiceRequest->discountAmount = 20.0;
|
||||||
|
|
||||||
$request = new PaymentUpdateInvoiceRequest($invoiceRequest);
|
$request = new PaymentUpdateInvoiceRequest($invoiceRequest);
|
||||||
|
|
||||||
|
|
|
@ -943,11 +943,24 @@ EOF;
|
||||||
$request = new OffersRequest();
|
$request = new OffersRequest();
|
||||||
$request->filter = new OfferFilterType();
|
$request->filter = new OfferFilterType();
|
||||||
$request->filter->active = NumericBoolean::TRUE;
|
$request->filter->active = NumericBoolean::TRUE;
|
||||||
$request->filter->name = 'Test Offer';
|
$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 = static::createApiMockBuilder('store/offers');
|
||||||
$mock->matchMethod(RequestMethod::GET)
|
$mock->matchMethod(RequestMethod::GET)
|
||||||
->matchQuery(self::encodeFormArray($request))
|
->matchQuery([
|
||||||
|
'filter' => [
|
||||||
|
'sites' => ['main'],
|
||||||
|
'catalogs' => ['2'],
|
||||||
|
'active' => '1',
|
||||||
|
'minPrice' => '1',
|
||||||
|
'maxPrice' => '120000',
|
||||||
|
'maxQuantity' => '5',
|
||||||
|
]
|
||||||
|
])
|
||||||
->reply(200)
|
->reply(200)
|
||||||
->withBody($json);
|
->withBody($json);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue