Built motion from commit 47436d59.|2.6.7
[motion2.git] / server / api / intZohoConfiguration / intZohoConfiguration.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 _0x86f5=['info','ZohoConfiguration,\x20%s,\x20%s','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','client','request','then'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x86f5,0xd5));var _0x586f=function(_0x48168a,_0xf9dfe5){_0x48168a=_0x48168a-0x0;var _0x346d98=_0x86f5[_0x48168a];return _0x346d98;};'use strict';var _=require(_0x586f('0x0'));var util=require('util');var moment=require(_0x586f('0x1'));var BPromise=require('bluebird');var rs=require(_0x586f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x586f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x586f('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x586f('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b7a5b,_0x466757,_0x17ede3){return new BPromise(function(_0x5506a5,_0x3649da){return client[_0x586f('0x6')](_0x3b7a5b,_0x17ede3)[_0x586f('0x7')](function(_0x44e4f5){logger[_0x586f('0x8')](_0x586f('0x9'),_0x466757,'request\x20sent');logger[_0x586f('0xa')](_0x586f('0xb'),_0x466757,_0x586f('0xc'),JSON['stringify'](_0x44e4f5));if(_0x44e4f5[_0x586f('0xd')]){if(_0x44e4f5[_0x586f('0xd')][_0x586f('0xe')]===0x1f4){logger[_0x586f('0xd')](_0x586f('0x9'),_0x466757,_0x44e4f5[_0x586f('0xd')][_0x586f('0xf')]);return _0x3649da(_0x44e4f5['error'][_0x586f('0xf')]);}logger[_0x586f('0xd')](_0x586f('0x9'),_0x466757,_0x44e4f5[_0x586f('0xd')][_0x586f('0xf')]);return _0x5506a5(_0x44e4f5[_0x586f('0xd')][_0x586f('0xf')]);}else{logger[_0x586f('0x8')](_0x586f('0x9'),_0x466757,'request\x20sent');_0x5506a5(_0x44e4f5['result'][_0x586f('0xf')]);}})[_0x586f('0x10')](function(_0x2dfe78){logger[_0x586f('0xd')](_0x586f('0x9'),_0x466757,_0x2dfe78);_0x3649da(_0x2dfe78);});});}