6b7a8a656b85361959e57a7ff915792852f8487b
[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 _0x627a=['request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then'];(function(_0x30949b,_0x397e5a){var _0x4cdc35=function(_0x134ac6){while(--_0x134ac6){_0x30949b['push'](_0x30949b['shift']());}};_0x4cdc35(++_0x397e5a);}(_0x627a,0x1e8));var _0xa627=function(_0x16f6c8,_0x4f72b8){_0x16f6c8=_0x16f6c8-0x0;var _0x1068c9=_0x627a[_0x16f6c8];return _0x1068c9;};'use strict';var _=require(_0xa627('0x0'));var util=require(_0xa627('0x1'));var moment=require(_0xa627('0x2'));var BPromise=require(_0xa627('0x3'));var rs=require(_0xa627('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa627('0x5'))['db'];var utils=require(_0xa627('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xa627('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa627('0x8')][_0xa627('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x24fb78,_0x4e86f2,_0x43923b){return new BPromise(function(_0x42e3f7,_0x4cfbd1){return client[_0xa627('0xa')](_0x24fb78,_0x43923b)[_0xa627('0xb')](function(_0x3ae249){logger['info']('SalesforceField,\x20%s,\x20%s',_0x4e86f2,_0xa627('0xc'));logger['debug'](_0xa627('0xd'),_0x4e86f2,'request\x20sent',JSON[_0xa627('0xe')](_0x3ae249));if(_0x3ae249[_0xa627('0xf')]){if(_0x3ae249[_0xa627('0xf')]['code']===0x1f4){logger[_0xa627('0xf')](_0xa627('0x10'),_0x4e86f2,_0x3ae249['error'][_0xa627('0x11')]);return _0x4cfbd1(_0x3ae249[_0xa627('0xf')]['message']);}logger['error'](_0xa627('0x10'),_0x4e86f2,_0x3ae249['error'][_0xa627('0x11')]);return _0x42e3f7(_0x3ae249[_0xa627('0xf')][_0xa627('0x11')]);}else{logger[_0xa627('0x12')](_0xa627('0x10'),_0x4e86f2,_0xa627('0xc'));_0x42e3f7(_0x3ae249[_0xa627('0x13')][_0xa627('0x11')]);}})['catch'](function(_0x400fd6){logger[_0xa627('0xf')](_0xa627('0x10'),_0x4e86f2,_0x400fd6);_0x4cfbd1(_0x400fd6);});});}