Built motion from commit 3e059bc2.|2.5.32
[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 _0x2499=['result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','error','code','message','info'];(function(_0x86bedc,_0x5b23a9){var _0x32beb3=function(_0x4ea252){while(--_0x4ea252){_0x86bedc['push'](_0x86bedc['shift']());}};_0x32beb3(++_0x5b23a9);}(_0x2499,0x1dc));var _0x9249=function(_0x17f4d5,_0x25c642){_0x17f4d5=_0x17f4d5-0x0;var _0x6b0a0f=_0x2499[_0x17f4d5];return _0x6b0a0f;};'use strict';var _=require(_0x9249('0x0'));var util=require(_0x9249('0x1'));var moment=require(_0x9249('0x2'));var BPromise=require(_0x9249('0x3'));var rs=require(_0x9249('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9249('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9249('0x6'))(_0x9249('0x7'));var config=require('../../config/environment');var jayson=require(_0x9249('0x8'));var client=jayson[_0x9249('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x57a945,_0xc98668,_0x360323){return new BPromise(function(_0x43f74f,_0x1bd296){return client[_0x9249('0xa')](_0x57a945,_0x360323)[_0x9249('0xb')](function(_0x33c9a4){logger['info'](_0x9249('0xc'),_0xc98668,_0x9249('0xd'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0xc98668,_0x9249('0xd'),JSON['stringify'](_0x33c9a4));if(_0x33c9a4[_0x9249('0xe')]){if(_0x33c9a4[_0x9249('0xe')][_0x9249('0xf')]===0x1f4){logger[_0x9249('0xe')](_0x9249('0xc'),_0xc98668,_0x33c9a4[_0x9249('0xe')][_0x9249('0x10')]);return _0x1bd296(_0x33c9a4[_0x9249('0xe')][_0x9249('0x10')]);}logger[_0x9249('0xe')](_0x9249('0xc'),_0xc98668,_0x33c9a4['error'][_0x9249('0x10')]);return _0x43f74f(_0x33c9a4[_0x9249('0xe')][_0x9249('0x10')]);}else{logger[_0x9249('0x11')](_0x9249('0xc'),_0xc98668,_0x9249('0xd'));_0x43f74f(_0x33c9a4[_0x9249('0x12')]['message']);}})['catch'](function(_0x335014){logger[_0x9249('0xe')](_0x9249('0xc'),_0xc98668,_0x335014);_0x1bd296(_0x335014);});});}