1
0
mirror of synced 2024-11-21 20:46:06 +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
- php: 7.2
env: BRANCH=2.3.3
- php: 7.3
env: BRANCH=2.3.3
- php: 7.2
env: BRANCH=2.3.4
- php: 7.3
env: BRANCH=2.3.4
- stage: deploy
before_script: skip
@ -251,7 +247,7 @@ jobs:
before_deploy:
- export VERSION=`cat VERSION`
- 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"
- export TRAVIS_TAG=v$VERSION
- 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
* Поддержка передачи в заказе нескольких позиций одного товара
@ -5,13 +8,13 @@
* Удалена генерация externalId покупателя при заказе от незарегестрированного пользователя
## 2018-12-25 v.2.4.0
* Добавлен функционал получения остатков из retailCRM
* Добавлен функционал получения остатков из RetailCRM
## 2018-12-25 v.2.3.2
* Добавлена выгрузка картинок категорий товаров в ICML
## 2018-10-25 v.2.3.1
* Добавлена активация модуля в маркетплейсе retailCRM
* Добавлена активация модуля в маркетплейсе RetailCRM
## 2018-08-21 v.2.3.0
* Добавлены консольные команды для выгрузки архива клиентов и заказов

View File

@ -5,13 +5,13 @@
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:
* 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)
* 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

View File

@ -1,27 +1,16 @@
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 и Magento (статусы, оплаты, типы доставки и т.д.)
* Создать [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
* Производить обмен заказами с RetailCRM
* Настроить соответствие справочников RetailCRM и Magento (статусы, оплаты, типы доставки и т.д.)
* Создать [ICML](http://www.retailcrm.ru/docs/Developers/ICML) (Intaro Markup Language) для загрузки каталога товаров в RetailCRM
## 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

@ -1,23 +1,23 @@
#!/usr/bin/env bash
if [ -z $TRAVIS_BUILD_DIR ]; then
exit 0;
exit 0;
fi
MAGE_ROOT=$TRAVIS_BUILD_DIR/../magento2
create_db() {
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"
mysqladmin create $DB_NAME --user="$DB_USER" --password="$DB_PASS"
}
magento_clone() {
cd ..
git clone https://github.com/magento/magento2
cd magento2
git checkout $BRANCH
cd ..
git clone https://github.com/magento/magento2
cd magento2
git checkout $BRANCH
touch auth.json
echo '
touch auth.json
echo '
{
"http-basic": {
"repo.magento.com": {
@ -26,40 +26,42 @@ magento_clone() {
}
}
}
' > auth.json
' > 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?<public-key>?$PUBLIC_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
composer require retailcrm/api-client-php
php -r "copy('https://getcomposer.org/download/1.10.17/composer.phar', 'composer.phar');"
php composer.phar install --ignore-platform-reqs --no-interaction --prefer-dist
php composer.phar require retailcrm/api-client-php
}
magento_install() {
cd $MAGE_ROOT
cd $MAGE_ROOT
php bin/magento setup:install \
--db-host="$DB_HOST" \
--db-name="$DB_NAME" \
--db-user="$DB_USER" \
--admin-firstname="$ADMIN_FIRSTNAME" \
--admin-lastname="$ADMIN_LASTNAME" \
--admin-email="$ADMIN_EMAIL" \
--admin-user="$ADMIN_USER" \
--admin-password="$ADMIN_PASS" \
--language="en_US" \
--currency="USD" \
--timezone="Europe/Moscow"
php bin/magento setup:install \
--db-host="$DB_HOST" \
--db-name="$DB_NAME" \
--db-user="$DB_USER" \
--admin-firstname="$ADMIN_FIRSTNAME" \
--admin-lastname="$ADMIN_LASTNAME" \
--admin-email="$ADMIN_EMAIL" \
--admin-user="$ADMIN_USER" \
--admin-password="$ADMIN_PASS" \
--language="en_US" \
--currency="USD" \
--timezone="Europe/Moscow"
}
module_install() {
cd $MAGE_ROOT
mkdir -p app/code/Retailcrm/Retailcrm
cp -R $TRAVIS_BUILD_DIR/src/* app/code/Retailcrm/Retailcrm
cd $MAGE_ROOT
mkdir -p app/code/Retailcrm/Retailcrm
cp -R $TRAVIS_BUILD_DIR/src/* app/code/Retailcrm/Retailcrm
php bin/magento module:enable Retailcrm_Retailcrm
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento module:enable Retailcrm_Retailcrm
php bin/magento setup:upgrade
php bin/magento setup:di:compile
}
create_db

View File

@ -44,7 +44,7 @@ class CustomersExport extends Command
protected function configure()
{
$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('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 OutputInterface $output

View File

@ -37,7 +37,7 @@ class OrdersExport extends Command
protected function configure()
{
$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('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 OutputInterface $output

View File

@ -82,7 +82,7 @@ class ApiUrl extends \Magento\Framework\App\Config\Value
} elseif (!$response->isSuccessful() && $response['errorMsg'] == $api->getErrorText('errorApiKey')) {
throw new \Magento\Framework\Exception\ValidatorException(__('Incorrect API key'));
} 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;

View File

@ -82,7 +82,7 @@ class ApiVersion extends \Magento\Framework\App\Config\Value
if ($response->isSuccessful()) {
$availableVersions = $response['versions'];
} 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)) {

View File

@ -79,13 +79,17 @@ class Customer implements CustomerManagerInterface
'index' => $billing->getPostcode(),
'region' => $billing->getRegion(),
'city' => $billing->getCity(),
'street' => $billing->getStreet(),
'street' => is_array($billing->getStreet())
? implode(', ', $billing->getStreet())
: $billing->getStreet(),
'text' => sprintf(
'%s %s %s %s',
$billing->getPostcode(),
$billing->getRegion(),
$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 $testFieldSetCss = 'test_fieldset_css';
protected $objectFactory;
protected $secureRenderer;
public function setUp()
{
@ -88,6 +89,23 @@ class FieldsetTest extends TestCase
$factoryCollection->expects($this->any())->method('create')->willReturn($elementCollection);
$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->layoutMock = $this->createMock(\Magento\Framework\View\Layout::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->form = $this->createPartialMock(
\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('getRequest')->willReturn($this->requestMock);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "retailcrm/retailcrm",
"description": "Retailcrm",
"description": "RetailCRM",
"require": {
"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">
<system>
<tab id="retailcrm" translate="label" sortOrder="10">
<label>Retailcrm</label>
<label>RetailCRM</label>
</tab>
<section id="retailcrm" translate="label" sortOrder="130" showInDefault="1" showInWebsite="1" showInStore="1">
<class>separator-top</class>
@ -18,7 +18,7 @@
</field>
<field id="api_key" translate="label" type="text" sortOrder="20" showInDefault="1" showInWebsite="1" showInStore="1">
<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 id="api_version" translate="label" type="select" sortOrder="30" showInDefault="1" showInWebsite="1" showInStore="1">
<label>API version</label>

View File

@ -1,7 +1,7 @@
"Settings","La configuración"
"Main settings","La configuración general"
"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"
"Catalogue settings","La configuración del catálogo"
"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 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"
"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"
"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"
"Send","Enviar"
"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","Настройки"
"Main settings","Главные настройки"
"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"
"Catalogue settings","Настройки каталога"
"Attributes for uploading to ICML","Атрибуты для выгрузки в ICML"
@ -15,10 +15,10 @@
"Setting the store by default","Настройка магазина по умолчанию"
"Setting the stores correspondence","Настройка соответствия магазинов"
"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","Убедитесь, что введенные данные верны"
"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 недоступна"
"Send","Выгрузить"
"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 Сайт по умолчанию