0bbc2f6f4e007f03fec7b2e6313bffbcaa28137d
[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 _0x0261=['../../config/utils','../../config/logger','jayson/promise','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x34c3bc,_0x3bc2f9){var _0x3727ba=function(_0x4c508f){while(--_0x4c508f){_0x34c3bc['push'](_0x34c3bc['shift']());}};_0x3727ba(++_0x3bc2f9);}(_0x0261,0x1ca));var _0x1026=function(_0x8fa4bc,_0x5cd2af){_0x8fa4bc=_0x8fa4bc-0x0;var _0x35b6a7=_0x0261[_0x8fa4bc];return _0x35b6a7;};'use strict';var _=require('lodash');var util=require(_0x1026('0x0'));var moment=require(_0x1026('0x1'));var BPromise=require('bluebird');var rs=require(_0x1026('0x2'));var fs=require('fs');var Redis=require(_0x1026('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1026('0x4'));var logger=require(_0x1026('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1026('0x6'));var client=jayson['client'][_0x1026('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4315b3,_0x172282,_0x999035){return new BPromise(function(_0x5c3ae4,_0x45640c){return client[_0x1026('0x8')](_0x4315b3,_0x999035)[_0x1026('0x9')](function(_0x2394b3){logger[_0x1026('0xa')](_0x1026('0xb'),_0x172282,_0x1026('0xc'));logger[_0x1026('0xd')](_0x1026('0xe'),_0x172282,'request\x20sent',JSON[_0x1026('0xf')](_0x2394b3));if(_0x2394b3[_0x1026('0x10')]){if(_0x2394b3[_0x1026('0x10')][_0x1026('0x11')]===0x1f4){logger['error'](_0x1026('0xb'),_0x172282,_0x2394b3[_0x1026('0x10')]['message']);return _0x45640c(_0x2394b3['error']['message']);}logger[_0x1026('0x10')](_0x1026('0xb'),_0x172282,_0x2394b3[_0x1026('0x10')][_0x1026('0x12')]);return _0x5c3ae4(_0x2394b3['error']['message']);}else{logger['info'](_0x1026('0xb'),_0x172282,'request\x20sent');_0x5c3ae4(_0x2394b3[_0x1026('0x13')][_0x1026('0x12')]);}})[_0x1026('0x14')](function(_0x42452d){logger[_0x1026('0x10')](_0x1026('0xb'),_0x172282,_0x42452d);_0x45640c(_0x42452d);});});}