Compare commits
No commits in common. "master" and "v6.15.4" have entirely different histories.
28 changed files with 19 additions and 570 deletions
12
.github/workflows/ci.yml
vendored
12
.github/workflows/ci.yml
vendored
|
@ -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
|
||||
|
|
6
.github/workflows/code_quality.yml
vendored
6
.github/workflows/code_quality.yml
vendored
|
@ -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:
|
||||
|
|
4
.github/workflows/documentation.yml
vendored
4
.github/workflows/documentation.yml
vendored
|
@ -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
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -116,14 +116,6 @@ class CustomField
|
|||
*/
|
||||
public $viewMode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("viewModeMobile")
|
||||
*/
|
||||
public $viewModeMobile;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
|
|
|
@ -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[]
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -43,14 +43,6 @@ class ApiUpdateInvoiceRequest
|
|||
*/
|
||||
public $amount;
|
||||
|
||||
/**
|
||||
* @var float
|
||||
*
|
||||
* @JMS\Type("float")
|
||||
* @JMS\SerializedName("discountAmount")
|
||||
*/
|
||||
public $discountAmount;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
|
|
|
@ -91,14 +91,6 @@ class Store
|
|||
*/
|
||||
public $phone;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("contact")
|
||||
*/
|
||||
public $contact;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
|
|
|
@ -36,14 +36,6 @@ class Product
|
|||
*/
|
||||
public $maxPrice;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
* @JMS\Type("int")
|
||||
* @JMS\SerializedName("catalogId")
|
||||
*/
|
||||
public $catalogId;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
|
|
|
@ -170,12 +170,4 @@ class ProductOffer
|
|||
* @JMS\SerializedName("barcode")
|
||||
*/
|
||||
public $barcode;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @JMS\Type("string")
|
||||
* @JMS\SerializedName("site")
|
||||
*/
|
||||
public $site;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -357,12 +357,4 @@ class CustomerCorporateFilter
|
|||
* @Form\SerializedName("companyName")
|
||||
*/
|
||||
public $companyName;
|
||||
|
||||
/**
|
||||
* @var array<string, mixed>
|
||||
*
|
||||
* @Form\Type("array")
|
||||
* @Form\SerializedName("customFields")
|
||||
*/
|
||||
public $customFields;
|
||||
}
|
||||
|
|
|
@ -68,14 +68,6 @@ class OfferFilterType
|
|||
*/
|
||||
public $sites;
|
||||
|
||||
/**
|
||||
* @var int[]
|
||||
*
|
||||
* @Form\Type("int[]")
|
||||
* @Form\SerializedName("catalogs")
|
||||
*/
|
||||
public $catalogs;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*
|
||||
|
@ -91,52 +83,4 @@ class OfferFilterType
|
|||
* @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;
|
||||
}
|
||||
|
|
|
@ -124,14 +124,6 @@ class ProductFilterType
|
|||
*/
|
||||
public $url;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
* @Form\Type("string")
|
||||
* @Form\SerializedName("urlLike")
|
||||
*/
|
||||
public $urlLike;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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.
|
||||
*
|
||||
|
|
|
@ -27,7 +27,7 @@ trait EventDispatcherAwareTrait
|
|||
*
|
||||
* @param \Psr\EventDispatcher\EventDispatcherInterface|null $eventDispatcher
|
||||
*
|
||||
* @return static
|
||||
* @return object
|
||||
*/
|
||||
public function setEventDispatcher(?EventDispatcherInterface $eventDispatcher): object
|
||||
{
|
||||
|
|
|
@ -293,13 +293,12 @@ EOF;
|
|||
$field->name = 'Description';
|
||||
$field->code = 'description';
|
||||
$field->type = CustomFieldType::STRING;
|
||||
$field->inList = true;
|
||||
$field->viewMode = CustomFieldViewMode::EDITABLE;
|
||||
$field->inFilter = true;
|
||||
$field->ordering = 10;
|
||||
$field->displayArea = CustomFieldDisplayArea::CUSTOMER;
|
||||
$field->viewMode = CustomFieldViewMode::EDITABLE;
|
||||
$field->inFilter = true;
|
||||
$field->inList = true;
|
||||
$field->inGroupActions = true;
|
||||
$field->viewModeMobile = CustomFieldViewMode::NOT_EDITABLE;
|
||||
|
||||
$request = new CustomFieldsCreateRequest($field);
|
||||
|
||||
|
@ -360,12 +359,11 @@ EOF;
|
|||
$field = new CustomField();
|
||||
$field->name = 'Description';
|
||||
$field->type = CustomFieldType::STRING;
|
||||
$field->inList = true;
|
||||
$field->ordering = 10;
|
||||
$field->inFilter = true;
|
||||
$field->viewMode = CustomFieldViewMode::EDITABLE;
|
||||
$field->inFilter = true;
|
||||
$field->inList = true;
|
||||
$field->inGroupActions = true;
|
||||
$field->viewModeMobile = CustomFieldViewMode::NOT_EDITABLE;
|
||||
|
||||
$request = new CustomFieldsCreateRequest($field);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -943,24 +943,11 @@ 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];
|
||||
$request->filter->name = 'Test Offer';
|
||||
|
||||
$mock = static::createApiMockBuilder('store/offers');
|
||||
$mock->matchMethod(RequestMethod::GET)
|
||||
->matchQuery([
|
||||
'filter' => [
|
||||
'sites' => ['main'],
|
||||
'catalogs' => ['2'],
|
||||
'active' => '1',
|
||||
'minPrice' => '1',
|
||||
'maxPrice' => '120000',
|
||||
'maxQuantity' => '5',
|
||||
]
|
||||
])
|
||||
->matchQuery(self::encodeFormArray($request))
|
||||
->reply(200)
|
||||
->withBody($json);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue