7dad27fe986a7fd568f57dfe064fa523ad639dd3
[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 _0x3bcf=['request','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x3bcf,0x15b));var _0xf3bc=function(_0x33491c,_0x30ddbf){_0x33491c=_0x33491c-0x0;var _0x431bba=_0x3bcf[_0x33491c];return _0x431bba;};'use strict';var _=require(_0xf3bc('0x0'));var util=require(_0xf3bc('0x1'));var moment=require(_0xf3bc('0x2'));var BPromise=require(_0xf3bc('0x3'));var rs=require(_0xf3bc('0x4'));var fs=require('fs');var Redis=require(_0xf3bc('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf3bc('0x6'));var logger=require(_0xf3bc('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf3bc('0x8'));var client=jayson[_0xf3bc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x137fe3,_0x31508b,_0x4d4608){return new BPromise(function(_0x28b497,_0x50614c){return client[_0xf3bc('0xa')](_0x137fe3,_0x4d4608)['then'](function(_0x97fe5e){logger[_0xf3bc('0xb')](_0xf3bc('0xc'),_0x31508b,_0xf3bc('0xd'));logger[_0xf3bc('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x31508b,'request\x20sent',JSON[_0xf3bc('0xf')](_0x97fe5e));if(_0x97fe5e[_0xf3bc('0x10')]){if(_0x97fe5e['error'][_0xf3bc('0x11')]===0x1f4){logger[_0xf3bc('0x10')](_0xf3bc('0xc'),_0x31508b,_0x97fe5e[_0xf3bc('0x10')][_0xf3bc('0x12')]);return _0x50614c(_0x97fe5e[_0xf3bc('0x10')]['message']);}logger['error'](_0xf3bc('0xc'),_0x31508b,_0x97fe5e[_0xf3bc('0x10')][_0xf3bc('0x12')]);return _0x28b497(_0x97fe5e[_0xf3bc('0x10')][_0xf3bc('0x12')]);}else{logger[_0xf3bc('0xb')](_0xf3bc('0xc'),_0x31508b,_0xf3bc('0xd'));_0x28b497(_0x97fe5e[_0xf3bc('0x13')][_0xf3bc('0x12')]);}})[_0xf3bc('0x14')](function(_0x315c72){logger[_0xf3bc('0x10')]('CmCompany,\x20%s,\x20%s',_0x31508b,_0x315c72);_0x50614c(_0x315c72);});});}