db27ea4ea490db858b9eca50867e4b88cc799e84
[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 _0x4a74=['request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','../../mysqldb','client','http'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x4a74,0x192));var _0x44a7=function(_0x1a2729,_0x2700e1){_0x1a2729=_0x1a2729-0x0;var _0x7e373e=_0x4a74[_0x1a2729];return _0x7e373e;};'use strict';var _=require(_0x44a7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x44a7('0x1'));var rs=require(_0x44a7('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x44a7('0x3'))['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[_0x44a7('0x4')][_0x44a7('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x9aaf2,_0x2b4a56,_0xd5a6d){return new BPromise(function(_0x7115ba,_0x1d59d4){return client[_0x44a7('0x6')](_0x9aaf2,_0xd5a6d)[_0x44a7('0x7')](function(_0x5d1e68){logger[_0x44a7('0x8')](_0x44a7('0x9'),_0x2b4a56,_0x44a7('0xa'));logger[_0x44a7('0xb')](_0x44a7('0xc'),_0x2b4a56,_0x44a7('0xa'),JSON[_0x44a7('0xd')](_0x5d1e68));if(_0x5d1e68[_0x44a7('0xe')]){if(_0x5d1e68[_0x44a7('0xe')]['code']===0x1f4){logger[_0x44a7('0xe')](_0x44a7('0x9'),_0x2b4a56,_0x5d1e68[_0x44a7('0xe')][_0x44a7('0xf')]);return _0x1d59d4(_0x5d1e68['error'][_0x44a7('0xf')]);}logger[_0x44a7('0xe')](_0x44a7('0x9'),_0x2b4a56,_0x5d1e68[_0x44a7('0xe')]['message']);return _0x7115ba(_0x5d1e68[_0x44a7('0xe')][_0x44a7('0xf')]);}else{logger[_0x44a7('0x8')](_0x44a7('0x9'),_0x2b4a56,_0x44a7('0xa'));_0x7115ba(_0x5d1e68[_0x44a7('0x10')][_0x44a7('0xf')]);}})['catch'](function(_0x39b4da){logger['error'](_0x44a7('0x9'),_0x2b4a56,_0x39b4da);_0x1d59d4(_0x39b4da);});});}