83f52492d106fc50c35bc334e94eb709d8ef1c54
[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 _0x889d=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x56e422,_0x443ad9){var _0x5954a8=function(_0x3f50bb){while(--_0x3f50bb){_0x56e422['push'](_0x56e422['shift']());}};_0x5954a8(++_0x443ad9);}(_0x889d,0x105));var _0xd889=function(_0x5d20ca,_0x1613ce){_0x5d20ca=_0x5d20ca-0x0;var _0x9d185c=_0x889d[_0x5d20ca];return _0x9d185c;};'use strict';var _=require(_0xd889('0x0'));var util=require(_0xd889('0x1'));var moment=require('moment');var BPromise=require(_0xd889('0x2'));var rs=require(_0xd889('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd889('0x4'))['db'];var utils=require(_0xd889('0x5'));var logger=require(_0xd889('0x6'))(_0xd889('0x7'));var config=require(_0xd889('0x8'));var jayson=require(_0xd889('0x9'));var client=jayson[_0xd889('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e107f,_0x7736ba,_0x5d3946){return new BPromise(function(_0x5b4856,_0xf21f11){return client[_0xd889('0xb')](_0x2e107f,_0x5d3946)[_0xd889('0xc')](function(_0x36063b){logger[_0xd889('0xd')](_0xd889('0xe'),_0x7736ba,_0xd889('0xf'));logger[_0xd889('0x10')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x7736ba,_0xd889('0xf'),JSON[_0xd889('0x11')](_0x36063b));if(_0x36063b[_0xd889('0x12')]){if(_0x36063b['error'][_0xd889('0x13')]===0x1f4){logger[_0xd889('0x12')](_0xd889('0xe'),_0x7736ba,_0x36063b[_0xd889('0x12')][_0xd889('0x14')]);return _0xf21f11(_0x36063b[_0xd889('0x12')][_0xd889('0x14')]);}logger['error']('CmCompany,\x20%s,\x20%s',_0x7736ba,_0x36063b[_0xd889('0x12')][_0xd889('0x14')]);return _0x5b4856(_0x36063b[_0xd889('0x12')]['message']);}else{logger[_0xd889('0xd')](_0xd889('0xe'),_0x7736ba,_0xd889('0xf'));_0x5b4856(_0x36063b[_0xd889('0x15')][_0xd889('0x14')]);}})[_0xd889('0x16')](function(_0x29bf47){logger[_0xd889('0x12')](_0xd889('0xe'),_0x7736ba,_0x29bf47);_0xf21f11(_0x29bf47);});});}