6f8bf4ac31af3e07aef3c8b0fb1d7dc503c619bc
[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 _0xd6b2=['stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd6b2,0x130));var _0x2d6b=function(_0x419c32,_0x3bdcb6){_0x419c32=_0x419c32-0x0;var _0x39132b=_0xd6b2[_0x419c32];return _0x39132b;};'use strict';var _=require(_0x2d6b('0x0'));var util=require(_0x2d6b('0x1'));var moment=require('moment');var BPromise=require(_0x2d6b('0x2'));var rs=require(_0x2d6b('0x3'));var fs=require('fs');var Redis=require(_0x2d6b('0x4'));var db=require(_0x2d6b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d6b('0x6'))(_0x2d6b('0x7'));var config=require(_0x2d6b('0x8'));var jayson=require(_0x2d6b('0x9'));var client=jayson[_0x2d6b('0xa')][_0x2d6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5548a0,_0x1c3bbe,_0x4c6fb4){return new BPromise(function(_0x21b1ed,_0x500d1f){return client['request'](_0x5548a0,_0x4c6fb4)[_0x2d6b('0xc')](function(_0x5e0cd8){logger[_0x2d6b('0xd')](_0x2d6b('0xe'),_0x1c3bbe,_0x2d6b('0xf'));logger[_0x2d6b('0x10')](_0x2d6b('0x11'),_0x1c3bbe,_0x2d6b('0xf'),JSON[_0x2d6b('0x12')](_0x5e0cd8));if(_0x5e0cd8[_0x2d6b('0x13')]){if(_0x5e0cd8[_0x2d6b('0x13')][_0x2d6b('0x14')]===0x1f4){logger[_0x2d6b('0x13')](_0x2d6b('0xe'),_0x1c3bbe,_0x5e0cd8['error']['message']);return _0x500d1f(_0x5e0cd8[_0x2d6b('0x13')]['message']);}logger[_0x2d6b('0x13')](_0x2d6b('0xe'),_0x1c3bbe,_0x5e0cd8[_0x2d6b('0x13')]['message']);return _0x21b1ed(_0x5e0cd8[_0x2d6b('0x13')][_0x2d6b('0x15')]);}else{logger[_0x2d6b('0xd')](_0x2d6b('0xe'),_0x1c3bbe,_0x2d6b('0xf'));_0x21b1ed(_0x5e0cd8['result'][_0x2d6b('0x15')]);}})[_0x2d6b('0x16')](function(_0x1b09c4){logger['error'](_0x2d6b('0xe'),_0x1c3bbe,_0x1b09c4);_0x500d1f(_0x1b09c4);});});}