v3.4.3
This commit is contained in:
parent
3c0705315d
commit
63f9a15564
@ -1,3 +1,8 @@
|
|||||||
|
## 2019-02-15 3.4.3
|
||||||
|
* Исправлено сохранение типа оплаты при создании заказа по истории на стороне WC
|
||||||
|
* Исправлено сохранение типа оплаты при ризменении заказа по истории на стороне WC
|
||||||
|
* Исправлено подключение файлов методом checkCustomFile
|
||||||
|
|
||||||
## 2019-02-07 3.4.2
|
## 2019-02-07 3.4.2
|
||||||
* Исправлено изменение типа оплаты на стороне WC
|
* Исправлено изменение типа оплаты на стороне WC
|
||||||
* Добавлен вывод неактивных типов оплаты в настройках
|
* Добавлен вывод неактивных типов оплаты в настройках
|
||||||
|
@ -117,7 +117,7 @@ if (!class_exists('WC_Retailcrm_Base')) {
|
|||||||
return WP_CONTENT_DIR . '/retailcrm-custom/class-wc-retailcrm-' . $file . '.php';
|
return WP_CONTENT_DIR . '/retailcrm-custom/class-wc-retailcrm-' . $file . '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'class-wc-retailcrm-' . $file . '.php';
|
return WP_PLUGIN_DIR . '/woo-retailcrm/include/class-wc-retailcrm-' . $file . '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generate_icml() {
|
public function generate_icml() {
|
||||||
|
@ -375,7 +375,7 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
|||||||
$payment_types = $payment->payment_gateways();
|
$payment_types = $payment->payment_gateways();
|
||||||
|
|
||||||
if (isset($payment_types[$options[$order['paymentType']]])) {
|
if (isset($payment_types[$options[$order['paymentType']]])) {
|
||||||
$order->set_payment_method($payment_types[$options[$order['paymentType']]]);
|
$wc_order->set_payment_method($payment_types[$options[$order['paymentType']]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -503,18 +503,17 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
|||||||
$payment_types = $payment->payment_gateways();
|
$payment_types = $payment->payment_gateways();
|
||||||
$payments = $order['payments'];
|
$payments = $order['payments'];
|
||||||
$paymentType = end($payments);
|
$paymentType = end($payments);
|
||||||
|
|
||||||
if (isset($options[$paymentType['type']]) && isset($payment_types[$options[$paymentType['type']]])) {
|
if (isset($options[$paymentType['type']]) && isset($payment_types[$options[$paymentType['type']]])) {
|
||||||
$wc_order->set_payment_method($payment_types[$options[$paymentType['type']]]);
|
$wc_order->set_payment_method($payment_types[$options[$paymentType['type']]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (isset($order_record['paymentType']) && $order['paymentType']) {
|
if (isset($order['paymentType']) && $order['paymentType']) {
|
||||||
$payment = WC_Payment_Gateways::instance();
|
$payment = WC_Payment_Gateways::instance();
|
||||||
$payment_types = $payment->payment_gateways();
|
$payment_types = $payment->payment_gateways();
|
||||||
|
|
||||||
if (isset($options[$order_record['paymentType']]) && isset($payment_types[$options[$order_record['paymentType']]])) {
|
if (isset($options[$order['paymentType']]) && isset($payment_types[$options[$order['paymentType']]])) {
|
||||||
$wc_order->set_payment_method($payment_types[$options[$order['paymentType']]]);
|
$wc_order->set_payment_method($payment_types[$options[$order['paymentType']]]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -568,6 +567,8 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
|||||||
'externalId' => (int) $wc_order->get_id()
|
'externalId' => (int) $wc_order->get_id()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$wc_order->save();
|
||||||
|
|
||||||
$this->retailcrm->ordersFixExternalIds($ids);
|
$this->retailcrm->ordersFixExternalIds($ids);
|
||||||
|
|
||||||
return $wc_order->get_id();
|
return $wc_order->get_id();
|
||||||
@ -580,8 +581,8 @@ if ( ! class_exists( 'WC_Retailcrm_History' ) ) :
|
|||||||
*/
|
*/
|
||||||
public static function assemblyOrder($orderHistory)
|
public static function assemblyOrder($orderHistory)
|
||||||
{
|
{
|
||||||
if (file_exists(WP_CONTENT_DIR . '/plugins/woo-retailcrm/config/objects.xml')) {
|
if (file_exists(__DIR__ . '/../config/objects.xml')) {
|
||||||
$objects = simplexml_load_file(WP_CONTENT_DIR . '/plugins/woo-retailcrm/config/objects.xml');
|
$objects = simplexml_load_file(__DIR__ . '/../config/objects.xml');
|
||||||
foreach($objects->fields->field as $object) {
|
foreach($objects->fields->field as $object) {
|
||||||
$fields[(string)$object["group"]][(string)$object["id"]] = (string)$object;
|
$fields[(string)$object["group"]][(string)$object["id"]] = (string)$object;
|
||||||
}
|
}
|
||||||
|
@ -45,6 +45,10 @@ API-ключ должен быть для отдельного магазина
|
|||||||
2. В появившихся списках справочников настройте соответствие способов доставки и оплаты, а так же статусов заказов. Отметьте галочку "Выгружать остатки", если хотите выгружать остатки из Retailcrm в магазин (подробнее смотрите в описании).
|
2. В появившихся списках справочников настройте соответствие способов доставки и оплаты, а так же статусов заказов. Отметьте галочку "Выгружать остатки", если хотите выгружать остатки из Retailcrm в магазин (подробнее смотрите в описании).
|
||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
= 3.4.3 =
|
||||||
|
* Исправлено сохранение типа оплаты при создании заказа по истории на стороне WC
|
||||||
|
* Исправлено сохранение типа оплаты при ризменении заказа по истории на стороне WC
|
||||||
|
|
||||||
= 3.4.2 =
|
= 3.4.2 =
|
||||||
* Исправлено изменение типа оплаты на стороне WC
|
* Исправлено изменение типа оплаты на стороне WC
|
||||||
* Добавлен вывод неактивных типов оплаты в настройках
|
* Добавлен вывод неактивных типов оплаты в настройках
|
||||||
|
@ -66,12 +66,13 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
$retailcrm_history = new \WC_Retailcrm_History($this->apiMock);
|
$retailcrm_history = new \WC_Retailcrm_History($this->apiMock);
|
||||||
$retailcrm_history->getHistory();
|
$retailcrm_history->getHistory();
|
||||||
|
|
||||||
$orders = wc_get_orders(array('numberposts' => 10));
|
$orders = wc_get_orders(array('numberposts' => -1));
|
||||||
$order_added = end($orders);
|
$order_added = end($orders);
|
||||||
$order_added_items = $order_added->get_items();
|
$order_added_items = $order_added->get_items();
|
||||||
$order_added_item = reset($order_added_items);
|
$order_added_item = reset($order_added_items);
|
||||||
$shipping_address = $order_added->get_address('shipping');
|
$shipping_address = $order_added->get_address('shipping');
|
||||||
$billing_address = $order_added->get_address('billing');
|
$billing_address = $order_added->get_address('billing');
|
||||||
|
|
||||||
$options = get_option(\WC_Retailcrm_Base::$option_key);
|
$options = get_option(\WC_Retailcrm_Base::$option_key);
|
||||||
|
|
||||||
$this->assertEquals(self::STATUS_1, $options[$order_added->get_status()]);
|
$this->assertEquals(self::STATUS_1, $options[$order_added->get_status()]);
|
||||||
@ -90,6 +91,7 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
$this->assertNotEmpty($billing_address['city']);
|
$this->assertNotEmpty($billing_address['city']);
|
||||||
$this->assertNotEmpty($billing_address['country']);
|
$this->assertNotEmpty($billing_address['country']);
|
||||||
$this->assertNotEmpty($billing_address['state']);
|
$this->assertNotEmpty($billing_address['state']);
|
||||||
|
$this->assertEquals('payment4', $options[$order_added->get_payment_method()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -136,7 +138,7 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
* @dataProvider dataProvider
|
* @dataProvider dataProvider
|
||||||
* @param $api_version
|
* @param $api_version
|
||||||
*/
|
*/
|
||||||
public function test_history_order_update_status($api_version)
|
public function test_history_order_update($api_version)
|
||||||
{
|
{
|
||||||
$this->setOptions($api_version);
|
$this->setOptions($api_version);
|
||||||
|
|
||||||
@ -153,7 +155,7 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
$order = WC_Helper_Order::create_order(0);
|
$order = WC_Helper_Order::create_order(0);
|
||||||
|
|
||||||
$this->ordersHistoryResponse->setResponse(
|
$this->ordersHistoryResponse->setResponse(
|
||||||
$this->get_history_data_status_update($order->get_id())
|
$this->get_history_data_update($order->get_id(), $api_version)
|
||||||
);
|
);
|
||||||
|
|
||||||
$this->apiMock->expects($this->any())->method('customersHistory')->willReturn($this->customersHistoryResponse);
|
$this->apiMock->expects($this->any())->method('customersHistory')->willReturn($this->customersHistoryResponse);
|
||||||
@ -166,6 +168,7 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
$options = get_option(\WC_Retailcrm_Base::$option_key);
|
$options = get_option(\WC_Retailcrm_Base::$option_key);
|
||||||
|
|
||||||
$this->assertEquals(self::STATUS_2, $options[$order_updated->get_status()]);
|
$this->assertEquals(self::STATUS_2, $options[$order_updated->get_status()]);
|
||||||
|
$this->assertEquals('payment2', $options[$order_updated->get_payment_method()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataProvider()
|
public function dataProvider()
|
||||||
@ -289,6 +292,14 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
'purchasePrice' => 50
|
'purchasePrice' => 50
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
'paymentType' => 'payment4',
|
||||||
|
'payments' => array(
|
||||||
|
array(
|
||||||
|
'id'=> 1,
|
||||||
|
'type'=> 'payment4',
|
||||||
|
'amount'=> 100,
|
||||||
|
)
|
||||||
|
),
|
||||||
'fromApi' => false,
|
'fromApi' => false,
|
||||||
'length' => 0,
|
'length' => 0,
|
||||||
'width' => 0,
|
'width' => 0,
|
||||||
@ -351,9 +362,9 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private function get_history_data_status_update($order_id)
|
private function get_history_data_update($order_id, $api_version)
|
||||||
{
|
{
|
||||||
return array(
|
$history = array(
|
||||||
'success' => true,
|
'success' => true,
|
||||||
'history' => array(
|
'history' => array(
|
||||||
array(
|
array(
|
||||||
@ -380,5 +391,62 @@ class WC_Retailcrm_History_Test extends WC_Retailcrm_Test_Case_Helper
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$payment_v5 = array(
|
||||||
|
'id' => 4,
|
||||||
|
'createdAt' => '2018-01-01 00:03:00',
|
||||||
|
'source' => 'user',
|
||||||
|
'user' => array(
|
||||||
|
'id' => 1
|
||||||
|
),
|
||||||
|
'field' => 'payments',
|
||||||
|
'oldValue' => null,
|
||||||
|
'newValue' => array(
|
||||||
|
'code' => 'payment2'
|
||||||
|
),
|
||||||
|
'order' => array(
|
||||||
|
'id' => 2,
|
||||||
|
'externalId' => $order_id,
|
||||||
|
'managerId' => 6,
|
||||||
|
'site' => 'test-com',
|
||||||
|
'status' => self::STATUS_2
|
||||||
|
),
|
||||||
|
'payment' => array(
|
||||||
|
'id' => 1,
|
||||||
|
'type' => 'payment2',
|
||||||
|
"amount" => 100
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$payment_v4 = array(
|
||||||
|
'id' => 4,
|
||||||
|
'createdAt' => '2018-01-01 00:03:00',
|
||||||
|
'source' => 'user',
|
||||||
|
'user' => array(
|
||||||
|
'id' => 1
|
||||||
|
),
|
||||||
|
'field' => 'payment_type',
|
||||||
|
'oldValue' => null,
|
||||||
|
'newValue' => array(
|
||||||
|
'code' => 'payment2'
|
||||||
|
),
|
||||||
|
'order' => array(
|
||||||
|
'id' => 2,
|
||||||
|
'externalId' => $order_id,
|
||||||
|
'managerId' => 6,
|
||||||
|
'site' => 'test-com',
|
||||||
|
'status' => self::STATUS_2
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
if ($api_version == 'v4') {
|
||||||
|
array_push($history['history'], $payment_v4);
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($api_version == 'v5') {
|
||||||
|
array_push($history['history'], $payment_v5);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $history;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user