Built motion from commit 9d0783e6.|2.6.13
[motion2.git] / server / api / cmCompany / cmCompany.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 _0xbc4b=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCompany,\x20%s,\x20%s','debug'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbc4b,0x98));var _0xbbc4=function(_0x37a02f,_0x570d8e){_0x37a02f=_0x37a02f-0x0;var _0x2a9b39=_0xbc4b[_0x37a02f];return _0x2a9b39;};'use strict';var _=require(_0xbbc4('0x0'));var util=require(_0xbbc4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbbc4('0x2'));var fs=require('fs');var Redis=require(_0xbbc4('0x3'));var db=require(_0xbbc4('0x4'))['db'];var utils=require(_0xbbc4('0x5'));var logger=require(_0xbbc4('0x6'))(_0xbbc4('0x7'));var config=require(_0xbbc4('0x8'));var jayson=require(_0xbbc4('0x9'));var client=jayson[_0xbbc4('0xa')][_0xbbc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x510ea6,_0x59c8e0,_0x523001){return new BPromise(function(_0x215464,_0x2cd34a){return client[_0xbbc4('0xc')](_0x510ea6,_0x523001)[_0xbbc4('0xd')](function(_0x44a866){logger['info'](_0xbbc4('0xe'),_0x59c8e0,'request\x20sent');logger[_0xbbc4('0xf')](_0xbbc4('0x10'),_0x59c8e0,_0xbbc4('0x11'),JSON['stringify'](_0x44a866));if(_0x44a866[_0xbbc4('0x12')]){if(_0x44a866[_0xbbc4('0x12')][_0xbbc4('0x13')]===0x1f4){logger['error'](_0xbbc4('0xe'),_0x59c8e0,_0x44a866[_0xbbc4('0x12')][_0xbbc4('0x14')]);return _0x2cd34a(_0x44a866[_0xbbc4('0x12')]['message']);}logger[_0xbbc4('0x12')](_0xbbc4('0xe'),_0x59c8e0,_0x44a866[_0xbbc4('0x12')]['message']);return _0x215464(_0x44a866[_0xbbc4('0x12')][_0xbbc4('0x14')]);}else{logger[_0xbbc4('0x15')](_0xbbc4('0xe'),_0x59c8e0,_0xbbc4('0x11'));_0x215464(_0x44a866[_0xbbc4('0x16')][_0xbbc4('0x14')]);}})[_0xbbc4('0x17')](function(_0x50853e){logger[_0xbbc4('0x12')](_0xbbc4('0xe'),_0x59c8e0,_0x50853e);_0x2cd34a(_0x50853e);});});}