7c4c5091689a497f2bebf0419c2d8418a0131909
[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 _0xdb8f=['message','CmCompany,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x2f2149,_0x247eae){var _0xff9526=function(_0x4bc1c3){while(--_0x4bc1c3){_0x2f2149['push'](_0x2f2149['shift']());}};_0xff9526(++_0x247eae);}(_0xdb8f,0x17f));var _0xfdb8=function(_0xf3fb4e,_0x1f8665){_0xf3fb4e=_0xf3fb4e-0x0;var _0x561bdb=_0xdb8f[_0xf3fb4e];return _0x561bdb;};'use strict';var _=require(_0xfdb8('0x0'));var util=require(_0xfdb8('0x1'));var moment=require('moment');var BPromise=require(_0xfdb8('0x2'));var rs=require(_0xfdb8('0x3'));var fs=require('fs');var Redis=require(_0xfdb8('0x4'));var db=require(_0xfdb8('0x5'))['db'];var utils=require(_0xfdb8('0x6'));var logger=require('../../config/logger')(_0xfdb8('0x7'));var config=require('../../config/environment');var jayson=require(_0xfdb8('0x8'));var client=jayson[_0xfdb8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e0e3a,_0x59044b,_0x5edd62){return new BPromise(function(_0x20fe40,_0x5c5ce6){return client[_0xfdb8('0xa')](_0x4e0e3a,_0x5edd62)[_0xfdb8('0xb')](function(_0x114025){logger[_0xfdb8('0xc')]('CmCompany,\x20%s,\x20%s',_0x59044b,_0xfdb8('0xd'));logger[_0xfdb8('0xe')]('CmCompany,\x20%s,\x20%s,\x20%s',_0x59044b,_0xfdb8('0xd'),JSON[_0xfdb8('0xf')](_0x114025));if(_0x114025[_0xfdb8('0x10')]){if(_0x114025[_0xfdb8('0x10')]['code']===0x1f4){logger[_0xfdb8('0x10')]('CmCompany,\x20%s,\x20%s',_0x59044b,_0x114025[_0xfdb8('0x10')][_0xfdb8('0x11')]);return _0x5c5ce6(_0x114025[_0xfdb8('0x10')][_0xfdb8('0x11')]);}logger['error'](_0xfdb8('0x12'),_0x59044b,_0x114025[_0xfdb8('0x10')][_0xfdb8('0x11')]);return _0x20fe40(_0x114025[_0xfdb8('0x10')][_0xfdb8('0x11')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x59044b,_0xfdb8('0xd'));_0x20fe40(_0x114025['result'][_0xfdb8('0x11')]);}})[_0xfdb8('0x13')](function(_0x5f4f3c){logger['error']('CmCompany,\x20%s,\x20%s',_0x59044b,_0x5f4f3c);_0x5c5ce6(_0x5f4f3c);});});}