26222847586f8fb994adac19f410a9e0ec8203de
[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 _0x306d=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request'];(function(_0x3e8e15,_0x1a311d){var _0x282159=function(_0x35ffd3){while(--_0x35ffd3){_0x3e8e15['push'](_0x3e8e15['shift']());}};_0x282159(++_0x1a311d);}(_0x306d,0x9c));var _0xd306=function(_0x211fd0,_0x1ba061){_0x211fd0=_0x211fd0-0x0;var _0x3fd8e7=_0x306d[_0x211fd0];return _0x3fd8e7;};'use strict';var _=require(_0xd306('0x0'));var util=require(_0xd306('0x1'));var moment=require(_0xd306('0x2'));var BPromise=require('bluebird');var rs=require(_0xd306('0x3'));var fs=require('fs');var Redis=require(_0xd306('0x4'));var db=require(_0xd306('0x5'))['db'];var utils=require(_0xd306('0x6'));var logger=require(_0xd306('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd306('0x8'));var client=jayson[_0xd306('0x9')][_0xd306('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50dafe,_0x324a72,_0x857bfb){return new BPromise(function(_0x3d1668,_0x124cdf){return client[_0xd306('0xb')](_0x50dafe,_0x857bfb)[_0xd306('0xc')](function(_0x3ffd2d){logger[_0xd306('0xd')](_0xd306('0xe'),_0x324a72,_0xd306('0xf'));logger[_0xd306('0x10')](_0xd306('0x11'),_0x324a72,'request\x20sent',JSON[_0xd306('0x12')](_0x3ffd2d));if(_0x3ffd2d['error']){if(_0x3ffd2d[_0xd306('0x13')][_0xd306('0x14')]===0x1f4){logger[_0xd306('0x13')](_0xd306('0xe'),_0x324a72,_0x3ffd2d[_0xd306('0x13')][_0xd306('0x15')]);return _0x124cdf(_0x3ffd2d[_0xd306('0x13')][_0xd306('0x15')]);}logger[_0xd306('0x13')](_0xd306('0xe'),_0x324a72,_0x3ffd2d['error'][_0xd306('0x15')]);return _0x3d1668(_0x3ffd2d['error']['message']);}else{logger[_0xd306('0xd')]('ZohoField,\x20%s,\x20%s',_0x324a72,_0xd306('0xf'));_0x3d1668(_0x3ffd2d[_0xd306('0x16')][_0xd306('0x15')]);}})[_0xd306('0x17')](function(_0x3b4d64){logger[_0xd306('0x13')](_0xd306('0xe'),_0x324a72,_0x3b4d64);_0x124cdf(_0x3b4d64);});});}