5dc29496d50857de38624e9701f3ff19b7f2716a
[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 _0xe5bf=['randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe5bf,0x173));var _0xfe5b=function(_0x8d26d0,_0x38b612){_0x8d26d0=_0x8d26d0-0x0;var _0x45aec0=_0xe5bf[_0x8d26d0];return _0x45aec0;};'use strict';var _=require(_0xfe5b('0x0'));var util=require(_0xfe5b('0x1'));var moment=require(_0xfe5b('0x2'));var BPromise=require('bluebird');var rs=require(_0xfe5b('0x3'));var fs=require('fs');var Redis=require(_0xfe5b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfe5b('0x5'))(_0xfe5b('0x6'));var config=require(_0xfe5b('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfe5b('0x8')][_0xfe5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c8a35,_0x115028,_0x1c42fa){return new BPromise(function(_0x309914,_0x465d3a){return client[_0xfe5b('0xa')](_0x2c8a35,_0x1c42fa)[_0xfe5b('0xb')](function(_0x2a83e5){logger[_0xfe5b('0xc')](_0xfe5b('0xd'),_0x115028,'request\x20sent');logger[_0xfe5b('0xe')](_0xfe5b('0xf'),_0x115028,_0xfe5b('0x10'),JSON[_0xfe5b('0x11')](_0x2a83e5));if(_0x2a83e5[_0xfe5b('0x12')]){if(_0x2a83e5[_0xfe5b('0x12')]['code']===0x1f4){logger[_0xfe5b('0x12')](_0xfe5b('0xd'),_0x115028,_0x2a83e5[_0xfe5b('0x12')][_0xfe5b('0x13')]);return _0x465d3a(_0x2a83e5['error'][_0xfe5b('0x13')]);}logger[_0xfe5b('0x12')]('SalesforceConfiguration,\x20%s,\x20%s',_0x115028,_0x2a83e5[_0xfe5b('0x12')][_0xfe5b('0x13')]);return _0x309914(_0x2a83e5[_0xfe5b('0x12')]['message']);}else{logger['info'](_0xfe5b('0xd'),_0x115028,_0xfe5b('0x10'));_0x309914(_0x2a83e5[_0xfe5b('0x14')][_0xfe5b('0x13')]);}})[_0xfe5b('0x15')](function(_0xd2fdc6){logger['error'](_0xfe5b('0xd'),_0x115028,_0xd2fdc6);_0x465d3a(_0xd2fdc6);});});}