88fe13ed7952f3ca155083892e282cf30bf2485a
[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 _0x2ad2=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0x4d934b,_0x52f8e9){var _0xc0338b=function(_0x1a356c){while(--_0x1a356c){_0x4d934b['push'](_0x4d934b['shift']());}};_0xc0338b(++_0x52f8e9);}(_0x2ad2,0xe6));var _0x22ad=function(_0x55cf7a,_0x3e6bc5){_0x55cf7a=_0x55cf7a-0x0;var _0x3b79f2=_0x2ad2[_0x55cf7a];return _0x3b79f2;};'use strict';var _=require('lodash');var util=require(_0x22ad('0x0'));var moment=require('moment');var BPromise=require(_0x22ad('0x1'));var rs=require(_0x22ad('0x2'));var fs=require('fs');var Redis=require(_0x22ad('0x3'));var db=require(_0x22ad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22ad('0x5'))(_0x22ad('0x6'));var config=require('../../config/environment');var jayson=require(_0x22ad('0x7'));var client=jayson[_0x22ad('0x8')][_0x22ad('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4f31b7,_0x110235,_0x1744f1){return new BPromise(function(_0x448637,_0x9d847c){return client[_0x22ad('0xa')](_0x4f31b7,_0x1744f1)[_0x22ad('0xb')](function(_0x375070){logger[_0x22ad('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x110235,_0x22ad('0xd'));logger[_0x22ad('0xe')](_0x22ad('0xf'),_0x110235,'request\x20sent',JSON[_0x22ad('0x10')](_0x375070));if(_0x375070[_0x22ad('0x11')]){if(_0x375070[_0x22ad('0x11')][_0x22ad('0x12')]===0x1f4){logger[_0x22ad('0x11')](_0x22ad('0x13'),_0x110235,_0x375070['error'][_0x22ad('0x14')]);return _0x9d847c(_0x375070[_0x22ad('0x11')][_0x22ad('0x14')]);}logger[_0x22ad('0x11')](_0x22ad('0x13'),_0x110235,_0x375070[_0x22ad('0x11')][_0x22ad('0x14')]);return _0x448637(_0x375070[_0x22ad('0x11')][_0x22ad('0x14')]);}else{logger[_0x22ad('0xc')](_0x22ad('0x13'),_0x110235,'request\x20sent');_0x448637(_0x375070[_0x22ad('0x15')]['message']);}})[_0x22ad('0x16')](function(_0x4d9a8b){logger[_0x22ad('0x11')](_0x22ad('0x13'),_0x110235,_0x4d9a8b);_0x9d847c(_0x4d9a8b);});});}