Built motion from commit 25580385.|2.6.2
[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 _0x5159=['ZohoField,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','then','info','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x4a5182,_0x135866){var _0x5c1ae5=function(_0x59eb7c){while(--_0x59eb7c){_0x4a5182['push'](_0x4a5182['shift']());}};_0x5c1ae5(++_0x135866);}(_0x5159,0xb7));var _0x9515=function(_0x4071dc,_0x4e6c1c){_0x4071dc=_0x4071dc-0x0;var _0x22c825=_0x5159[_0x4071dc];return _0x22c825;};'use strict';var _=require(_0x9515('0x0'));var util=require(_0x9515('0x1'));var moment=require(_0x9515('0x2'));var BPromise=require(_0x9515('0x3'));var rs=require(_0x9515('0x4'));var fs=require('fs');var Redis=require(_0x9515('0x5'));var db=require(_0x9515('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9515('0x7'))(_0x9515('0x8'));var config=require(_0x9515('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xdbe4b3,_0xf65dbf,_0x283b0a){return new BPromise(function(_0x2e0902,_0x2cab92){return client['request'](_0xdbe4b3,_0x283b0a)[_0x9515('0xa')](function(_0x520133){logger[_0x9515('0xb')]('ZohoField,\x20%s,\x20%s',_0xf65dbf,_0x9515('0xc'));logger[_0x9515('0xd')](_0x9515('0xe'),_0xf65dbf,_0x9515('0xc'),JSON['stringify'](_0x520133));if(_0x520133[_0x9515('0xf')]){if(_0x520133['error'][_0x9515('0x10')]===0x1f4){logger['error'](_0x9515('0x11'),_0xf65dbf,_0x520133[_0x9515('0xf')][_0x9515('0x12')]);return _0x2cab92(_0x520133[_0x9515('0xf')][_0x9515('0x12')]);}logger[_0x9515('0xf')](_0x9515('0x11'),_0xf65dbf,_0x520133['error'][_0x9515('0x12')]);return _0x2e0902(_0x520133[_0x9515('0xf')]['message']);}else{logger['info'](_0x9515('0x11'),_0xf65dbf,_0x9515('0xc'));_0x2e0902(_0x520133['result'][_0x9515('0x12')]);}})[_0x9515('0x13')](function(_0x2ca202){logger['error']('ZohoField,\x20%s,\x20%s',_0xf65dbf,_0x2ca202);_0x2cab92(_0x2ca202);});});}