mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-24 14:16:07 +03:00
v3.2.2
This commit is contained in:
parent
f79ed21018
commit
3521bb603e
@ -1,3 +1,6 @@
|
|||||||
|
## v.3.2.2
|
||||||
|
* Убрана генерация externalId покупателя при заказе без регистрации на сайте.
|
||||||
|
|
||||||
## v.3.2.1
|
## v.3.2.1
|
||||||
* Изменена логика передачи данных по заказам и клиентам. Контактные данные по доставке передаются в карточку заказа, контактные данные плательщика в карточку клиента.
|
* Изменена логика передачи данных по заказам и клиентам. Контактные данные по доставке передаются в карточку заказа, контактные данные плательщика в карточку клиента.
|
||||||
|
|
||||||
|
@ -92,7 +92,6 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
|
|
||||||
if (!isset($order['customer']['externalId']) && !isset($order['customer']['id'])) {
|
if (!isset($order['customer']['externalId']) && !isset($order['customer']['id'])) {
|
||||||
$new_customer = array(
|
$new_customer = array(
|
||||||
'externalId' => uniqid(),
|
|
||||||
'firstName' => $order_data['firstname'],
|
'firstName' => $order_data['firstname'],
|
||||||
'lastName' => $order_data['lastname'],
|
'lastName' => $order_data['lastname'],
|
||||||
'email' => $order_data['email'],
|
'email' => $order_data['email'],
|
||||||
|
@ -38,7 +38,6 @@ class ModelExtensionRetailcrmOrder extends Model {
|
|||||||
|
|
||||||
if (!isset($order['customer']['externalId']) && !isset($order['customer']['id'])) {
|
if (!isset($order['customer']['externalId']) && !isset($order['customer']['id'])) {
|
||||||
$new_customer = array(
|
$new_customer = array(
|
||||||
'externalId' => uniqid(),
|
|
||||||
'firstName' => $data['firstname'],
|
'firstName' => $data['firstname'],
|
||||||
'lastName' => $data['lastname'],
|
'lastName' => $data['lastname'],
|
||||||
'email' => $data['email'],
|
'email' => $data['email'],
|
||||||
|
@ -183,6 +183,8 @@ class ModelRetailcrmOrderAdminTest extends OpenCartTest
|
|||||||
$this->assertArrayHasKey('payments', $orderSend);
|
$this->assertArrayHasKey('payments', $orderSend);
|
||||||
$this->assertArrayHasKey('customerComment', $orderSend);
|
$this->assertArrayHasKey('customerComment', $orderSend);
|
||||||
$this->assertArrayHasKey('customer', $orderSend);
|
$this->assertArrayHasKey('customer', $orderSend);
|
||||||
|
$this->assertArrayNotHasKey('externalId', $orderSend['customer']);
|
||||||
|
$this->assertArrayHasKey('id', $orderSend['customer']);
|
||||||
$this->assertNotEmpty($orderSend['payments']);
|
$this->assertNotEmpty($orderSend['payments']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -163,6 +163,56 @@ class ModelRetailcrmOrderCatalogTest extends OpenCartTest
|
|||||||
$this->assertArrayHasKey('customerComment', $orderSend);
|
$this->assertArrayHasKey('customerComment', $orderSend);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function testOrderCreateWithoutCustomerTest()
|
||||||
|
{
|
||||||
|
$order_id = self::ORDER_ID;
|
||||||
|
$orderCheckoutModel = $this->loadModel('checkout/order');
|
||||||
|
$orderAccountModel = $this->loadModel('account/order');
|
||||||
|
$order = $orderCheckoutModel->getOrder($order_id);
|
||||||
|
$order['products'] = $orderAccountModel->getOrderProducts($order_id);
|
||||||
|
$order['totals'] = $orderAccountModel->getOrderTotals($order_id);
|
||||||
|
|
||||||
|
foreach($order['products'] as $key => $product) {
|
||||||
|
$order['products'][$key]['option'] = $orderAccountModel->getOrderOptions($product['order_id'], $product['order_product_id']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$responseCustomerCreate = new \RetailcrmApiResponse(
|
||||||
|
201,
|
||||||
|
json_encode(
|
||||||
|
array(
|
||||||
|
'success' => true,
|
||||||
|
'id' => 1
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$responseCustomerList = new \RetailcrmApiResponse(
|
||||||
|
201,
|
||||||
|
json_encode(
|
||||||
|
array(
|
||||||
|
'success' => true,
|
||||||
|
"pagination"=> [
|
||||||
|
"limit"=>20,
|
||||||
|
"totalCount"=> 0,
|
||||||
|
"currentPage"=> 1,
|
||||||
|
"totalPageCount"=> 0
|
||||||
|
],
|
||||||
|
"customers"=> []
|
||||||
|
)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->apiClientMock->expects($this->any())->method('customersList')->willReturn($responseCustomerList);
|
||||||
|
$this->apiClientMock->expects($this->any())->method('customersCreate')->willReturn($responseCustomerCreate);
|
||||||
|
$orderProcess = $this->orderModel->processOrder($order);
|
||||||
|
$orderSend = $this->orderModel->sendToCrm($orderProcess, $this->apiClientMock, $order);
|
||||||
|
|
||||||
|
$this->assertArrayHasKey('customer', $orderSend);
|
||||||
|
$this->assertArrayNotHasKey('externalId', $orderSend['customer']);
|
||||||
|
$this->assertArrayHasKey('id', $orderSend['customer']);
|
||||||
|
$this->assertEquals(1, $orderSend['customer']['id']);
|
||||||
|
}
|
||||||
|
|
||||||
protected function setSetting($code, $data, $store_id = 0) {
|
protected function setSetting($code, $data, $store_id = 0) {
|
||||||
$this->db->query("DELETE FROM `" . DB_PREFIX . "setting` WHERE store_id = '" . (int)$store_id . "' AND `code` = '" . $this->db->escape($code) . "'");
|
$this->db->query("DELETE FROM `" . DB_PREFIX . "setting` WHERE store_id = '" . (int)$store_id . "' AND `code` = '" . $this->db->escape($code) . "'");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user