Built motion from commit 1fd437e9.|2.6.19
[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 _0xf2cf=['../../config/logger','rpc','../../config/environment','client','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1f9edb,_0x120d6d){var _0x4074d9=function(_0xbf109){while(--_0xbf109){_0x1f9edb['push'](_0x1f9edb['shift']());}};_0x4074d9(++_0x120d6d);}(_0xf2cf,0x1b1));var _0xff2c=function(_0x46f5b0,_0x3cb96f){_0x46f5b0=_0x46f5b0-0x0;var _0x509db0=_0xf2cf[_0x46f5b0];return _0x509db0;};'use strict';var _=require(_0xff2c('0x0'));var util=require(_0xff2c('0x1'));var moment=require(_0xff2c('0x2'));var BPromise=require(_0xff2c('0x3'));var rs=require(_0xff2c('0x4'));var fs=require('fs');var Redis=require(_0xff2c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xff2c('0x6'));var logger=require(_0xff2c('0x7'))(_0xff2c('0x8'));var config=require(_0xff2c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xff2c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x429f51,_0x2c6500,_0x36b59f){return new BPromise(function(_0xf5c572,_0x351571){return client[_0xff2c('0xb')](_0x429f51,_0x36b59f)[_0xff2c('0xc')](function(_0x2795c8){logger['info'](_0xff2c('0xd'),_0x2c6500,_0xff2c('0xe'));logger['debug']('ZohoField,\x20%s,\x20%s,\x20%s',_0x2c6500,_0xff2c('0xe'),JSON[_0xff2c('0xf')](_0x2795c8));if(_0x2795c8[_0xff2c('0x10')]){if(_0x2795c8[_0xff2c('0x10')]['code']===0x1f4){logger['error'](_0xff2c('0xd'),_0x2c6500,_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);return _0x351571(_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);}logger[_0xff2c('0x10')](_0xff2c('0xd'),_0x2c6500,_0x2795c8[_0xff2c('0x10')][_0xff2c('0x11')]);return _0xf5c572(_0x2795c8['error'][_0xff2c('0x11')]);}else{logger[_0xff2c('0x12')](_0xff2c('0xd'),_0x2c6500,'request\x20sent');_0xf5c572(_0x2795c8[_0xff2c('0x13')][_0xff2c('0x11')]);}})['catch'](function(_0x59b485){logger[_0xff2c('0x10')](_0xff2c('0xd'),_0x2c6500,_0x59b485);_0x351571(_0x59b485);});});}