Added currency methods + properties (#174)
Added currency methods + properties
This commit is contained in:
parent
a68705055c
commit
6515e39144
@ -46,6 +46,14 @@ class Loyalty
|
|||||||
*/
|
*/
|
||||||
public $blocked;
|
public $blocked;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("currency")
|
||||||
|
*/
|
||||||
|
public $currency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*
|
*
|
||||||
|
@ -48,6 +48,14 @@ class Order
|
|||||||
*/
|
*/
|
||||||
public $summ;
|
public $summ;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("currency")
|
||||||
|
*/
|
||||||
|
public $currency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var int
|
* @var int
|
||||||
*
|
*
|
||||||
|
77
src/Model/Entity/References/Currency.php
Normal file
77
src/Model/Entity/References/Currency.php
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category Currency
|
||||||
|
* @package RetailCrm\Api\Model\Entity\References
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Entity\References;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class Currency
|
||||||
|
*
|
||||||
|
* @category Currency
|
||||||
|
* @package RetailCrm\Api\Model\Entity\References
|
||||||
|
*/
|
||||||
|
class Currency
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("id")
|
||||||
|
*/
|
||||||
|
public $id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("code")
|
||||||
|
*/
|
||||||
|
public $code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("isBase")
|
||||||
|
*/
|
||||||
|
public $isBase;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var bool
|
||||||
|
*
|
||||||
|
* @JMS\Type("bool")
|
||||||
|
* @JMS\SerializedName("isAutoConvert")
|
||||||
|
*/
|
||||||
|
public $isAutoConvert;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("autoConvertExtraPercent")
|
||||||
|
*/
|
||||||
|
public $autoConvertExtraPercent;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var int
|
||||||
|
*
|
||||||
|
* @JMS\Type("int")
|
||||||
|
* @JMS\SerializedName("manualConvertNominal")
|
||||||
|
*/
|
||||||
|
public $manualConvertNominal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var float
|
||||||
|
*
|
||||||
|
* @JMS\Type("float")
|
||||||
|
* @JMS\SerializedName("manualConvertValue")
|
||||||
|
*/
|
||||||
|
public $manualConvertValue;
|
||||||
|
}
|
@ -69,6 +69,14 @@ class DeliveryType
|
|||||||
*/
|
*/
|
||||||
public $isCostDependsOnDateTime;
|
public $isCostDependsOnDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("currency")
|
||||||
|
*/
|
||||||
|
public $currency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
|
@ -156,6 +156,14 @@ class Site
|
|||||||
*/
|
*/
|
||||||
public $countryIso;
|
public $countryIso;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string
|
||||||
|
*
|
||||||
|
* @JMS\Type("string")
|
||||||
|
* @JMS\SerializedName("currency")
|
||||||
|
*/
|
||||||
|
public $currency;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
*
|
*
|
||||||
|
44
src/Model/Request/References/CurrenciesCreateRequest.php
Normal file
44
src/Model/Request/References/CurrenciesCreateRequest.php
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category CurrenciesCreateRequest
|
||||||
|
* @package RetailCrm\Api\Model\Request\References
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Request\References;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\FormData\Mapping as Form;
|
||||||
|
use RetailCrm\Api\Interfaces\RequestInterface;
|
||||||
|
use RetailCrm\Api\Model\Entity\References\Currency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CurrenciesCreateRequest
|
||||||
|
*
|
||||||
|
* @category CurrenciesCreateRequest
|
||||||
|
* @package RetailCrm\Api\Model\Request\References
|
||||||
|
*/
|
||||||
|
class CurrenciesCreateRequest implements RequestInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\References\Currency
|
||||||
|
*
|
||||||
|
* @Form\Type("RetailCrm\Api\Model\Entity\References\Currency")
|
||||||
|
* @Form\SerializedName("currency")
|
||||||
|
* @Form\JsonField()
|
||||||
|
*/
|
||||||
|
public $currency;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CurrenciesCreateRequest constructor.
|
||||||
|
*
|
||||||
|
* @param \RetailCrm\Api\Model\Entity\References\Currency|null $currency
|
||||||
|
*/
|
||||||
|
public function __construct(?Currency $currency = null)
|
||||||
|
{
|
||||||
|
if (null !== $this->currency) {
|
||||||
|
$this->currency = $currency;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
31
src/Model/Response/References/CurrenciesResponse.php
Normal file
31
src/Model/Response/References/CurrenciesResponse.php
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PHP version 7.3
|
||||||
|
*
|
||||||
|
* @category CurrenciesResponse
|
||||||
|
* @package RetailCrm\Api\Model\Response\References
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace RetailCrm\Api\Model\Response\References;
|
||||||
|
|
||||||
|
use RetailCrm\Api\Component\Serializer\Annotation as JMS;
|
||||||
|
use RetailCrm\Api\Model\Response\SuccessResponse;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class CurrenciesResponse
|
||||||
|
*
|
||||||
|
* @category CurrenciesResponse
|
||||||
|
* @package RetailCrm\Api\Model\Response\References
|
||||||
|
*/
|
||||||
|
|
||||||
|
class CurrenciesResponse extends SuccessResponse
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @var \RetailCrm\Api\Model\Entity\References\Currency[]
|
||||||
|
*
|
||||||
|
* @JMS\Type("array<RetailCrm\Api\Model\Entity\References\Currency>")
|
||||||
|
* @JMS\SerializedName("currencies")
|
||||||
|
*/
|
||||||
|
public $currencies;
|
||||||
|
}
|
@ -13,6 +13,7 @@ use RetailCrm\Api\Enum\RequestMethod;
|
|||||||
use RetailCrm\Api\Model\Request\References\CostGroupsEditRequest;
|
use RetailCrm\Api\Model\Request\References\CostGroupsEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\CostItemsEditRequest;
|
use RetailCrm\Api\Model\Request\References\CostItemsEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\CouriersCreateRequest;
|
use RetailCrm\Api\Model\Request\References\CouriersCreateRequest;
|
||||||
|
use RetailCrm\Api\Model\Request\References\CurrenciesCreateRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\DeliveryServicesEditRequest;
|
use RetailCrm\Api\Model\Request\References\DeliveryServicesEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\DeliveryTypesEditRequest;
|
use RetailCrm\Api\Model\Request\References\DeliveryTypesEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\LegalEntityEditRequest;
|
use RetailCrm\Api\Model\Request\References\LegalEntityEditRequest;
|
||||||
@ -31,6 +32,7 @@ use RetailCrm\Api\Model\Response\References\CostGroupsResponse;
|
|||||||
use RetailCrm\Api\Model\Response\References\CostItemsResponse;
|
use RetailCrm\Api\Model\Response\References\CostItemsResponse;
|
||||||
use RetailCrm\Api\Model\Response\References\CountriesResponse;
|
use RetailCrm\Api\Model\Response\References\CountriesResponse;
|
||||||
use RetailCrm\Api\Model\Response\References\CouriersResponse;
|
use RetailCrm\Api\Model\Response\References\CouriersResponse;
|
||||||
|
use RetailCrm\Api\Model\Response\References\CurrenciesResponse;
|
||||||
use RetailCrm\Api\Model\Response\References\DeliveryServicesResponse;
|
use RetailCrm\Api\Model\Response\References\DeliveryServicesResponse;
|
||||||
use RetailCrm\Api\Model\Response\References\DeliveryTypesResponse;
|
use RetailCrm\Api\Model\Response\References\DeliveryTypesResponse;
|
||||||
use RetailCrm\Api\Model\Response\References\LegalEntitiesResponse;
|
use RetailCrm\Api\Model\Response\References\LegalEntitiesResponse;
|
||||||
@ -510,6 +512,177 @@ class References extends AbstractApiResourceGroup
|
|||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes GET "/api/v5/reference/currencies" request.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* ```php
|
||||||
|
* use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||||
|
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||||
|
*
|
||||||
|
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||||
|
*
|
||||||
|
* try {
|
||||||
|
* $response = $client->references->currencies();
|
||||||
|
* } 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 'Currencies: ' . print_r($response->currencies, true);
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @return \RetailCrm\Api\Model\Response\References\CurrenciesResponse
|
||||||
|
* @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 currencies(): CurrenciesResponse
|
||||||
|
{
|
||||||
|
/** @var CurrenciesResponse $response */
|
||||||
|
$response = $this->sendRequest(
|
||||||
|
RequestMethod::GET,
|
||||||
|
'reference/currencies',
|
||||||
|
null,
|
||||||
|
CurrenciesResponse::class
|
||||||
|
);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes POST "/api/v5/reference/currencies/create" request.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* ```php
|
||||||
|
* use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||||
|
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||||
|
* use RetailCrm\Api\Model\Entity\References\Currency;
|
||||||
|
* use RetailCrm\Api\Model\Request\References\CurrenciesCreateRequest;
|
||||||
|
*
|
||||||
|
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||||
|
*
|
||||||
|
* $entity = new Currency();
|
||||||
|
* $entity->code = 'USD';
|
||||||
|
* $entity->isAutoConvert = true;
|
||||||
|
* $entity->autoConvertExtraPercent = 5;
|
||||||
|
*
|
||||||
|
* try {
|
||||||
|
* $response = $client->references->currenciesCreate(new CurrenciesCreateRequest($entity));
|
||||||
|
* } 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 'Created currency with ID: ' . $response->id;
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param \RetailCrm\Api\Model\Request\References\CurrenciesCreateRequest $request
|
||||||
|
*
|
||||||
|
* @return \RetailCrm\Api\Model\Response\IdResponse
|
||||||
|
* @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 currenciesCreate(CurrenciesCreateRequest $request): IdResponse
|
||||||
|
{
|
||||||
|
/** @var IdResponse $response */
|
||||||
|
$response = $this->sendRequest(
|
||||||
|
RequestMethod::POST,
|
||||||
|
'reference/currencies/create',
|
||||||
|
$request,
|
||||||
|
IdResponse::class
|
||||||
|
);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Makes POST "/api/v5/reference/currencies/{id}/edit" request.
|
||||||
|
*
|
||||||
|
* Example:
|
||||||
|
* ```php
|
||||||
|
* use RetailCrm\Api\Factory\SimpleClientFactory;
|
||||||
|
* use RetailCrm\Api\Interfaces\ApiExceptionInterface;
|
||||||
|
* use RetailCrm\Api\Model\Entity\References\Currency;
|
||||||
|
* use RetailCrm\Api\Model\Request\References\CurrenciesCreateRequest;
|
||||||
|
*
|
||||||
|
* $client = SimpleClientFactory::createClient('https://test.retailcrm.pro', 'apiKey');
|
||||||
|
*
|
||||||
|
* $entity = new Currency();
|
||||||
|
* $entity->code = 'USD';
|
||||||
|
* $entity->isAutoConvert = true;
|
||||||
|
* $entity->autoConvertExtraPercent = 10;
|
||||||
|
*
|
||||||
|
* try {
|
||||||
|
* $response = $client->references->currenciesEdit(1, new CurrenciesCreateRequest($entity));
|
||||||
|
* } 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);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
* ```
|
||||||
|
*
|
||||||
|
* @param int $id
|
||||||
|
* @param \RetailCrm\Api\Model\Request\References\CurrenciesCreateRequest $request
|
||||||
|
*
|
||||||
|
* @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 currenciesEdit(int $id, CurrenciesCreateRequest $request): SuccessResponse
|
||||||
|
{
|
||||||
|
/** @var SuccessResponse $response */
|
||||||
|
$response = $this->sendRequest(
|
||||||
|
RequestMethod::POST,
|
||||||
|
'reference/currencies/' . $id . '/edit',
|
||||||
|
$request,
|
||||||
|
SuccessResponse::class
|
||||||
|
);
|
||||||
|
return $response;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Makes GET "/api/v5/reference/delivery-services" request.
|
* Makes GET "/api/v5/reference/delivery-services" request.
|
||||||
*
|
*
|
||||||
|
@ -618,7 +618,8 @@ EOF;
|
|||||||
"active": false,
|
"active": false,
|
||||||
"id": 168,
|
"id": 168,
|
||||||
"loyalty": {
|
"loyalty": {
|
||||||
"id": 1
|
"id": 1,
|
||||||
|
"currency": "RUB"
|
||||||
},
|
},
|
||||||
"customer": {
|
"customer": {
|
||||||
"id": 5260,
|
"id": 5260,
|
||||||
@ -1098,6 +1099,7 @@ EOF;
|
|||||||
{
|
{
|
||||||
"active": true,
|
"active": true,
|
||||||
"blocked": false,
|
"blocked": false,
|
||||||
|
"currency": "RUB",
|
||||||
"id": 3,
|
"id": 3,
|
||||||
"name": "Новая программа",
|
"name": "Новая программа",
|
||||||
"confirmSmsCharge": false,
|
"confirmSmsCharge": false,
|
||||||
@ -1108,6 +1110,7 @@ EOF;
|
|||||||
{
|
{
|
||||||
"active": true,
|
"active": true,
|
||||||
"blocked": false,
|
"blocked": false,
|
||||||
|
"currency": "RUB",
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"name": "Битрикс новый",
|
"name": "Битрикс новый",
|
||||||
"confirmSmsCharge": false,
|
"confirmSmsCharge": false,
|
||||||
@ -1118,6 +1121,7 @@ EOF;
|
|||||||
{
|
{
|
||||||
"active": true,
|
"active": true,
|
||||||
"blocked": false,
|
"blocked": false,
|
||||||
|
"currency": "RUB",
|
||||||
"id": 1,
|
"id": 1,
|
||||||
"name": "Тестовая программа",
|
"name": "Тестовая программа",
|
||||||
"confirmSmsCharge": false,
|
"confirmSmsCharge": false,
|
||||||
@ -1154,6 +1158,7 @@ EOF;
|
|||||||
"loyalty": {
|
"loyalty": {
|
||||||
"active": true,
|
"active": true,
|
||||||
"blocked": false,
|
"blocked": false,
|
||||||
|
"currency": "RUB",
|
||||||
"id": 4,
|
"id": 4,
|
||||||
"name": "Битрикс новый",
|
"name": "Битрикс новый",
|
||||||
"confirmSmsCharge": false,
|
"confirmSmsCharge": false,
|
||||||
|
@ -86,6 +86,7 @@ class OrdersTest extends AbstractApiResourceGroupTestCase
|
|||||||
"createdAt": "2021-02-25 09:37:48",
|
"createdAt": "2021-02-25 09:37:48",
|
||||||
"statusUpdatedAt": "2021-02-25 09:37:55",
|
"statusUpdatedAt": "2021-02-25 09:37:55",
|
||||||
"summ": 0,
|
"summ": 0,
|
||||||
|
"currency": "RUB",
|
||||||
"totalSumm": 0,
|
"totalSumm": 0,
|
||||||
"prepaySum": 0,
|
"prepaySum": 0,
|
||||||
"purchaseSumm": 60,
|
"purchaseSumm": 60,
|
||||||
@ -8185,6 +8186,7 @@ EOF;
|
|||||||
"createdAt": "2020-12-29 17:35:08",
|
"createdAt": "2020-12-29 17:35:08",
|
||||||
"statusUpdatedAt": "2020-12-31 15:09:31",
|
"statusUpdatedAt": "2020-12-31 15:09:31",
|
||||||
"summ": 1,
|
"summ": 1,
|
||||||
|
"currency": "RUB",
|
||||||
"totalSumm": 1,
|
"totalSumm": 1,
|
||||||
"prepaySum": 0,
|
"prepaySum": 0,
|
||||||
"purchaseSumm": 0,
|
"purchaseSumm": 0,
|
||||||
|
@ -19,6 +19,7 @@ use RetailCrm\Api\Model\Entity\Orders\Delivery\CourierPhone;
|
|||||||
use RetailCrm\Api\Model\Entity\References\CostGroup;
|
use RetailCrm\Api\Model\Entity\References\CostGroup;
|
||||||
use RetailCrm\Api\Model\Entity\References\CostItem;
|
use RetailCrm\Api\Model\Entity\References\CostItem;
|
||||||
use RetailCrm\Api\Model\Entity\References\Courier;
|
use RetailCrm\Api\Model\Entity\References\Courier;
|
||||||
|
use RetailCrm\Api\Model\Entity\References\Currency;
|
||||||
use RetailCrm\Api\Model\Entity\References\DeliveryService;
|
use RetailCrm\Api\Model\Entity\References\DeliveryService;
|
||||||
use RetailCrm\Api\Model\Entity\References\DeliveryType;
|
use RetailCrm\Api\Model\Entity\References\DeliveryType;
|
||||||
use RetailCrm\Api\Model\Entity\References\LegalEntity;
|
use RetailCrm\Api\Model\Entity\References\LegalEntity;
|
||||||
@ -37,6 +38,7 @@ use RetailCrm\Api\Model\Entity\References\StorePhone;
|
|||||||
use RetailCrm\Api\Model\Request\References\CostGroupsEditRequest;
|
use RetailCrm\Api\Model\Request\References\CostGroupsEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\CostItemsEditRequest;
|
use RetailCrm\Api\Model\Request\References\CostItemsEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\CouriersCreateRequest;
|
use RetailCrm\Api\Model\Request\References\CouriersCreateRequest;
|
||||||
|
use RetailCrm\Api\Model\Request\References\CurrenciesCreateRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\DeliveryServicesEditRequest;
|
use RetailCrm\Api\Model\Request\References\DeliveryServicesEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\DeliveryTypesEditRequest;
|
use RetailCrm\Api\Model\Request\References\DeliveryTypesEditRequest;
|
||||||
use RetailCrm\Api\Model\Request\References\LegalEntityEditRequest;
|
use RetailCrm\Api\Model\Request\References\LegalEntityEditRequest;
|
||||||
@ -489,6 +491,101 @@ EOF;
|
|||||||
self::assertModelEqualsToResponse($json, $response);
|
self::assertModelEqualsToResponse($json, $response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testCurrencies(): void
|
||||||
|
{
|
||||||
|
$json = <<<'EOF'
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"currencies": [
|
||||||
|
{
|
||||||
|
"id": 1,
|
||||||
|
"code": "RUB",
|
||||||
|
"isBase": true,
|
||||||
|
"isAutoConvert": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 3,
|
||||||
|
"code": "KZT",
|
||||||
|
"isBase": false,
|
||||||
|
"isAutoConvert": true,
|
||||||
|
"autoConvertExtraPercent": 10
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": 2,
|
||||||
|
"code": "USD",
|
||||||
|
"isBase": false,
|
||||||
|
"isAutoConvert": true,
|
||||||
|
"autoConvertExtraPercent": 5
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$mock = static::createApiMockBuilder('reference/currencies');
|
||||||
|
$mock->matchMethod(RequestMethod::GET)
|
||||||
|
->reply(200)
|
||||||
|
->withBody($json);
|
||||||
|
|
||||||
|
$client = TestClientFactory::createClient($mock->getClient());
|
||||||
|
$response = $client->references->currencies();
|
||||||
|
|
||||||
|
self::assertModelEqualsToResponse($json, $response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCurrenciesCreate(): void
|
||||||
|
{
|
||||||
|
$json = <<<'EOF'
|
||||||
|
{
|
||||||
|
"success": true,
|
||||||
|
"id": 1
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$entity = new Currency();
|
||||||
|
$entity->code = 'EUR';
|
||||||
|
$entity->isAutoConvert = true;
|
||||||
|
$entity->autoConvertExtraPercent = 5;
|
||||||
|
|
||||||
|
$request = new CurrenciesCreateRequest($entity);
|
||||||
|
|
||||||
|
$mock = static::createApiMockBuilder('reference/currencies/create');
|
||||||
|
$mock->matchMethod(RequestMethod::POST)
|
||||||
|
->matchBody(self::encodeForm($request))
|
||||||
|
->reply(200)
|
||||||
|
->withBody($json);
|
||||||
|
|
||||||
|
$client = TestClientFactory::createClient($mock->getClient());
|
||||||
|
$response = $client->references->currenciesCreate($request);
|
||||||
|
|
||||||
|
self::assertModelEqualsToResponse($json, $response);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testCurrenciesEdit(): void
|
||||||
|
{
|
||||||
|
$json = <<<'EOF'
|
||||||
|
{
|
||||||
|
"success": true
|
||||||
|
}
|
||||||
|
EOF;
|
||||||
|
|
||||||
|
$entity = new Currency();
|
||||||
|
$entity->isAutoConvert = true;
|
||||||
|
$entity->autoConvertExtraPercent = 15;
|
||||||
|
|
||||||
|
$request = new CurrenciesCreateRequest($entity);
|
||||||
|
|
||||||
|
$mock = static::createApiMockBuilder('reference/currencies/3/edit');
|
||||||
|
$mock->matchMethod(RequestMethod::POST)
|
||||||
|
->matchBody(self::encodeForm($request))
|
||||||
|
->reply(200)
|
||||||
|
->withBody($json);
|
||||||
|
|
||||||
|
$client = TestClientFactory::createClient($mock->getClient());
|
||||||
|
$response = $client->references->currenciesEdit(3, $request);
|
||||||
|
|
||||||
|
self::assertModelEqualsToResponse($json, $response);
|
||||||
|
}
|
||||||
|
|
||||||
public function testDeliveryServices(): void
|
public function testDeliveryServices(): void
|
||||||
{
|
{
|
||||||
$json = <<<'EOF'
|
$json = <<<'EOF'
|
||||||
@ -663,6 +760,7 @@ EOF;
|
|||||||
"isAutoNetCostCalculation": false,
|
"isAutoNetCostCalculation": false,
|
||||||
"isCostDependsOnRegionAndWeightAndSum": false,
|
"isCostDependsOnRegionAndWeightAndSum": false,
|
||||||
"isCostDependsOnDateTime": false,
|
"isCostDependsOnDateTime": false,
|
||||||
|
"currency": "RUB",
|
||||||
"name": "Доставка курьером",
|
"name": "Доставка курьером",
|
||||||
"code": "2",
|
"code": "2",
|
||||||
"active": true,
|
"active": true,
|
||||||
@ -702,6 +800,7 @@ EOF;
|
|||||||
"isAutoNetCostCalculation": false,
|
"isAutoNetCostCalculation": false,
|
||||||
"isCostDependsOnRegionAndWeightAndSum": false,
|
"isCostDependsOnRegionAndWeightAndSum": false,
|
||||||
"isCostDependsOnDateTime": false,
|
"isCostDependsOnDateTime": false,
|
||||||
|
"currency": "RUB",
|
||||||
"name": "Почта России",
|
"name": "Почта России",
|
||||||
"code": "16",
|
"code": "16",
|
||||||
"active": true,
|
"active": true,
|
||||||
@ -738,6 +837,7 @@ EOF;
|
|||||||
"isAutoNetCostCalculation": false,
|
"isAutoNetCostCalculation": false,
|
||||||
"isCostDependsOnRegionAndWeightAndSum": false,
|
"isCostDependsOnRegionAndWeightAndSum": false,
|
||||||
"isCostDependsOnDateTime": false,
|
"isCostDependsOnDateTime": false,
|
||||||
|
"currency": "RUB",
|
||||||
"name": "Доставка OZON",
|
"name": "Доставка OZON",
|
||||||
"code": "ozon-seller",
|
"code": "ozon-seller",
|
||||||
"active": false,
|
"active": false,
|
||||||
@ -801,6 +901,7 @@ EOF;
|
|||||||
"isAutoNetCostCalculation": true,
|
"isAutoNetCostCalculation": true,
|
||||||
"isCostDependsOnRegionAndWeightAndSum": false,
|
"isCostDependsOnRegionAndWeightAndSum": false,
|
||||||
"isCostDependsOnDateTime": false,
|
"isCostDependsOnDateTime": false,
|
||||||
|
"currency": "RUB",
|
||||||
"name": "Курьерист 24",
|
"name": "Курьерист 24",
|
||||||
"code": "crrst-24",
|
"code": "crrst-24",
|
||||||
"active": true,
|
"active": true,
|
||||||
@ -2573,6 +2674,7 @@ EOF;
|
|||||||
"countryIso": "RU"
|
"countryIso": "RU"
|
||||||
},
|
},
|
||||||
"countryIso": "RU",
|
"countryIso": "RU",
|
||||||
|
"currency": "RUB",
|
||||||
"senderEmail": "test@example.com",
|
"senderEmail": "test@example.com",
|
||||||
"senderName": "test",
|
"senderName": "test",
|
||||||
"catalogId": "catalog",
|
"catalogId": "catalog",
|
||||||
@ -2602,7 +2704,8 @@ EOF;
|
|||||||
"code": "Vog_Gallery",
|
"code": "Vog_Gallery",
|
||||||
"countryIso": "RU"
|
"countryIso": "RU"
|
||||||
},
|
},
|
||||||
"countryIso": "RU"
|
"countryIso": "RU",
|
||||||
|
"currency": "RUB"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user