Built motion from commit da617fac.|2.6.6
[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 _0x1170=['ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x568d90,_0x4dab47){var _0x25289b=function(_0x551a7a){while(--_0x551a7a){_0x568d90['push'](_0x568d90['shift']());}};_0x25289b(++_0x4dab47);}(_0x1170,0x16e));var _0x0117=function(_0xac358e,_0x5e95a7){_0xac358e=_0xac358e-0x0;var _0x34c79a=_0x1170[_0xac358e];return _0x34c79a;};'use strict';var _=require(_0x0117('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0117('0x1'));var fs=require('fs');var Redis=require(_0x0117('0x2'));var db=require(_0x0117('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0117('0x4'))(_0x0117('0x5'));var config=require(_0x0117('0x6'));var jayson=require(_0x0117('0x7'));var client=jayson[_0x0117('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e813e,_0x1c5c52,_0x58a7ac){return new BPromise(function(_0xf0450,_0xf57883){return client[_0x0117('0x9')](_0x1e813e,_0x58a7ac)['then'](function(_0x373abf){logger['info'](_0x0117('0xa'),_0x1c5c52,_0x0117('0xb'));logger['debug'](_0x0117('0xc'),_0x1c5c52,_0x0117('0xb'),JSON['stringify'](_0x373abf));if(_0x373abf['error']){if(_0x373abf[_0x0117('0xd')][_0x0117('0xe')]===0x1f4){logger[_0x0117('0xd')]('ZohoField,\x20%s,\x20%s',_0x1c5c52,_0x373abf[_0x0117('0xd')][_0x0117('0xf')]);return _0xf57883(_0x373abf[_0x0117('0xd')][_0x0117('0xf')]);}logger[_0x0117('0xd')](_0x0117('0xa'),_0x1c5c52,_0x373abf[_0x0117('0xd')]['message']);return _0xf0450(_0x373abf[_0x0117('0xd')][_0x0117('0xf')]);}else{logger['info'](_0x0117('0xa'),_0x1c5c52,'request\x20sent');_0xf0450(_0x373abf[_0x0117('0x10')][_0x0117('0xf')]);}})[_0x0117('0x11')](function(_0x5365e6){logger[_0x0117('0xd')](_0x0117('0xa'),_0x1c5c52,_0x5365e6);_0xf57883(_0x5365e6);});});}