Built motion from commit 9e1399f3.|2.5.37
[motion2.git] / server / api / intSalesforceField / intSalesforceField.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 _0xf75b=['code','error','message','info','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4e80bf,_0x53f81a){var _0x280e8e=function(_0x2f10bb){while(--_0x2f10bb){_0x4e80bf['push'](_0x4e80bf['shift']());}};_0x280e8e(++_0x53f81a);}(_0xf75b,0x194));var _0xbf75=function(_0x5e5cab,_0x4d862){_0x5e5cab=_0x5e5cab-0x0;var _0x1cc14e=_0xf75b[_0x5e5cab];return _0x1cc14e;};'use strict';var _=require(_0xbf75('0x0'));var util=require(_0xbf75('0x1'));var moment=require(_0xbf75('0x2'));var BPromise=require('bluebird');var rs=require(_0xbf75('0x3'));var fs=require('fs');var Redis=require(_0xbf75('0x4'));var db=require(_0xbf75('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbf75('0x6'));var config=require(_0xbf75('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbf75('0x8')][_0xbf75('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ced77,_0x27bf68,_0x5e29af){return new BPromise(function(_0x3880f8,_0x329487){return client[_0xbf75('0xa')](_0x5ced77,_0x5e29af)[_0xbf75('0xb')](function(_0xb4c970){logger['info'](_0xbf75('0xc'),_0x27bf68,_0xbf75('0xd'));logger[_0xbf75('0xe')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x27bf68,_0xbf75('0xd'),JSON[_0xbf75('0xf')](_0xb4c970));if(_0xb4c970['error']){if(_0xb4c970['error'][_0xbf75('0x10')]===0x1f4){logger[_0xbf75('0x11')](_0xbf75('0xc'),_0x27bf68,_0xb4c970[_0xbf75('0x11')][_0xbf75('0x12')]);return _0x329487(_0xb4c970[_0xbf75('0x11')][_0xbf75('0x12')]);}logger[_0xbf75('0x11')]('SalesforceField,\x20%s,\x20%s',_0x27bf68,_0xb4c970['error'][_0xbf75('0x12')]);return _0x3880f8(_0xb4c970[_0xbf75('0x11')][_0xbf75('0x12')]);}else{logger[_0xbf75('0x13')](_0xbf75('0xc'),_0x27bf68,'request\x20sent');_0x3880f8(_0xb4c970['result'][_0xbf75('0x12')]);}})['catch'](function(_0x34b01e){logger[_0xbf75('0x11')](_0xbf75('0xc'),_0x27bf68,_0x34b01e);_0x329487(_0x34b01e);});});}