Built motion from commit 71df090e.|2.6.31
[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 _0x2444=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','ZohoField,\x20%s,\x20%s'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x2444,0x190));var _0x4244=function(_0x78fbb4,_0x23da36){_0x78fbb4=_0x78fbb4-0x0;var _0x3a67e8=_0x2444[_0x78fbb4];return _0x3a67e8;};'use strict';var _=require(_0x4244('0x0'));var util=require(_0x4244('0x1'));var moment=require(_0x4244('0x2'));var BPromise=require('bluebird');var rs=require(_0x4244('0x3'));var fs=require('fs');var Redis=require(_0x4244('0x4'));var db=require(_0x4244('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4244('0x6'))(_0x4244('0x7'));var config=require(_0x4244('0x8'));var jayson=require(_0x4244('0x9'));var client=jayson[_0x4244('0xa')][_0x4244('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31d709,_0x40a267,_0x5c8c2e){return new BPromise(function(_0x30506b,_0x51b782){return client['request'](_0x31d709,_0x5c8c2e)['then'](function(_0x364521){logger[_0x4244('0xc')](_0x4244('0xd'),_0x40a267,_0x4244('0xe'));logger[_0x4244('0xf')](_0x4244('0x10'),_0x40a267,_0x4244('0xe'),JSON[_0x4244('0x11')](_0x364521));if(_0x364521[_0x4244('0x12')]){if(_0x364521[_0x4244('0x12')][_0x4244('0x13')]===0x1f4){logger['error']('ZohoField,\x20%s,\x20%s',_0x40a267,_0x364521[_0x4244('0x12')][_0x4244('0x14')]);return _0x51b782(_0x364521[_0x4244('0x12')][_0x4244('0x14')]);}logger[_0x4244('0x12')](_0x4244('0xd'),_0x40a267,_0x364521[_0x4244('0x12')][_0x4244('0x14')]);return _0x30506b(_0x364521['error'][_0x4244('0x14')]);}else{logger[_0x4244('0xc')](_0x4244('0xd'),_0x40a267,_0x4244('0xe'));_0x30506b(_0x364521[_0x4244('0x15')][_0x4244('0x14')]);}})[_0x4244('0x16')](function(_0x23ad06){logger['error']('ZohoField,\x20%s,\x20%s',_0x40a267,_0x23ad06);_0x51b782(_0x23ad06);});});}