Built motion from commit 616d3211.|2.6.4
[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 _0x4a84=['debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent'];(function(_0x11c799,_0x14efdd){var _0x1b9b4b=function(_0x18880a){while(--_0x18880a){_0x11c799['push'](_0x11c799['shift']());}};_0x1b9b4b(++_0x14efdd);}(_0x4a84,0x106));var _0x44a8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4a84[_0x432682];return _0x463d05;};'use strict';var _=require(_0x44a8('0x0'));var util=require(_0x44a8('0x1'));var moment=require(_0x44a8('0x2'));var BPromise=require(_0x44a8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x44a8('0x4'));var db=require(_0x44a8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x44a8('0x6'))(_0x44a8('0x7'));var config=require('../../config/environment');var jayson=require(_0x44a8('0x8'));var client=jayson['client'][_0x44a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1fd105,_0x168aa4,_0x466fa6){return new BPromise(function(_0x204127,_0x1ba7f5){return client[_0x44a8('0xa')](_0x1fd105,_0x466fa6)[_0x44a8('0xb')](function(_0x231742){logger['info'](_0x44a8('0xc'),_0x168aa4,_0x44a8('0xd'));logger[_0x44a8('0xe')](_0x44a8('0xf'),_0x168aa4,_0x44a8('0xd'),JSON[_0x44a8('0x10')](_0x231742));if(_0x231742[_0x44a8('0x11')]){if(_0x231742[_0x44a8('0x11')][_0x44a8('0x12')]===0x1f4){logger[_0x44a8('0x11')](_0x44a8('0xc'),_0x168aa4,_0x231742[_0x44a8('0x11')][_0x44a8('0x13')]);return _0x1ba7f5(_0x231742[_0x44a8('0x11')][_0x44a8('0x13')]);}logger[_0x44a8('0x11')]('ZohoField,\x20%s,\x20%s',_0x168aa4,_0x231742[_0x44a8('0x11')][_0x44a8('0x13')]);return _0x204127(_0x231742[_0x44a8('0x11')]['message']);}else{logger[_0x44a8('0x14')]('ZohoField,\x20%s,\x20%s',_0x168aa4,_0x44a8('0xd'));_0x204127(_0x231742[_0x44a8('0x15')][_0x44a8('0x13')]);}})[_0x44a8('0x16')](function(_0x21a023){logger['error'](_0x44a8('0xc'),_0x168aa4,_0x21a023);_0x1ba7f5(_0x21a023);});});}