Commit 38062638 authored by Kulya's avatar Kulya 😊

Begin adding Client to Billz1

parent 1bea6135
...@@ -714,7 +714,7 @@ class AloVoiceRest ...@@ -714,7 +714,7 @@ class AloVoiceRest
} }
$res = BxRest::call("sale.order.list",[ $res = BxRest::call("sale.order.list",[
"select"=>["id","price","accountNumber","dateUpdate"], "select"=>["id"], //,"price","accountNumber","dateUpdate"],
"filter"=>$sFilter "filter"=>$sFilter
]); ]);
...@@ -751,6 +751,8 @@ class AloVoiceRest ...@@ -751,6 +751,8 @@ class AloVoiceRest
]; ];
$arResOrders[] = BillzRest::createOrder($arOrderParams); $arResOrders[] = BillzRest::createOrder($arOrderParams);
$arOrder = self::process_order_client($order["id"]);
} }
self::set_orders_last_update(); self::set_orders_last_update();
...@@ -768,6 +770,26 @@ class AloVoiceRest ...@@ -768,6 +770,26 @@ class AloVoiceRest
} }
private function process_order_client($id=false) {
$res = BxRest::call("sale.order.get",[ "id" => $id ]);
ALVC::eLog($res["result"],"------ Billz :: Order RES:");
if(empty($res["result"]["order"]['clients'])){ return false; }
$client = $res["result"]["order"]['clients'][0];
$clientId = $client["entityId"];
$clientTypeId = $client["entityTypeId"];
if($clientTypeId==3){
$resCont = BxRest::call("crm.contact.get",[ "id" => $clientId ]);
ALVC::eLog($resCont["result"],"------ Billz :: Client(contact) RES:");
if(!empty($resCont["UF_CRM_1644411792448"])){
}
}
//
}
private function get_bx_order_products($id=false) { private function get_bx_order_products($id=false) {
// if(empty($id)){ return false; } // if(empty($id)){ return false; }
$res = BxRest::call("sale.basketItem.list",[ $res = BxRest::call("sale.basketItem.list",[
......
...@@ -32,6 +32,30 @@ require_once (__DIR__.'/keys.php'); ...@@ -32,6 +32,30 @@ require_once (__DIR__.'/keys.php');
return $result; return $result;
} }
public static function createClient($params=false) {
/*
{
"jsonrpc": "2.0",
"method": "client.create",
"params": {
"phone": "998931830000",
"firstName": "Ivanoff",
"lastName": "Fedor",
"gender": 0,
"birthDate":"1980-08-12T00:00:00Z"
},
"id": "1200"
}
*/
$client_params = [ "firstName" => (!empty($params["NAME"])) ? $params["NAME"] : "New Client"];
// if(!empty())
$result = static::callCurl("client.create",$client_params);
return $result;
}
public static function createOrder($params=false) { public static function createOrder($params=false) {
/* /*
order_id order_id
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment