Built motion from commit (unavailable).|2.5.9
[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 _0x4659=['../../mysqldb','../../config/logger','../../config/environment','client','http','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x527d81,_0x595b28){var _0x306130=function(_0x246868){while(--_0x246868){_0x527d81['push'](_0x527d81['shift']());}};_0x306130(++_0x595b28);}(_0x4659,0x164));var _0x9465=function(_0x1826c4,_0x43ab5d){_0x1826c4=_0x1826c4-0x0;var _0x26db75=_0x4659[_0x1826c4];return _0x26db75;};'use strict';var _=require('lodash');var util=require(_0x9465('0x0'));var moment=require('moment');var BPromise=require(_0x9465('0x1'));var rs=require(_0x9465('0x2'));var fs=require('fs');var Redis=require(_0x9465('0x3'));var db=require(_0x9465('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9465('0x5'))('rpc');var config=require(_0x9465('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x9465('0x7')][_0x9465('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a0024,_0x15edf6,_0x41b3ae){return new BPromise(function(_0x393d35,_0x523b0a){return client['request'](_0x3a0024,_0x41b3ae)[_0x9465('0x9')](function(_0x76a415){logger[_0x9465('0xa')](_0x9465('0xb'),_0x15edf6,_0x9465('0xc'));logger['debug']('CmCompany,\x20%s,\x20%s,\x20%s',_0x15edf6,_0x9465('0xc'),JSON[_0x9465('0xd')](_0x76a415));if(_0x76a415[_0x9465('0xe')]){if(_0x76a415['error']['code']===0x1f4){logger[_0x9465('0xe')]('CmCompany,\x20%s,\x20%s',_0x15edf6,_0x76a415['error'][_0x9465('0xf')]);return _0x523b0a(_0x76a415['error']['message']);}logger['error'](_0x9465('0xb'),_0x15edf6,_0x76a415[_0x9465('0xe')][_0x9465('0xf')]);return _0x393d35(_0x76a415['error'][_0x9465('0xf')]);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x15edf6,'request\x20sent');_0x393d35(_0x76a415[_0x9465('0x10')][_0x9465('0xf')]);}})[_0x9465('0x11')](function(_0x222503){logger[_0x9465('0xe')](_0x9465('0xb'),_0x15edf6,_0x222503);_0x523b0a(_0x222503);});});}