Built motion from commit c116dc8b.|2.6.30
[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 _0xd78c=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x593128,_0x456031){var _0x18c512=function(_0x292897){while(--_0x292897){_0x593128['push'](_0x593128['shift']());}};_0x18c512(++_0x456031);}(_0xd78c,0xb0));var _0xcd78=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xd78c[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0xcd78('0x0'));var moment=require(_0xcd78('0x1'));var BPromise=require(_0xcd78('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcd78('0x3'));var db=require(_0xcd78('0x4'))['db'];var utils=require(_0xcd78('0x5'));var logger=require(_0xcd78('0x6'))(_0xcd78('0x7'));var config=require('../../config/environment');var jayson=require(_0xcd78('0x8'));var client=jayson[_0xcd78('0x9')][_0xcd78('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a5adb,_0x2cebab,_0x2cbdac){return new BPromise(function(_0x4fd8b0,_0x14e7b7){return client[_0xcd78('0xb')](_0x4a5adb,_0x2cbdac)[_0xcd78('0xc')](function(_0x5eb708){logger[_0xcd78('0xd')](_0xcd78('0xe'),_0x2cebab,_0xcd78('0xf'));logger[_0xcd78('0x10')](_0xcd78('0x11'),_0x2cebab,_0xcd78('0xf'),JSON[_0xcd78('0x12')](_0x5eb708));if(_0x5eb708[_0xcd78('0x13')]){if(_0x5eb708[_0xcd78('0x13')]['code']===0x1f4){logger[_0xcd78('0x13')](_0xcd78('0xe'),_0x2cebab,_0x5eb708['error']['message']);return _0x14e7b7(_0x5eb708['error']['message']);}logger[_0xcd78('0x13')](_0xcd78('0xe'),_0x2cebab,_0x5eb708[_0xcd78('0x13')][_0xcd78('0x14')]);return _0x4fd8b0(_0x5eb708[_0xcd78('0x13')][_0xcd78('0x14')]);}else{logger[_0xcd78('0xd')]('CmCompany,\x20%s,\x20%s',_0x2cebab,_0xcd78('0xf'));_0x4fd8b0(_0x5eb708['result']['message']);}})['catch'](function(_0x4e66d8){logger[_0xcd78('0x13')]('CmCompany,\x20%s,\x20%s',_0x2cebab,_0x4e66d8);_0x14e7b7(_0x4e66d8);});});}