85277209d4d31f8d1cb9d9bd75043b1a5946453d
[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 _0xab44=['error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c5143,_0x181163){var _0x53f209=function(_0xf3f899){while(--_0xf3f899){_0x4c5143['push'](_0x4c5143['shift']());}};_0x53f209(++_0x181163);}(_0xab44,0x139));var _0x4ab4=function(_0x21e085,_0x3e4616){_0x21e085=_0x21e085-0x0;var _0x5e70c5=_0xab44[_0x21e085];return _0x5e70c5;};'use strict';var _=require('lodash');var util=require(_0x4ab4('0x0'));var moment=require(_0x4ab4('0x1'));var BPromise=require(_0x4ab4('0x2'));var rs=require(_0x4ab4('0x3'));var fs=require('fs');var Redis=require(_0x4ab4('0x4'));var db=require(_0x4ab4('0x5'))['db'];var utils=require(_0x4ab4('0x6'));var logger=require('../../config/logger')(_0x4ab4('0x7'));var config=require(_0x4ab4('0x8'));var jayson=require(_0x4ab4('0x9'));var client=jayson[_0x4ab4('0xa')][_0x4ab4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48abf2,_0x3bfd6c,_0x4c0847){return new BPromise(function(_0x251305,_0x390d85){return client[_0x4ab4('0xc')](_0x48abf2,_0x4c0847)[_0x4ab4('0xd')](function(_0x35fb7e){logger['info'](_0x4ab4('0xe'),_0x3bfd6c,_0x4ab4('0xf'));logger[_0x4ab4('0x10')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3bfd6c,_0x4ab4('0xf'),JSON['stringify'](_0x35fb7e));if(_0x35fb7e['error']){if(_0x35fb7e[_0x4ab4('0x11')][_0x4ab4('0x12')]===0x1f4){logger[_0x4ab4('0x11')](_0x4ab4('0xe'),_0x3bfd6c,_0x35fb7e[_0x4ab4('0x11')]['message']);return _0x390d85(_0x35fb7e[_0x4ab4('0x11')]['message']);}logger[_0x4ab4('0x11')]('ZohoConfiguration,\x20%s,\x20%s',_0x3bfd6c,_0x35fb7e[_0x4ab4('0x11')][_0x4ab4('0x13')]);return _0x251305(_0x35fb7e[_0x4ab4('0x11')][_0x4ab4('0x13')]);}else{logger[_0x4ab4('0x14')](_0x4ab4('0xe'),_0x3bfd6c,_0x4ab4('0xf'));_0x251305(_0x35fb7e[_0x4ab4('0x15')][_0x4ab4('0x13')]);}})['catch'](function(_0x42fd5d){logger[_0x4ab4('0x11')](_0x4ab4('0xe'),_0x3bfd6c,_0x42fd5d);_0x390d85(_0x42fd5d);});});}