5a5a7657dba938be93a80374e0fb76df775dc122
[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 _0x9ea7=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x58af8b,_0x1071c6){var _0xc74d26=function(_0x232e4b){while(--_0x232e4b){_0x58af8b['push'](_0x58af8b['shift']());}};_0xc74d26(++_0x1071c6);}(_0x9ea7,0x113));var _0x79ea=function(_0x4a34e0,_0x29ff2f){_0x4a34e0=_0x4a34e0-0x0;var _0xb5ce1d=_0x9ea7[_0x4a34e0];return _0xb5ce1d;};'use strict';var _=require(_0x79ea('0x0'));var util=require(_0x79ea('0x1'));var moment=require('moment');var BPromise=require(_0x79ea('0x2'));var rs=require(_0x79ea('0x3'));var fs=require('fs');var Redis=require(_0x79ea('0x4'));var db=require(_0x79ea('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x79ea('0x6'));var config=require(_0x79ea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x79ea('0x8')][_0x79ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40f445,_0x219101,_0x4bb552){return new BPromise(function(_0x331eec,_0x2031e0){return client[_0x79ea('0xa')](_0x40f445,_0x4bb552)['then'](function(_0x30addf){logger[_0x79ea('0xb')](_0x79ea('0xc'),_0x219101,_0x79ea('0xd'));logger['debug'](_0x79ea('0xe'),_0x219101,_0x79ea('0xd'),JSON[_0x79ea('0xf')](_0x30addf));if(_0x30addf[_0x79ea('0x10')]){if(_0x30addf[_0x79ea('0x10')][_0x79ea('0x11')]===0x1f4){logger[_0x79ea('0x10')](_0x79ea('0xc'),_0x219101,_0x30addf[_0x79ea('0x10')][_0x79ea('0x12')]);return _0x2031e0(_0x30addf[_0x79ea('0x10')][_0x79ea('0x12')]);}logger['error'](_0x79ea('0xc'),_0x219101,_0x30addf[_0x79ea('0x10')][_0x79ea('0x12')]);return _0x331eec(_0x30addf[_0x79ea('0x10')][_0x79ea('0x12')]);}else{logger[_0x79ea('0xb')](_0x79ea('0xc'),_0x219101,_0x79ea('0xd'));_0x331eec(_0x30addf[_0x79ea('0x13')][_0x79ea('0x12')]);}})[_0x79ea('0x14')](function(_0x5536a1){logger[_0x79ea('0x10')](_0x79ea('0xc'),_0x219101,_0x5536a1);_0x2031e0(_0x5536a1);});});}