Built motion from commit d5e4af8c.|2.6.23
[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 _0x2010=['request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','ZohoField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x2010,0xce));var _0x0201=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2010[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0201('0x0'));var util=require(_0x0201('0x1'));var moment=require(_0x0201('0x2'));var BPromise=require(_0x0201('0x3'));var rs=require(_0x0201('0x4'));var fs=require('fs');var Redis=require(_0x0201('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0201('0x6'));var logger=require(_0x0201('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0201('0x8'));var client=jayson[_0x0201('0x9')][_0x0201('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x265931,_0x29fc99,_0x8be28f){return new BPromise(function(_0x3d6467,_0x3652c1){return client[_0x0201('0xb')](_0x265931,_0x8be28f)[_0x0201('0xc')](function(_0x5c022c){logger[_0x0201('0xd')]('ZohoField,\x20%s,\x20%s',_0x29fc99,_0x0201('0xe'));logger[_0x0201('0xf')](_0x0201('0x10'),_0x29fc99,_0x0201('0xe'),JSON['stringify'](_0x5c022c));if(_0x5c022c[_0x0201('0x11')]){if(_0x5c022c[_0x0201('0x11')][_0x0201('0x12')]===0x1f4){logger[_0x0201('0x11')](_0x0201('0x13'),_0x29fc99,_0x5c022c[_0x0201('0x11')][_0x0201('0x14')]);return _0x3652c1(_0x5c022c[_0x0201('0x11')][_0x0201('0x14')]);}logger[_0x0201('0x11')](_0x0201('0x13'),_0x29fc99,_0x5c022c['error'][_0x0201('0x14')]);return _0x3d6467(_0x5c022c[_0x0201('0x11')][_0x0201('0x14')]);}else{logger[_0x0201('0xd')]('ZohoField,\x20%s,\x20%s',_0x29fc99,_0x0201('0xe'));_0x3d6467(_0x5c022c[_0x0201('0x15')]['message']);}})['catch'](function(_0x30050d){logger[_0x0201('0x11')](_0x0201('0x13'),_0x29fc99,_0x30050d);_0x3652c1(_0x30050d);});});}