Built motion from commit da24aabd.|2.6.20
[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 _0x3973=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','ZohoField,\x20%s,\x20%s','debug','ZohoField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1a484d,_0x3eda72){var _0x730117=function(_0x5927f5){while(--_0x5927f5){_0x1a484d['push'](_0x1a484d['shift']());}};_0x730117(++_0x3eda72);}(_0x3973,0x127));var _0x3397=function(_0x1e1407,_0x36ff1d){_0x1e1407=_0x1e1407-0x0;var _0x3399f0=_0x3973[_0x1e1407];return _0x3399f0;};'use strict';var _=require(_0x3397('0x0'));var util=require(_0x3397('0x1'));var moment=require(_0x3397('0x2'));var BPromise=require(_0x3397('0x3'));var rs=require(_0x3397('0x4'));var fs=require('fs');var Redis=require(_0x3397('0x5'));var db=require(_0x3397('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3397('0x7'))(_0x3397('0x8'));var config=require(_0x3397('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1927b6,_0x58364f,_0x325a3d){return new BPromise(function(_0x48678d,_0x526f9c){return client[_0x3397('0xa')](_0x1927b6,_0x325a3d)[_0x3397('0xb')](function(_0x3a2bc2){logger[_0x3397('0xc')](_0x3397('0xd'),_0x58364f,'request\x20sent');logger[_0x3397('0xe')](_0x3397('0xf'),_0x58364f,_0x3397('0x10'),JSON[_0x3397('0x11')](_0x3a2bc2));if(_0x3a2bc2[_0x3397('0x12')]){if(_0x3a2bc2[_0x3397('0x12')][_0x3397('0x13')]===0x1f4){logger[_0x3397('0x12')](_0x3397('0xd'),_0x58364f,_0x3a2bc2['error'][_0x3397('0x14')]);return _0x526f9c(_0x3a2bc2[_0x3397('0x12')][_0x3397('0x14')]);}logger[_0x3397('0x12')](_0x3397('0xd'),_0x58364f,_0x3a2bc2[_0x3397('0x12')][_0x3397('0x14')]);return _0x48678d(_0x3a2bc2[_0x3397('0x12')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x58364f,_0x3397('0x10'));_0x48678d(_0x3a2bc2[_0x3397('0x15')][_0x3397('0x14')]);}})[_0x3397('0x16')](function(_0x544e41){logger[_0x3397('0x12')]('ZohoField,\x20%s,\x20%s',_0x58364f,_0x544e41);_0x526f9c(_0x544e41);});});}