a8ecb4656201ff9809d1ee0f5fdafd82d6a16d99
[motion2.git] / server / api / integration / integration.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 _0x5889=['info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3227dd,_0x32f497){var _0x4ffdd4=function(_0x3b8dd2){while(--_0x3b8dd2){_0x3227dd['push'](_0x3227dd['shift']());}};_0x4ffdd4(++_0x32f497);}(_0x5889,0x18f));var _0x9588=function(_0x1753c4,_0x423ca4){_0x1753c4=_0x1753c4-0x0;var _0x23f622=_0x5889[_0x1753c4];return _0x23f622;};'use strict';var _=require(_0x9588('0x0'));var util=require('util');var moment=require(_0x9588('0x1'));var BPromise=require(_0x9588('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9588('0x3'));var db=require(_0x9588('0x4'))['db'];var utils=require(_0x9588('0x5'));var logger=require('../../config/logger')(_0x9588('0x6'));var config=require(_0x9588('0x7'));var jayson=require(_0x9588('0x8'));var client=jayson['client'][_0x9588('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x20b9ce,_0x3ea580,_0x1803db){return new BPromise(function(_0x241357,_0x354b36){return client[_0x9588('0xa')](_0x20b9ce,_0x1803db)['then'](function(_0x467c31){logger['info'](_0x9588('0xb'),_0x3ea580,_0x9588('0xc'));logger[_0x9588('0xd')](_0x9588('0xe'),_0x3ea580,'request\x20sent',JSON[_0x9588('0xf')](_0x467c31));if(_0x467c31[_0x9588('0x10')]){if(_0x467c31[_0x9588('0x10')][_0x9588('0x11')]===0x1f4){logger[_0x9588('0x10')](_0x9588('0xb'),_0x3ea580,_0x467c31['error'][_0x9588('0x12')]);return _0x354b36(_0x467c31[_0x9588('0x10')]['message']);}logger[_0x9588('0x10')](_0x9588('0xb'),_0x3ea580,_0x467c31['error']['message']);return _0x241357(_0x467c31[_0x9588('0x10')][_0x9588('0x12')]);}else{logger[_0x9588('0x13')]('Integration,\x20%s,\x20%s',_0x3ea580,_0x9588('0xc'));_0x241357(_0x467c31[_0x9588('0x14')][_0x9588('0x12')]);}})[_0x9588('0x15')](function(_0x5ebf7a){logger['error']('Integration,\x20%s,\x20%s',_0x3ea580,_0x5ebf7a);_0x354b36(_0x5ebf7a);});});}