424957d58f7d57859b1e02b2ab6a3cf923e8be70
[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 _0xa6ee=['then','info','CmCompany,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','randomstring','../../config/logger','rpc','jayson/promise','client'];(function(_0x5c46c2,_0x350a60){var _0x33c673=function(_0x2c8f05){while(--_0x2c8f05){_0x5c46c2['push'](_0x5c46c2['shift']());}};_0x33c673(++_0x350a60);}(_0xa6ee,0x1a9));var _0xea6e=function(_0x5c4610,_0x29a90c){_0x5c4610=_0x5c4610-0x0;var _0x567d1b=_0xa6ee[_0x5c4610];return _0x567d1b;};'use strict';var _=require('lodash');var util=require(_0xea6e('0x0'));var moment=require(_0xea6e('0x1'));var BPromise=require('bluebird');var rs=require(_0xea6e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xea6e('0x3'))(_0xea6e('0x4'));var config=require('../../config/environment');var jayson=require(_0xea6e('0x5'));var client=jayson[_0xea6e('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x597b22,_0x4ca821,_0x35404e){return new BPromise(function(_0x22b6cf,_0x48daa4){return client['request'](_0x597b22,_0x35404e)[_0xea6e('0x7')](function(_0x2eb985){logger[_0xea6e('0x8')](_0xea6e('0x9'),_0x4ca821,_0xea6e('0xa'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x4ca821,_0xea6e('0xa'),JSON['stringify'](_0x2eb985));if(_0x2eb985[_0xea6e('0xb')]){if(_0x2eb985[_0xea6e('0xb')][_0xea6e('0xc')]===0x1f4){logger['error'](_0xea6e('0x9'),_0x4ca821,_0x2eb985[_0xea6e('0xb')][_0xea6e('0xd')]);return _0x48daa4(_0x2eb985[_0xea6e('0xb')][_0xea6e('0xd')]);}logger[_0xea6e('0xb')]('CmCompany,\x20%s,\x20%s',_0x4ca821,_0x2eb985[_0xea6e('0xb')]['message']);return _0x22b6cf(_0x2eb985[_0xea6e('0xb')]['message']);}else{logger[_0xea6e('0x8')](_0xea6e('0x9'),_0x4ca821,_0xea6e('0xa'));_0x22b6cf(_0x2eb985[_0xea6e('0xe')]['message']);}})[_0xea6e('0xf')](function(_0x2c10e6){logger[_0xea6e('0xb')](_0xea6e('0x9'),_0x4ca821,_0x2c10e6);_0x48daa4(_0x2c10e6);});});}