Built motion from commit (unavailable).|2.4.17
[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 _0x6317=['CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','CmCompany,\x20%s,\x20%s'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6317,0x9b));var _0x7631=function(_0x4799c0,_0x3b3e33){_0x4799c0=_0x4799c0-0x0;var _0x5d1f1e=_0x6317[_0x4799c0];return _0x5d1f1e;};'use strict';var _=require(_0x7631('0x0'));var util=require(_0x7631('0x1'));var moment=require(_0x7631('0x2'));var BPromise=require(_0x7631('0x3'));var rs=require(_0x7631('0x4'));var fs=require('fs');var Redis=require(_0x7631('0x5'));var db=require(_0x7631('0x6'))['db'];var utils=require(_0x7631('0x7'));var logger=require(_0x7631('0x8'))(_0x7631('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7631('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5bb57c,_0x302bd6,_0x25225e){return new BPromise(function(_0x4f85ec,_0x170119){return client['request'](_0x5bb57c,_0x25225e)[_0x7631('0xb')](function(_0x4fb4b1){logger['info'](_0x7631('0xc'),_0x302bd6,'request\x20sent');logger['debug'](_0x7631('0xd'),_0x302bd6,_0x7631('0xe'),JSON['stringify'](_0x4fb4b1));if(_0x4fb4b1[_0x7631('0xf')]){if(_0x4fb4b1[_0x7631('0xf')][_0x7631('0x10')]===0x1f4){logger['error']('CmCompany,\x20%s,\x20%s',_0x302bd6,_0x4fb4b1[_0x7631('0xf')]['message']);return _0x170119(_0x4fb4b1[_0x7631('0xf')]['message']);}logger['error'](_0x7631('0xc'),_0x302bd6,_0x4fb4b1[_0x7631('0xf')]['message']);return _0x4f85ec(_0x4fb4b1[_0x7631('0xf')][_0x7631('0x11')]);}else{logger[_0x7631('0x12')]('CmCompany,\x20%s,\x20%s',_0x302bd6,_0x7631('0xe'));_0x4f85ec(_0x4fb4b1[_0x7631('0x13')][_0x7631('0x11')]);}})[_0x7631('0x14')](function(_0x22fe6b){logger[_0x7631('0xf')](_0x7631('0xc'),_0x302bd6,_0x22fe6b);_0x170119(_0x22fe6b);});});}