f539197eaaa44cc0b563b109cd6ae8160e32adc5
[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 _0x4798=['result','catch','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x4798,0x101));var _0x8479=function(_0x107df9,_0x4d1825){_0x107df9=_0x107df9-0x0;var _0x2df84a=_0x4798[_0x107df9];return _0x2df84a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8479('0x0'));var BPromise=require(_0x8479('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8479('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x8479('0x3'))(_0x8479('0x4'));var config=require(_0x8479('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8479('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x34f37a,_0x1ac4b8,_0x1843a8){return new BPromise(function(_0x45cb59,_0x1b76cf){return client['request'](_0x34f37a,_0x1843a8)[_0x8479('0x7')](function(_0xec5323){logger[_0x8479('0x8')](_0x8479('0x9'),_0x1ac4b8,_0x8479('0xa'));logger[_0x8479('0xb')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1ac4b8,_0x8479('0xa'),JSON['stringify'](_0xec5323));if(_0xec5323[_0x8479('0xc')]){if(_0xec5323[_0x8479('0xc')][_0x8479('0xd')]===0x1f4){logger['error'](_0x8479('0x9'),_0x1ac4b8,_0xec5323[_0x8479('0xc')][_0x8479('0xe')]);return _0x1b76cf(_0xec5323[_0x8479('0xc')][_0x8479('0xe')]);}logger[_0x8479('0xc')](_0x8479('0x9'),_0x1ac4b8,_0xec5323['error']['message']);return _0x45cb59(_0xec5323['error'][_0x8479('0xe')]);}else{logger[_0x8479('0x8')](_0x8479('0x9'),_0x1ac4b8,_0x8479('0xa'));_0x45cb59(_0xec5323[_0x8479('0xf')][_0x8479('0xe')]);}})[_0x8479('0x10')](function(_0x42d56c){logger[_0x8479('0xc')](_0x8479('0x9'),_0x1ac4b8,_0x42d56c);_0x1b76cf(_0x42d56c);});});}