8b2674c30f2fc81c77568ab92dd65638aec30a07
[motion2.git] / server / api / intSalesforceField / intSalesforceField.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 _0x71df=['code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','error'];(function(_0x575da1,_0x254942){var _0x1fa4ff=function(_0x5625dd){while(--_0x5625dd){_0x575da1['push'](_0x575da1['shift']());}};_0x1fa4ff(++_0x254942);}(_0x71df,0x8f));var _0xf71d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x71df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xf71d('0x0'));var moment=require(_0xf71d('0x1'));var BPromise=require(_0xf71d('0x2'));var rs=require(_0xf71d('0x3'));var fs=require('fs');var Redis=require(_0xf71d('0x4'));var db=require(_0xf71d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf71d('0x6'));var config=require(_0xf71d('0x7'));var jayson=require(_0xf71d('0x8'));var client=jayson['client'][_0xf71d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x233825,_0x57b709,_0x5e5416){return new BPromise(function(_0x1a6445,_0x49115){return client['request'](_0x233825,_0x5e5416)[_0xf71d('0xa')](function(_0x1524e8){logger[_0xf71d('0xb')](_0xf71d('0xc'),_0x57b709,_0xf71d('0xd'));logger[_0xf71d('0xe')](_0xf71d('0xf'),_0x57b709,'request\x20sent',JSON['stringify'](_0x1524e8));if(_0x1524e8[_0xf71d('0x10')]){if(_0x1524e8['error'][_0xf71d('0x11')]===0x1f4){logger[_0xf71d('0x10')](_0xf71d('0xc'),_0x57b709,_0x1524e8[_0xf71d('0x10')][_0xf71d('0x12')]);return _0x49115(_0x1524e8['error']['message']);}logger['error'](_0xf71d('0xc'),_0x57b709,_0x1524e8[_0xf71d('0x10')]['message']);return _0x1a6445(_0x1524e8['error']['message']);}else{logger[_0xf71d('0xb')](_0xf71d('0xc'),_0x57b709,_0xf71d('0xd'));_0x1a6445(_0x1524e8[_0xf71d('0x13')][_0xf71d('0x12')]);}})['catch'](function(_0x9e9ef0){logger['error'](_0xf71d('0xc'),_0x57b709,_0x9e9ef0);_0x49115(_0x9e9ef0);});});}