97108c696d4e79dcd605a1fb97d04551da14903f
[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 _0xb5ba=['CmContactHasItem,\x20%s,\x20%s','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','then'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xb5ba,0x68));var _0xab5b=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xb5ba[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0xab5b('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xab5b('0x1'));var fs=require('fs');var Redis=require(_0xab5b('0x2'));var db=require(_0xab5b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab5b('0x4'))(_0xab5b('0x5'));var config=require(_0xab5b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xab5b('0x7')][_0xab5b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x493237,_0x421591,_0x47f1d9){return new BPromise(function(_0x914dd3,_0x5e98a8){return client['request'](_0x493237,_0x47f1d9)[_0xab5b('0x9')](function(_0x2269d1){logger['info'](_0xab5b('0xa'),_0x421591,'request\x20sent');logger['debug'](_0xab5b('0xb'),_0x421591,_0xab5b('0xc'),JSON[_0xab5b('0xd')](_0x2269d1));if(_0x2269d1[_0xab5b('0xe')]){if(_0x2269d1[_0xab5b('0xe')][_0xab5b('0xf')]===0x1f4){logger['error'](_0xab5b('0xa'),_0x421591,_0x2269d1[_0xab5b('0xe')][_0xab5b('0x10')]);return _0x5e98a8(_0x2269d1[_0xab5b('0xe')][_0xab5b('0x10')]);}logger[_0xab5b('0xe')]('CmContactHasItem,\x20%s,\x20%s',_0x421591,_0x2269d1[_0xab5b('0xe')][_0xab5b('0x10')]);return _0x914dd3(_0x2269d1['error'][_0xab5b('0x10')]);}else{logger['info'](_0xab5b('0xa'),_0x421591,_0xab5b('0xc'));_0x914dd3(_0x2269d1[_0xab5b('0x11')]['message']);}})[_0xab5b('0x12')](function(_0x3492b3){logger[_0xab5b('0xe')](_0xab5b('0xa'),_0x421591,_0x3492b3);_0x5e98a8(_0x3492b3);});});}