ce70a33f69952e9152ef307c5226e05dfad7a417
[motion2.git] / server / api / intDeskField / intDeskField.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 _0x215f=['code','DeskField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','error'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x215f,0x84));var _0xf215=function(_0x931ab9,_0x332b45){_0x931ab9=_0x931ab9-0x0;var _0x56f614=_0x215f[_0x931ab9];return _0x56f614;};'use strict';var _=require(_0xf215('0x0'));var util=require(_0xf215('0x1'));var moment=require(_0xf215('0x2'));var BPromise=require('bluebird');var rs=require(_0xf215('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf215('0x4'))['db'];var utils=require(_0xf215('0x5'));var logger=require(_0xf215('0x6'))(_0xf215('0x7'));var config=require('../../config/environment');var jayson=require(_0xf215('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51f309,_0x3231f1,_0x575be1){return new BPromise(function(_0x7eae93,_0x514c53){return client[_0xf215('0x9')](_0x51f309,_0x575be1)[_0xf215('0xa')](function(_0x3e8721){logger['info']('DeskField,\x20%s,\x20%s',_0x3231f1,_0xf215('0xb'));logger[_0xf215('0xc')](_0xf215('0xd'),_0x3231f1,_0xf215('0xb'),JSON['stringify'](_0x3e8721));if(_0x3e8721[_0xf215('0xe')]){if(_0x3e8721['error'][_0xf215('0xf')]===0x1f4){logger[_0xf215('0xe')](_0xf215('0x10'),_0x3231f1,_0x3e8721[_0xf215('0xe')][_0xf215('0x11')]);return _0x514c53(_0x3e8721['error'][_0xf215('0x11')]);}logger[_0xf215('0xe')](_0xf215('0x10'),_0x3231f1,_0x3e8721[_0xf215('0xe')][_0xf215('0x11')]);return _0x7eae93(_0x3e8721[_0xf215('0xe')]['message']);}else{logger[_0xf215('0x12')](_0xf215('0x10'),_0x3231f1,_0xf215('0xb'));_0x7eae93(_0x3e8721[_0xf215('0x13')][_0xf215('0x11')]);}})[_0xf215('0x14')](function(_0x5289a5){logger[_0xf215('0xe')](_0xf215('0x10'),_0x3231f1,_0x5289a5);_0x514c53(_0x5289a5);});});}