Built motion from commit 3d6333b4.|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 _0x8463=['catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x578de1,_0x5e2aec){var _0xcff24b=function(_0x54a580){while(--_0x54a580){_0x578de1['push'](_0x578de1['shift']());}};_0xcff24b(++_0x5e2aec);}(_0x8463,0x12d));var _0x3846=function(_0x3bdbf9,_0x20680a){_0x3bdbf9=_0x3bdbf9-0x0;var _0x3bb944=_0x8463[_0x3bdbf9];return _0x3bb944;};'use strict';var _=require(_0x3846('0x0'));var util=require('util');var moment=require(_0x3846('0x1'));var BPromise=require(_0x3846('0x2'));var rs=require(_0x3846('0x3'));var fs=require('fs');var Redis=require(_0x3846('0x4'));var db=require(_0x3846('0x5'))['db'];var utils=require(_0x3846('0x6'));var logger=require('../../config/logger')(_0x3846('0x7'));var config=require('../../config/environment');var jayson=require(_0x3846('0x8'));var client=jayson[_0x3846('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3fc478,_0x3e46ea,_0x227bfc){return new BPromise(function(_0xd57c1e,_0x36f13e){return client['request'](_0x3fc478,_0x227bfc)['then'](function(_0x1f5f06){logger[_0x3846('0xa')](_0x3846('0xb'),_0x3e46ea,_0x3846('0xc'));logger[_0x3846('0xd')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x3e46ea,'request\x20sent',JSON[_0x3846('0xe')](_0x1f5f06));if(_0x1f5f06[_0x3846('0xf')]){if(_0x1f5f06[_0x3846('0xf')][_0x3846('0x10')]===0x1f4){logger['error'](_0x3846('0xb'),_0x3e46ea,_0x1f5f06[_0x3846('0xf')][_0x3846('0x11')]);return _0x36f13e(_0x1f5f06['error']['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x3e46ea,_0x1f5f06[_0x3846('0xf')][_0x3846('0x11')]);return _0xd57c1e(_0x1f5f06[_0x3846('0xf')][_0x3846('0x11')]);}else{logger[_0x3846('0xa')](_0x3846('0xb'),_0x3e46ea,_0x3846('0xc'));_0xd57c1e(_0x1f5f06[_0x3846('0x12')][_0x3846('0x11')]);}})[_0x3846('0x13')](function(_0x39b311){logger[_0x3846('0xf')](_0x3846('0xb'),_0x3e46ea,_0x39b311);_0x36f13e(_0x39b311);});});}