Built motion from commit da617fac.|2.6.6
[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 _0x463e=['client','http','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','error','message','result','util','moment','randomstring','../../config/logger','rpc','jayson/promise'];(function(_0x4a5237,_0xf1b3ef){var _0x57d0ff=function(_0x43b4fe){while(--_0x43b4fe){_0x4a5237['push'](_0x4a5237['shift']());}};_0x57d0ff(++_0xf1b3ef);}(_0x463e,0x10a));var _0xe463=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x463e[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0xe463('0x0'));var moment=require(_0xe463('0x1'));var BPromise=require('bluebird');var rs=require(_0xe463('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe463('0x3'))(_0xe463('0x4'));var config=require('../../config/environment');var jayson=require(_0xe463('0x5'));var client=jayson[_0xe463('0x6')][_0xe463('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2b6356,_0x2a19ba,_0x1e1210){return new BPromise(function(_0x343494,_0x5e98cd){return client['request'](_0x2b6356,_0x1e1210)[_0xe463('0x8')](function(_0x1b4b18){logger[_0xe463('0x9')](_0xe463('0xa'),_0x2a19ba,_0xe463('0xb'));logger[_0xe463('0xc')](_0xe463('0xd'),_0x2a19ba,'request\x20sent',JSON['stringify'](_0x1b4b18));if(_0x1b4b18['error']){if(_0x1b4b18['error']['code']===0x1f4){logger['error'](_0xe463('0xa'),_0x2a19ba,_0x1b4b18[_0xe463('0xe')]['message']);return _0x5e98cd(_0x1b4b18[_0xe463('0xe')][_0xe463('0xf')]);}logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x2a19ba,_0x1b4b18[_0xe463('0xe')][_0xe463('0xf')]);return _0x343494(_0x1b4b18[_0xe463('0xe')][_0xe463('0xf')]);}else{logger[_0xe463('0x9')](_0xe463('0xa'),_0x2a19ba,_0xe463('0xb'));_0x343494(_0x1b4b18[_0xe463('0x10')]['message']);}})['catch'](function(_0x1cadd9){logger[_0xe463('0xe')](_0xe463('0xa'),_0x2a19ba,_0x1cadd9);_0x5e98cd(_0x1cadd9);});});}