Built motion from commit b5413ace.|2.6.9
[motion2.git] / server / api / intZohoField / intZohoField.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 _0x2038=['message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client','http','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x36f708,_0x558234){var _0x269f80=function(_0x4812a3){while(--_0x4812a3){_0x36f708['push'](_0x36f708['shift']());}};_0x269f80(++_0x558234);}(_0x2038,0x111));var _0x8203=function(_0x4c63dd,_0x4e59ba){_0x4c63dd=_0x4c63dd-0x0;var _0x27e9d5=_0x2038[_0x4c63dd];return _0x27e9d5;};'use strict';var _=require(_0x8203('0x0'));var util=require('util');var moment=require(_0x8203('0x1'));var BPromise=require(_0x8203('0x2'));var rs=require(_0x8203('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8203('0x4'))['db'];var utils=require(_0x8203('0x5'));var logger=require('../../config/logger')(_0x8203('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8203('0x7')][_0x8203('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d18ae,_0x3ed2aa,_0x22e4a4){return new BPromise(function(_0x27236f,_0x5b5fca){return client['request'](_0x3d18ae,_0x22e4a4)['then'](function(_0x3b8945){logger['info'](_0x8203('0x9'),_0x3ed2aa,_0x8203('0xa'));logger[_0x8203('0xb')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3ed2aa,_0x8203('0xa'),JSON[_0x8203('0xc')](_0x3b8945));if(_0x3b8945['error']){if(_0x3b8945[_0x8203('0xd')][_0x8203('0xe')]===0x1f4){logger[_0x8203('0xd')]('ZohoField,\x20%s,\x20%s',_0x3ed2aa,_0x3b8945[_0x8203('0xd')]['message']);return _0x5b5fca(_0x3b8945[_0x8203('0xd')][_0x8203('0xf')]);}logger[_0x8203('0xd')]('ZohoField,\x20%s,\x20%s',_0x3ed2aa,_0x3b8945[_0x8203('0xd')][_0x8203('0xf')]);return _0x27236f(_0x3b8945[_0x8203('0xd')]['message']);}else{logger['info'](_0x8203('0x9'),_0x3ed2aa,_0x8203('0xa'));_0x27236f(_0x3b8945[_0x8203('0x10')][_0x8203('0xf')]);}})[_0x8203('0x11')](function(_0x774a92){logger[_0x8203('0xd')](_0x8203('0x9'),_0x3ed2aa,_0x774a92);_0x5b5fca(_0x774a92);});});}