b7648ae602ec9fb7bbd2c476308d89e089243e71
[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 _0xb584=['SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3f0786,_0x39dc55){var _0x1c4e10=function(_0x123367){while(--_0x123367){_0x3f0786['push'](_0x3f0786['shift']());}};_0x1c4e10(++_0x39dc55);}(_0xb584,0x146));var _0x4b58=function(_0x815a22,_0x3a6872){_0x815a22=_0x815a22-0x0;var _0x6c28fd=_0xb584[_0x815a22];return _0x6c28fd;};'use strict';var _=require(_0x4b58('0x0'));var util=require(_0x4b58('0x1'));var moment=require(_0x4b58('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4b58('0x3'));var db=require(_0x4b58('0x4'))['db'];var utils=require(_0x4b58('0x5'));var logger=require(_0x4b58('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4b58('0x7')][_0x4b58('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x214fab,_0x3ac386,_0x27da52){return new BPromise(function(_0x505c6c,_0x59b5fa){return client[_0x4b58('0x9')](_0x214fab,_0x27da52)['then'](function(_0x5acd5b){logger[_0x4b58('0xa')](_0x4b58('0xb'),_0x3ac386,_0x4b58('0xc'));logger[_0x4b58('0xd')](_0x4b58('0xe'),_0x3ac386,_0x4b58('0xc'),JSON[_0x4b58('0xf')](_0x5acd5b));if(_0x5acd5b['error']){if(_0x5acd5b[_0x4b58('0x10')][_0x4b58('0x11')]===0x1f4){logger[_0x4b58('0x10')](_0x4b58('0xb'),_0x3ac386,_0x5acd5b['error']['message']);return _0x59b5fa(_0x5acd5b[_0x4b58('0x10')][_0x4b58('0x12')]);}logger[_0x4b58('0x10')](_0x4b58('0xb'),_0x3ac386,_0x5acd5b[_0x4b58('0x10')][_0x4b58('0x12')]);return _0x505c6c(_0x5acd5b[_0x4b58('0x10')][_0x4b58('0x12')]);}else{logger[_0x4b58('0xa')](_0x4b58('0xb'),_0x3ac386,'request\x20sent');_0x505c6c(_0x5acd5b[_0x4b58('0x13')]['message']);}})['catch'](function(_0x51045e){logger['error'](_0x4b58('0xb'),_0x3ac386,_0x51045e);_0x59b5fa(_0x51045e);});});}