Built motion from commit b5996064.|2.6.21
[motion2.git] / server / api / cmContactHasItem / cmContactHasItem.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and   *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0xe6a7=['randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','http','request','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','error','message','result','lodash','util','moment'];(function(_0x43a5c7,_0x2286bf){var _0x3b12a2=function(_0x1f8f53){while(--_0x1f8f53){_0x43a5c7['push'](_0x43a5c7['shift']());}};_0x3b12a2(++_0x2286bf);}(_0xe6a7,0xeb));var _0x7e6a=function(_0x12183a,_0x44e842){_0x12183a=_0x12183a-0x0;var _0x3ffec9=_0xe6a7[_0x12183a];return _0x3ffec9;};'use strict';var _=require(_0x7e6a('0x0'));var util=require(_0x7e6a('0x1'));var moment=require(_0x7e6a('0x2'));var BPromise=require('bluebird');var rs=require(_0x7e6a('0x3'));var fs=require('fs');var Redis=require(_0x7e6a('0x4'));var db=require(_0x7e6a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7e6a('0x6'));var jayson=require(_0x7e6a('0x7'));var client=jayson['client'][_0x7e6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3ea9b0,_0xface8d,_0x1908b1){return new BPromise(function(_0x25ac7c,_0xf3bd41){return client[_0x7e6a('0x9')](_0x3ea9b0,_0x1908b1)['then'](function(_0x31573b){logger[_0x7e6a('0xa')](_0x7e6a('0xb'),_0xface8d,_0x7e6a('0xc'));logger[_0x7e6a('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0xface8d,'request\x20sent',JSON['stringify'](_0x31573b));if(_0x31573b[_0x7e6a('0xe')]){if(_0x31573b['error']['code']===0x1f4){logger[_0x7e6a('0xe')](_0x7e6a('0xb'),_0xface8d,_0x31573b[_0x7e6a('0xe')]['message']);return _0xf3bd41(_0x31573b[_0x7e6a('0xe')][_0x7e6a('0xf')]);}logger[_0x7e6a('0xe')](_0x7e6a('0xb'),_0xface8d,_0x31573b[_0x7e6a('0xe')]['message']);return _0x25ac7c(_0x31573b[_0x7e6a('0xe')][_0x7e6a('0xf')]);}else{logger['info'](_0x7e6a('0xb'),_0xface8d,_0x7e6a('0xc'));_0x25ac7c(_0x31573b[_0x7e6a('0x10')][_0x7e6a('0xf')]);}})['catch'](function(_0x39f535){logger[_0x7e6a('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0xface8d,_0x39f535);_0xf3bd41(_0x39f535);});});}