dc7b48b94e3153812842c1dd0b03e990d2f1af00
[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 _0x6a53=['debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCompany,\x20%s,\x20%s'];(function(_0x42f252,_0x2544fb){var _0x58d451=function(_0x4065e1){while(--_0x4065e1){_0x42f252['push'](_0x42f252['shift']());}};_0x58d451(++_0x2544fb);}(_0x6a53,0xd8));var _0x36a5=function(_0x46399a,_0x108f44){_0x46399a=_0x46399a-0x0;var _0x3f97ca=_0x6a53[_0x46399a];return _0x3f97ca;};'use strict';var _=require(_0x36a5('0x0'));var util=require('util');var moment=require(_0x36a5('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x36a5('0x2'));var db=require(_0x36a5('0x3'))['db'];var utils=require(_0x36a5('0x4'));var logger=require('../../config/logger')(_0x36a5('0x5'));var config=require(_0x36a5('0x6'));var jayson=require(_0x36a5('0x7'));var client=jayson[_0x36a5('0x8')][_0x36a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a4f75,_0x1e39ef,_0xd6c30){return new BPromise(function(_0x2644e7,_0x4dab5e){return client[_0x36a5('0xa')](_0x5a4f75,_0xd6c30)[_0x36a5('0xb')](function(_0x5566f3){logger[_0x36a5('0xc')](_0x36a5('0xd'),_0x1e39ef,'request\x20sent');logger[_0x36a5('0xe')](_0x36a5('0xf'),_0x1e39ef,_0x36a5('0x10'),JSON[_0x36a5('0x11')](_0x5566f3));if(_0x5566f3[_0x36a5('0x12')]){if(_0x5566f3[_0x36a5('0x12')][_0x36a5('0x13')]===0x1f4){logger[_0x36a5('0x12')]('CmCompany,\x20%s,\x20%s',_0x1e39ef,_0x5566f3[_0x36a5('0x12')][_0x36a5('0x14')]);return _0x4dab5e(_0x5566f3['error'][_0x36a5('0x14')]);}logger[_0x36a5('0x12')](_0x36a5('0xd'),_0x1e39ef,_0x5566f3[_0x36a5('0x12')]['message']);return _0x2644e7(_0x5566f3[_0x36a5('0x12')][_0x36a5('0x14')]);}else{logger[_0x36a5('0xc')](_0x36a5('0xd'),_0x1e39ef,_0x36a5('0x10'));_0x2644e7(_0x5566f3[_0x36a5('0x15')]['message']);}})[_0x36a5('0x16')](function(_0x162fc7){logger['error'](_0x36a5('0xd'),_0x1e39ef,_0x162fc7);_0x4dab5e(_0x162fc7);});});}