Built motion from commit efa66e19.|2.6.22
[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 _0x6879=['ioredis','../../config/logger','jayson/promise','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','moment','bluebird','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6879,0x88));var _0x9687=function(_0x90b3ef,_0x340160){_0x90b3ef=_0x90b3ef-0x0;var _0x28e487=_0x6879[_0x90b3ef];return _0x28e487;};'use strict';var _=require(_0x9687('0x0'));var util=require('util');var moment=require(_0x9687('0x1'));var BPromise=require(_0x9687('0x2'));var rs=require(_0x9687('0x3'));var fs=require('fs');var Redis=require(_0x9687('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9687('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9687('0x6'));var client=jayson[_0x9687('0x7')][_0x9687('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x6f3081,_0x226755,_0x4e692d){return new BPromise(function(_0x2af42b,_0x1cfd34){return client[_0x9687('0x9')](_0x6f3081,_0x4e692d)[_0x9687('0xa')](function(_0x2a411f){logger['info'](_0x9687('0xb'),_0x226755,_0x9687('0xc'));logger[_0x9687('0xd')](_0x9687('0xe'),_0x226755,_0x9687('0xc'),JSON['stringify'](_0x2a411f));if(_0x2a411f[_0x9687('0xf')]){if(_0x2a411f[_0x9687('0xf')][_0x9687('0x10')]===0x1f4){logger[_0x9687('0xf')](_0x9687('0xb'),_0x226755,_0x2a411f['error'][_0x9687('0x11')]);return _0x1cfd34(_0x2a411f[_0x9687('0xf')]['message']);}logger[_0x9687('0xf')](_0x9687('0xb'),_0x226755,_0x2a411f[_0x9687('0xf')]['message']);return _0x2af42b(_0x2a411f[_0x9687('0xf')][_0x9687('0x11')]);}else{logger[_0x9687('0x12')](_0x9687('0xb'),_0x226755,_0x9687('0xc'));_0x2af42b(_0x2a411f['result']['message']);}})[_0x9687('0x13')](function(_0x3c31c0){logger[_0x9687('0xf')](_0x9687('0xb'),_0x226755,_0x3c31c0);_0x1cfd34(_0x3c31c0);});});}