1c80c369a32f537eb8fcb339dd5e9883693f7823
[motion2.git] / server / api / cmCustomField / cmCustomField.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 _0xf663=['stringify','code','error','message','result','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xf663,0x16b));var _0x3f66=function(_0x53f1ee,_0x29cff6){_0x53f1ee=_0x53f1ee-0x0;var _0x3638da=_0xf663[_0x53f1ee];return _0x3638da;};'use strict';var _=require(_0x3f66('0x0'));var util=require('util');var moment=require(_0x3f66('0x1'));var BPromise=require('bluebird');var rs=require(_0x3f66('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3f66('0x3'));var logger=require(_0x3f66('0x4'))(_0x3f66('0x5'));var config=require(_0x3f66('0x6'));var jayson=require(_0x3f66('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1fc9bb,_0x4d677f,_0x31ee7e){return new BPromise(function(_0x2fa516,_0x246618){return client[_0x3f66('0x8')](_0x1fc9bb,_0x31ee7e)[_0x3f66('0x9')](function(_0x4e9b80){logger[_0x3f66('0xa')](_0x3f66('0xb'),_0x4d677f,_0x3f66('0xc'));logger[_0x3f66('0xd')](_0x3f66('0xe'),_0x4d677f,_0x3f66('0xc'),JSON[_0x3f66('0xf')](_0x4e9b80));if(_0x4e9b80['error']){if(_0x4e9b80['error'][_0x3f66('0x10')]===0x1f4){logger[_0x3f66('0x11')](_0x3f66('0xb'),_0x4d677f,_0x4e9b80['error'][_0x3f66('0x12')]);return _0x246618(_0x4e9b80[_0x3f66('0x11')]['message']);}logger[_0x3f66('0x11')](_0x3f66('0xb'),_0x4d677f,_0x4e9b80[_0x3f66('0x11')]['message']);return _0x2fa516(_0x4e9b80[_0x3f66('0x11')][_0x3f66('0x12')]);}else{logger[_0x3f66('0xa')]('CmCustomField,\x20%s,\x20%s',_0x4d677f,_0x3f66('0xc'));_0x2fa516(_0x4e9b80[_0x3f66('0x13')][_0x3f66('0x12')]);}})[_0x3f66('0x14')](function(_0x1a4bc2){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4d677f,_0x1a4bc2);_0x246618(_0x1a4bc2);});});}