Built motion from commit 43538d75.|2.5.35
[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 _0x0a64=['ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0xcc6f97,_0x243fd5){var _0x404d45=function(_0x27ded9){while(--_0x27ded9){_0xcc6f97['push'](_0xcc6f97['shift']());}};_0x404d45(++_0x243fd5);}(_0x0a64,0x10d));var _0x40a6=function(_0x5608e7,_0x1b3a20){_0x5608e7=_0x5608e7-0x0;var _0x25611a=_0x0a64[_0x5608e7];return _0x25611a;};'use strict';var _=require('lodash');var util=require(_0x40a6('0x0'));var moment=require(_0x40a6('0x1'));var BPromise=require(_0x40a6('0x2'));var rs=require(_0x40a6('0x3'));var fs=require('fs');var Redis=require(_0x40a6('0x4'));var db=require(_0x40a6('0x5'))['db'];var utils=require(_0x40a6('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x40a6('0x7'));var client=jayson[_0x40a6('0x8')][_0x40a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e5cfe,_0x5bbff6,_0x5d47b0){return new BPromise(function(_0x35a5f3,_0x52a849){return client[_0x40a6('0xa')](_0x5e5cfe,_0x5d47b0)[_0x40a6('0xb')](function(_0x283d1b){logger[_0x40a6('0xc')](_0x40a6('0xd'),_0x5bbff6,_0x40a6('0xe'));logger[_0x40a6('0xf')]('ZohoField,\x20%s,\x20%s,\x20%s',_0x5bbff6,_0x40a6('0xe'),JSON[_0x40a6('0x10')](_0x283d1b));if(_0x283d1b['error']){if(_0x283d1b[_0x40a6('0x11')]['code']===0x1f4){logger['error'](_0x40a6('0xd'),_0x5bbff6,_0x283d1b[_0x40a6('0x11')][_0x40a6('0x12')]);return _0x52a849(_0x283d1b[_0x40a6('0x11')]['message']);}logger[_0x40a6('0x11')](_0x40a6('0xd'),_0x5bbff6,_0x283d1b[_0x40a6('0x11')][_0x40a6('0x12')]);return _0x35a5f3(_0x283d1b[_0x40a6('0x11')][_0x40a6('0x12')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x5bbff6,_0x40a6('0xe'));_0x35a5f3(_0x283d1b[_0x40a6('0x13')][_0x40a6('0x12')]);}})[_0x40a6('0x14')](function(_0x13f6ce){logger['error'](_0x40a6('0xd'),_0x5bbff6,_0x13f6ce);_0x52a849(_0x13f6ce);});});}