30b87683bc5447d4b385d3b198b3c286610753e5
[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 _0x268f=['request\x20sent','error','code','message','info','result','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5346d1,_0x2e0612){var _0x4adbc1=function(_0x3d3754){while(--_0x3d3754){_0x5346d1['push'](_0x5346d1['shift']());}};_0x4adbc1(++_0x2e0612);}(_0x268f,0x149));var _0xf268=function(_0x287ff1,_0x1cb44a){_0x287ff1=_0x287ff1-0x0;var _0xb4dac6=_0x268f[_0x287ff1];return _0xb4dac6;};'use strict';var _=require(_0xf268('0x0'));var util=require(_0xf268('0x1'));var moment=require(_0xf268('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf268('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf268('0x4'));var logger=require('../../config/logger')(_0xf268('0x5'));var config=require(_0xf268('0x6'));var jayson=require(_0xf268('0x7'));var client=jayson[_0xf268('0x8')][_0xf268('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a6a6a,_0x1921bf,_0x216a8e){return new BPromise(function(_0x324c3f,_0x5be454){return client['request'](_0x5a6a6a,_0x216a8e)['then'](function(_0x8e30f6){logger['info'](_0xf268('0xa'),_0x1921bf,'request\x20sent');logger[_0xf268('0xb')](_0xf268('0xc'),_0x1921bf,_0xf268('0xd'),JSON['stringify'](_0x8e30f6));if(_0x8e30f6[_0xf268('0xe')]){if(_0x8e30f6[_0xf268('0xe')][_0xf268('0xf')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1921bf,_0x8e30f6['error'][_0xf268('0x10')]);return _0x5be454(_0x8e30f6[_0xf268('0xe')][_0xf268('0x10')]);}logger[_0xf268('0xe')](_0xf268('0xa'),_0x1921bf,_0x8e30f6['error']['message']);return _0x324c3f(_0x8e30f6[_0xf268('0xe')][_0xf268('0x10')]);}else{logger[_0xf268('0x11')](_0xf268('0xa'),_0x1921bf,_0xf268('0xd'));_0x324c3f(_0x8e30f6[_0xf268('0x12')][_0xf268('0x10')]);}})['catch'](function(_0x34cd5e){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1921bf,_0x34cd5e);_0x5be454(_0x34cd5e);});});}