0059d7442d303fb19a5cc760caf820e4899a1cd7
[motion2.git] / server / api / contactItemType / contactItemType.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 _0x9a20=['error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x366ce1,_0x41a82e){var _0x2d6265=function(_0x4e21b7){while(--_0x4e21b7){_0x366ce1['push'](_0x366ce1['shift']());}};_0x2d6265(++_0x41a82e);}(_0x9a20,0x158));var _0x09a2=function(_0x495291,_0x568dad){_0x495291=_0x495291-0x0;var _0x1fef5e=_0x9a20[_0x495291];return _0x1fef5e;};'use strict';var _=require(_0x09a2('0x0'));var util=require(_0x09a2('0x1'));var moment=require(_0x09a2('0x2'));var BPromise=require(_0x09a2('0x3'));var rs=require(_0x09a2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x09a2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x09a2('0x6'))('rpc');var config=require(_0x09a2('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x09a2('0x8')][_0x09a2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b235a,_0x34b4c0,_0x12d8b4){return new BPromise(function(_0x1a553e,_0xaa35b4){return client['request'](_0x4b235a,_0x12d8b4)['then'](function(_0x348b6f){logger[_0x09a2('0xa')](_0x09a2('0xb'),_0x34b4c0,_0x09a2('0xc'));logger[_0x09a2('0xd')](_0x09a2('0xe'),_0x34b4c0,_0x09a2('0xc'),JSON[_0x09a2('0xf')](_0x348b6f));if(_0x348b6f[_0x09a2('0x10')]){if(_0x348b6f[_0x09a2('0x10')][_0x09a2('0x11')]===0x1f4){logger['error'](_0x09a2('0xb'),_0x34b4c0,_0x348b6f[_0x09a2('0x10')][_0x09a2('0x12')]);return _0xaa35b4(_0x348b6f[_0x09a2('0x10')][_0x09a2('0x12')]);}logger[_0x09a2('0x10')](_0x09a2('0xb'),_0x34b4c0,_0x348b6f[_0x09a2('0x10')][_0x09a2('0x12')]);return _0x1a553e(_0x348b6f[_0x09a2('0x10')][_0x09a2('0x12')]);}else{logger[_0x09a2('0xa')]('ContactItemType,\x20%s,\x20%s',_0x34b4c0,_0x09a2('0xc'));_0x1a553e(_0x348b6f[_0x09a2('0x13')]['message']);}})['catch'](function(_0x46f82d){logger[_0x09a2('0x10')](_0x09a2('0xb'),_0x34b4c0,_0x46f82d);_0xaa35b4(_0x46f82d);});});}