1
0
mirror of synced 2024-11-25 06:26:07 +03:00

Rebranding RetailCRM, fix tests

This commit is contained in:
Eugene Polozov 2020-12-17 11:13:11 +03:00
parent e62591895d
commit f50a102cc8
22 changed files with 101 additions and 83 deletions

View File

@ -237,13 +237,9 @@ jobs:
env: BRANCH=2.3.3 env: BRANCH=2.3.3
- php: 7.2 - php: 7.2
env: BRANCH=2.3.3 env: BRANCH=2.3.3
- php: 7.3
env: BRANCH=2.3.3
- php: 7.2 - php: 7.2
env: BRANCH=2.3.4 env: BRANCH=2.3.4
- php: 7.3
env: BRANCH=2.3.4
- stage: deploy - stage: deploy
before_script: skip before_script: skip
@ -251,7 +247,7 @@ jobs:
before_deploy: before_deploy:
- export VERSION=`cat VERSION` - export VERSION=`cat VERSION`
- export ARCHIVE_NAME=/tmp/retailcrm-retailcrm-$VERSION.zip - export ARCHIVE_NAME=/tmp/retailcrm-retailcrm-$VERSION.zip
- git config --local user.name "retailCRM" - git config --local user.name "RetailCRM"
- git config --local user.email "support@retailcrm.ru" - git config --local user.email "support@retailcrm.ru"
- export TRAVIS_TAG=v$VERSION - export TRAVIS_TAG=v$VERSION
- git tag $TRAVIS_TAG - git tag $TRAVIS_TAG

View File

@ -1,3 +1,6 @@
## 2020-12-17 v.2.5.1
* Ребрендинг RetailCRM
## 2018-12-25 v.2.5.0 ## 2018-12-25 v.2.5.0
* Поддержка передачи в заказе нескольких позиций одного товара * Поддержка передачи в заказе нескольких позиций одного товара
@ -5,13 +8,13 @@
* Удалена генерация externalId покупателя при заказе от незарегестрированного пользователя * Удалена генерация externalId покупателя при заказе от незарегестрированного пользователя
## 2018-12-25 v.2.4.0 ## 2018-12-25 v.2.4.0
* Добавлен функционал получения остатков из retailCRM * Добавлен функционал получения остатков из RetailCRM
## 2018-12-25 v.2.3.2 ## 2018-12-25 v.2.3.2
* Добавлена выгрузка картинок категорий товаров в ICML * Добавлена выгрузка картинок категорий товаров в ICML
## 2018-10-25 v.2.3.1 ## 2018-10-25 v.2.3.1
* Добавлена активация модуля в маркетплейсе retailCRM * Добавлена активация модуля в маркетплейсе RetailCRM
## 2018-08-21 v.2.3.0 ## 2018-08-21 v.2.3.0
* Добавлены консольные команды для выгрузки архива клиентов и заказов * Добавлены консольные команды для выгрузки архива клиентов и заказов

View File

@ -5,13 +5,13 @@
Magento module Magento module
============== ==============
Magento 2 module for interaction with [retailCRM](http://www.retailcrm.ru). Magento 2 module for interaction with [RetailCRM](http://www.retailcrm.ru) ([Documentation](https://docs.retailcrm.pro/Users/Integration/SiteModules/Magento) page)
Module allows: Module allows:
* Exchange the orders data with retailCRM * Exchange the orders data with RetailCRM
* Configure relations between dictionaries of retailCRM and Magento (statuses, payments, delivery types and etc) * Configure relations between dictionaries of retailCRM and Magento (statuses, payments, delivery types and etc)
* Generate [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) export file for catalog loading by retailCRM * Generate [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) export file for catalog loading by RetailCRM
## ICML ## ICML

View File

@ -1,27 +1,16 @@
Magento module Magento module
Модуль Magento 2 для интеграции с [retailCRM](http://www.retailcrm.ru). Модуль Magento 2 для интеграции с [RetailCRM](http://www.retailcrm.ru) ([Документация](https://docs.retailcrm.ru/Users/Integration/SiteModules/Magento))
Модуль позволяет: Модуль позволяет:
* Производить обмен заказами с retailCRM * Производить обмен заказами с RetailCRM
* Настроить соответствие справочников retailCRM и Magento (статусы, оплаты, типы доставки и т.д.) * Настроить соответствие справочников RetailCRM и Magento (статусы, оплаты, типы доставки и т.д.)
* Создать [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) для загрузки каталога товаров в retailCRM * Создать [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) для загрузки каталога товаров в RetailCRM
### ICML
По умолчанию ICML-файл генерируется модулем каждые 4 часа. Вы можете найти файл в корневой директории с именем «retailcrm_{{shop_code}}.xml". Например, http://example.org/retailcrm_default.xml
### Ручная установка
1) Находясь в корневой директории проекта выполните команду:
* Настроить соответствие справочников retailCRM и Magento (статусы, оплаты, типы доставки и т.д.)
* Создать [ICML] (http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) для загрузки каталога товаров в RetailCRM
## ICML ## ICML
По умолчанию ICML-файл генерируется модулем каждые 4 часа. Вы можете найти файл в корневой папке с именем «retailcrm_{{shop_code}}.xml". Например, http://retailcrm.ru/retailcrm_default.xml По умолчанию ICML-файл генерируется модулем каждые 4 часа. Вы можете найти файл в корневой папке с именем «retailcrm_{{shop_code}}.xml". Например, http://example.ru/retailcrm_default.xml
## Ручная установка ## Ручная установка

View File

@ -1 +1 @@
2.5.0 2.5.1

View File

@ -31,8 +31,10 @@ magento_clone() {
sudo sed -e "s?<public-key>?$PUBLIC_KEY?g" --in-place auth.json sudo sed -e "s?<public-key>?$PUBLIC_KEY?g" --in-place auth.json
sudo sed -e "s?<private-key>?$PRIVATE_KEY?g" --in-place auth.json sudo sed -e "s?<private-key>?$PRIVATE_KEY?g" --in-place auth.json
composer install --no-interaction --prefer-dist php -r "copy('https://getcomposer.org/download/1.10.17/composer.phar', 'composer.phar');"
composer require retailcrm/api-client-php
php composer.phar install --ignore-platform-reqs --no-interaction --prefer-dist
php composer.phar require retailcrm/api-client-php
} }
magento_install() { magento_install() {

View File

@ -44,7 +44,7 @@ class CustomersExport extends Command
protected function configure() protected function configure()
{ {
$this->setName('retailcrm:customers:export') $this->setName('retailcrm:customers:export')
->setDescription('Upload archive customers to retailCRM from Magento') ->setDescription('Upload archive customers to RetailCRM from Magento')
->addArgument('from', InputArgument::OPTIONAL, 'Beginning order number') ->addArgument('from', InputArgument::OPTIONAL, 'Beginning order number')
->addArgument('to', InputArgument::OPTIONAL, 'End order number'); ->addArgument('to', InputArgument::OPTIONAL, 'End order number');
@ -52,7 +52,7 @@ class CustomersExport extends Command
} }
/** /**
* Upload customers to retailCRM * Upload customers to RetailCRM
* *
* @param InputInterface $input * @param InputInterface $input
* @param OutputInterface $output * @param OutputInterface $output

View File

@ -37,7 +37,7 @@ class OrdersExport extends Command
protected function configure() protected function configure()
{ {
$this->setName('retailcrm:orders:export') $this->setName('retailcrm:orders:export')
->setDescription('Upload archive orders to retailCRM from Magento') ->setDescription('Upload archive orders to RetailCRM from Magento')
->addArgument('from', InputArgument::OPTIONAL, 'Beginning order number') ->addArgument('from', InputArgument::OPTIONAL, 'Beginning order number')
->addArgument('to', InputArgument::OPTIONAL, 'End order number'); ->addArgument('to', InputArgument::OPTIONAL, 'End order number');
@ -45,7 +45,7 @@ class OrdersExport extends Command
} }
/** /**
* Upload orders to retailCRM * Upload orders to RetailCRM
* *
* @param InputInterface $input * @param InputInterface $input
* @param OutputInterface $output * @param OutputInterface $output

View File

@ -82,7 +82,7 @@ class ApiUrl extends \Magento\Framework\App\Config\Value
} elseif (!$response->isSuccessful() && $response['errorMsg'] == $api->getErrorText('errorApiKey')) { } elseif (!$response->isSuccessful() && $response['errorMsg'] == $api->getErrorText('errorApiKey')) {
throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect API key')); throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect API key'));
} elseif (isset($response['errorMsg']) && $response['errorMsg'] == $api->getErrorText('errorAccount')) { } elseif (isset($response['errorMsg']) && $response['errorMsg'] == $api->getErrorText('errorAccount')) {
throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect URL of retailCRM')); throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect URL of RetailCRM'));
} }
return true; return true;

View File

@ -82,7 +82,7 @@ class ApiVersion extends \Magento\Framework\App\Config\Value
if ($response->isSuccessful()) { if ($response->isSuccessful()) {
$availableVersions = $response['versions']; $availableVersions = $response['versions'];
} else { } else {
throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect URL of retailCRM or API key')); throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect URL of RetailCRM or API key'));
} }
if (isset($availableVersions)) { if (isset($availableVersions)) {

View File

@ -79,13 +79,17 @@ class Customer implements CustomerManagerInterface
'index' => $billing->getPostcode(), 'index' => $billing->getPostcode(),
'region' => $billing->getRegion(), 'region' => $billing->getRegion(),
'city' => $billing->getCity(), 'city' => $billing->getCity(),
'street' => $billing->getStreet(), 'street' => is_array($billing->getStreet())
? implode(', ', $billing->getStreet())
: $billing->getStreet(),
'text' => sprintf( 'text' => sprintf(
'%s %s %s %s', '%s %s %s %s',
$billing->getPostcode(), $billing->getPostcode(),
$billing->getRegion(), $billing->getRegion(),
$billing->getCity(), $billing->getCity(),
$billing->getStreet() is_array($billing->getStreet())
? implode(', ', $billing->getStreet())
: $billing->getStreet()
) )
] ]
]; ];

View File

@ -1 +1 @@
Magento 2 module for interaction with retailCRM Magento 2 module for interaction with RetailCRM

View File

@ -20,6 +20,7 @@ class FieldsetTest extends TestCase
protected $testElementId = 'test_element_id'; protected $testElementId = 'test_element_id';
protected $testFieldSetCss = 'test_fieldset_css'; protected $testFieldSetCss = 'test_fieldset_css';
protected $objectFactory; protected $objectFactory;
protected $secureRenderer;
public function setUp() public function setUp()
{ {
@ -88,6 +89,23 @@ class FieldsetTest extends TestCase
$factoryCollection->expects($this->any())->method('create')->willReturn($elementCollection); $factoryCollection->expects($this->any())->method('create')->willReturn($elementCollection);
$rendererMock = $this->createMock(\Magento\Framework\Data\Form\Element\Renderer\RendererInterface::class); $rendererMock = $this->createMock(\Magento\Framework\Data\Form\Element\Renderer\RendererInterface::class);
if (class_exists(\Magento\Framework\View\Helper\SecureHtmlRenderer::class)) {
$this->secureRenderer = $this->createMock(\Magento\Framework\View\Helper\SecureHtmlRenderer::class);
$this->secureRenderer->method('renderEventListenerAsTag')
->willReturnCallback(
function (string $event, string $js, string $selector): string {
return "<script>document.querySelector('$selector').$event = function () { $js };</script>";
}
);
$this->secureRenderer->method('renderStyleAsTag')
->willReturnCallback(
function (string $style, string $selector): string {
return "<style>$selector { $style }</style>";
}
);
}
$this->urlModelMock = $this->createMock(\Magento\Backend\Model\Url::class); $this->urlModelMock = $this->createMock(\Magento\Backend\Model\Url::class);
$this->layoutMock = $this->createMock(\Magento\Framework\View\Layout::class); $this->layoutMock = $this->createMock(\Magento\Framework\View\Layout::class);
$this->groupMock = $this->createMock(\Magento\Config\Model\Config\Structure\Element\Group::class); $this->groupMock = $this->createMock(\Magento\Config\Model\Config\Structure\Element\Group::class);
@ -100,7 +118,8 @@ class FieldsetTest extends TestCase
$this->helperMock = $this->createMock(\Magento\Framework\View\Helper\Js::class); $this->helperMock = $this->createMock(\Magento\Framework\View\Helper\Js::class);
$this->form = $this->createPartialMock( $this->form = $this->createPartialMock(
\Magento\Config\Block\System\Config\Form::class, \Magento\Config\Block\System\Config\Form::class,
['getElements', 'getRequest'] //['getElements', 'getRequest']
['getRequest']
); );
//$this->form->expects($this->any())->method('getElements')->willReturn($elementCollection); //$this->form->expects($this->any())->method('getElements')->willReturn($elementCollection);
$this->form->expects($this->any())->method('getRequest')->willReturn($this->requestMock); $this->form->expects($this->any())->method('getRequest')->willReturn($this->requestMock);

View File

@ -52,7 +52,8 @@ class PaymentTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest
'client' => $client, 'client' => $client,
'paymentConfig' => $paymentConfig, 'paymentConfig' => $paymentConfig,
'context' => $this->context, 'context' => $this->context,
'objectFactory' => $this->objectFactory 'objectFactory' => $this->objectFactory,
'secureRenderer' => $this->secureRenderer
]; ];
$payment = $this->objectManager->getObject( $payment = $this->objectManager->getObject(

View File

@ -52,7 +52,8 @@ class ShippingTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest
'client' => $client, 'client' => $client,
'shippingConfig' => $shippingConfig, 'shippingConfig' => $shippingConfig,
'context' => $this->context, 'context' => $this->context,
'objectFactory' => $this->objectFactory 'objectFactory' => $this->objectFactory,
'secureRenderer' => $this->secureRenderer
]; ];
$shipping = $this->objectManager->getObject( $shipping = $this->objectManager->getObject(

View File

@ -43,7 +43,8 @@ class SiteTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest
'data' => ['group' => $this->groupMock], 'data' => ['group' => $this->groupMock],
'client' => $client, 'client' => $client,
'context' => $this->context, 'context' => $this->context,
'objectFactory' => $this->objectFactory 'objectFactory' => $this->objectFactory,
'secureRenderer' => $this->secureRenderer
]; ];
$site = $this->objectManager->getObject( $site = $this->objectManager->getObject(

View File

@ -55,7 +55,8 @@ class SitesTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest
'client' => $client, 'client' => $client,
'storeManager' => $storeManager, 'storeManager' => $storeManager,
'context' => $this->context, 'context' => $this->context,
'objectFactory' => $this->objectFactory 'objectFactory' => $this->objectFactory,
'secureRenderer' => $this->secureRenderer
]; ];
$sites = $this->objectManager->getObject( $sites = $this->objectManager->getObject(

View File

@ -52,7 +52,8 @@ class StatusTest extends \Retailcrm\Retailcrm\Test\Helpers\FieldsetTest
'client' => $client, 'client' => $client,
'statusCollection' => $statusCollection, 'statusCollection' => $statusCollection,
'context' => $this->context, 'context' => $this->context,
'objectFactory' => $this->objectFactory 'objectFactory' => $this->objectFactory,
'secureRenderer' => $this->secureRenderer
]; ];
$status = $this->objectManager->getObject( $status = $this->objectManager->getObject(

View File

@ -1,6 +1,6 @@
{ {
"name": "retailcrm/retailcrm", "name": "retailcrm/retailcrm",
"description": "Retailcrm", "description": "RetailCRM",
"require": { "require": {
"retailcrm/api-client-php": "~5.0" "retailcrm/api-client-php": "~5.0"
}, },

View File

@ -2,7 +2,7 @@
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd"> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
<system> <system>
<tab id="retailcrm" translate="label" sortOrder="10"> <tab id="retailcrm" translate="label" sortOrder="10">
<label>Retailcrm</label> <label>RetailCRM</label>
</tab> </tab>
<section id="retailcrm" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1"> <section id="retailcrm" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class> <class>separator-top</class>
@ -18,7 +18,7 @@
</field> </field>
<field id="api_key" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="api_key" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<label>API key</label> <label>API key</label>
<comment>You can create an API key in the administration section of retailCRM</comment> <comment>You can create an API key in the administration section of RetailCRM</comment>
</field> </field>
<field id="api_version" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1"> <field id="api_version" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>API version</label> <label>API version</label>

View File

@ -1,7 +1,7 @@
"Settings","La configuración" "Settings","La configuración"
"Main settings","La configuración general" "Main settings","La configuración general"
"API key","La llave API" "API key","La llave API"
"You can create an API key in the administration section of retailCRM","Puede crear la llave API en la sección administrativa del retailCRM" "You can create an API key in the administration section of RetailCRM","Puede crear la llave API en la sección administrativa del RetailCRM"
"API version","La versión API" "API version","La versión API"
"Catalogue settings","La configuración del catálogo" "Catalogue settings","La configuración del catálogo"
"Attributes for uploading to ICML","Los atributos para importar al ICML" "Attributes for uploading to ICML","Los atributos para importar al ICML"
@ -15,10 +15,10 @@
"Setting the store by default","La configuración de la tienda por defecto" "Setting the store by default","La configuración de la tienda por defecto"
"Setting the stores correspondence","La configuración de la concordancia de tienda" "Setting the stores correspondence","La configuración de la concordancia de tienda"
"Enter API of your URL and API key","Introduce el enlace API y la llave API" "Enter API of your URL and API key","Introduce el enlace API y la llave API"
"Incorrect URL of retailCRM","La dirección del retailCRM es incorrecto" "Incorrect URL of RetailCRM","La dirección del RetailCRM es incorrecto"
"Make sure that the entered data is correct","Asegúrese de que los datos introducidos son correctos" "Make sure that the entered data is correct","Asegúrese de que los datos introducidos son correctos"
"Incorrect API key","La llave API es incorrecta" "Incorrect API key","La llave API es incorrecta"
"Incorrect URL of retailCRM or API key","La dirección del retailCRM o la llave API son incorrectos" "Incorrect URL of RetailCRM or API key","La dirección del RetailCRM o la llave API son incorrectos"
"The selected API version is unavailable","La versión de la API seleccionada no está disponible" "The selected API version is unavailable","La versión de la API seleccionada no está disponible"
"Send","Enviar" "Send","Enviar"
"Default site","Tienda por defecto" "Default site","Tienda por defecto"

1 Settings La configuración
2 Main settings La configuración general
3 API key La llave API
4 You can create an API key in the administration section of retailCRM You can create an API key in the administration section of RetailCRM Puede crear la llave API en la sección administrativa del retailCRM Puede crear la llave API en la sección administrativa del RetailCRM
5 API version La versión API
6 Catalogue settings La configuración del catálogo
7 Attributes for uploading to ICML Los atributos para importar al ICML
15 Setting the store by default La configuración de la tienda por defecto
16 Setting the stores correspondence La configuración de la concordancia de tienda
17 Enter API of your URL and API key Introduce el enlace API y la llave API
18 Incorrect URL of retailCRM Incorrect URL of RetailCRM La dirección del retailCRM es incorrecto La dirección del RetailCRM es incorrecto
19 Make sure that the entered data is correct Asegúrese de que los datos introducidos son correctos
20 Incorrect API key La llave API es incorrecta
21 Incorrect URL of retailCRM or API key Incorrect URL of RetailCRM or API key La dirección del retailCRM o la llave API son incorrectos La dirección del RetailCRM o la llave API son incorrectos
22 The selected API version is unavailable La versión de la API seleccionada no está disponible
23 Send Enviar
24 Default site Tienda por defecto

View File

@ -1,7 +1,7 @@
"Settings","Настройки" "Settings","Настройки"
"Main settings","Главные настройки" "Main settings","Главные настройки"
"API key","API ключ" "API key","API ключ"
"You can create an API key in the administration section of retailCRM","Вы можете создать API ключ в административном разделе retailCRM" "You can create an API key in the administration section of RetailCRM","Вы можете создать API ключ в административном разделе RetailCRM"
"API version","Версия API" "API version","Версия API"
"Catalogue settings","Настройки каталога" "Catalogue settings","Настройки каталога"
"Attributes for uploading to ICML","Атрибуты для выгрузки в ICML" "Attributes for uploading to ICML","Атрибуты для выгрузки в ICML"
@ -15,10 +15,10 @@
"Setting the store by default","Настройка магазина по умолчанию" "Setting the store by default","Настройка магазина по умолчанию"
"Setting the stores correspondence","Настройка соответствия магазинов" "Setting the stores correspondence","Настройка соответствия магазинов"
"Enter API of your URL and API key","Введите Ваш API URL и API ключ" "Enter API of your URL and API key","Введите Ваш API URL и API ключ"
"Incorrect URL of retailCRM","Некорректный адрес retailCRM" "Incorrect URL of RetailCRM","Некорректный адрес RetailCRM"
"Make sure that the entered data is correct","Убедитесь, что введенные данные верны" "Make sure that the entered data is correct","Убедитесь, что введенные данные верны"
"Incorrect API key","Некорректный API ключ" "Incorrect API key","Некорректный API ключ"
"Incorrect URL of retailCRM or API key","Некорректный адрес retailCRM или API ключ" "Incorrect URL of RetailCRM or API key","Некорректный адрес RetailCRM или API ключ"
"The selected API version is unavailable","Выбранная версия API недоступна" "The selected API version is unavailable","Выбранная версия API недоступна"
"Send","Выгрузить" "Send","Выгрузить"
"Default site","Сайт по умолчанию" "Default site","Сайт по умолчанию"

1 Settings Настройки
2 Main settings Главные настройки
3 API key API ключ
4 You can create an API key in the administration section of retailCRM You can create an API key in the administration section of RetailCRM Вы можете создать API ключ в административном разделе retailCRM Вы можете создать API ключ в административном разделе RetailCRM
5 API version Версия API
6 Catalogue settings Настройки каталога
7 Attributes for uploading to ICML Атрибуты для выгрузки в ICML
15 Setting the store by default Настройка магазина по умолчанию
16 Setting the stores correspondence Настройка соответствия магазинов
17 Enter API of your URL and API key Введите Ваш API URL и API ключ
18 Incorrect URL of retailCRM Incorrect URL of RetailCRM Некорректный адрес retailCRM Некорректный адрес RetailCRM
19 Make sure that the entered data is correct Убедитесь, что введенные данные верны
20 Incorrect API key Некорректный API ключ
21 Incorrect URL of retailCRM or API key Incorrect URL of RetailCRM or API key Некорректный адрес retailCRM или API ключ Некорректный адрес RetailCRM или API ключ
22 The selected API version is unavailable Выбранная версия API недоступна
23 Send Выгрузить
24 Default site Сайт по умолчанию