Built motion from commit 5ae82ce5.|2.6.7
[motion2.git] / server / api / intSalesforceConfiguration / intSalesforceConfiguration.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 _0x5150=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','client','http','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x562bb5,_0x34fdd4){var _0x34bb21=function(_0x243d79){while(--_0x243d79){_0x562bb5['push'](_0x562bb5['shift']());}};_0x34bb21(++_0x34fdd4);}(_0x5150,0x18e));var _0x0515=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0x5150[_0x2e4aa2];return _0x5e6092;};'use strict';var _=require('lodash');var util=require(_0x0515('0x0'));var moment=require(_0x0515('0x1'));var BPromise=require(_0x0515('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0515('0x3'));var db=require(_0x0515('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0515('0x5')][_0x0515('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x4516d5,_0x416018,_0xa4ba55){return new BPromise(function(_0xd8999d,_0x31964e){return client['request'](_0x4516d5,_0xa4ba55)['then'](function(_0x54a10b){logger[_0x0515('0x7')](_0x0515('0x8'),_0x416018,_0x0515('0x9'));logger['debug'](_0x0515('0xa'),_0x416018,'request\x20sent',JSON[_0x0515('0xb')](_0x54a10b));if(_0x54a10b[_0x0515('0xc')]){if(_0x54a10b[_0x0515('0xc')][_0x0515('0xd')]===0x1f4){logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);return _0x31964e(_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);}logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);return _0xd8999d(_0x54a10b[_0x0515('0xc')][_0x0515('0xe')]);}else{logger[_0x0515('0x7')]('SalesforceConfiguration,\x20%s,\x20%s',_0x416018,'request\x20sent');_0xd8999d(_0x54a10b[_0x0515('0xf')][_0x0515('0xe')]);}})[_0x0515('0x10')](function(_0x2022c5){logger[_0x0515('0xc')](_0x0515('0x8'),_0x416018,_0x2022c5);_0x31964e(_0x2022c5);});});}