55bf6a4f12ddc23b3dc5a0b10dbf6d744af50a0d
[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 _0x1705=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','lodash','randomstring','ioredis'];(function(_0x2865e8,_0x32014a){var _0x16fbb0=function(_0x24bd5f){while(--_0x24bd5f){_0x2865e8['push'](_0x2865e8['shift']());}};_0x16fbb0(++_0x32014a);}(_0x1705,0x6b));var _0x5170=function(_0x3f6e26,_0x811a34){_0x3f6e26=_0x3f6e26-0x0;var _0x474345=_0x1705[_0x3f6e26];return _0x474345;};'use strict';var _=require(_0x5170('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5170('0x1'));var fs=require('fs');var Redis=require(_0x5170('0x2'));var db=require(_0x5170('0x3'))['db'];var utils=require(_0x5170('0x4'));var logger=require(_0x5170('0x5'))(_0x5170('0x6'));var config=require(_0x5170('0x7'));var jayson=require(_0x5170('0x8'));var client=jayson[_0x5170('0x9')][_0x5170('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fbc14,_0x4d0be3,_0x39310f){return new BPromise(function(_0x23083b,_0x1bb28e){return client[_0x5170('0xb')](_0x4fbc14,_0x39310f)[_0x5170('0xc')](function(_0x59d0b3){logger['info'](_0x5170('0xd'),_0x4d0be3,'request\x20sent');logger[_0x5170('0xe')](_0x5170('0xf'),_0x4d0be3,_0x5170('0x10'),JSON[_0x5170('0x11')](_0x59d0b3));if(_0x59d0b3['error']){if(_0x59d0b3[_0x5170('0x12')][_0x5170('0x13')]===0x1f4){logger[_0x5170('0x12')](_0x5170('0xd'),_0x4d0be3,_0x59d0b3[_0x5170('0x12')][_0x5170('0x14')]);return _0x1bb28e(_0x59d0b3[_0x5170('0x12')][_0x5170('0x14')]);}logger[_0x5170('0x12')]('SalesforceField,\x20%s,\x20%s',_0x4d0be3,_0x59d0b3[_0x5170('0x12')][_0x5170('0x14')]);return _0x23083b(_0x59d0b3[_0x5170('0x12')]['message']);}else{logger[_0x5170('0x15')](_0x5170('0xd'),_0x4d0be3,_0x5170('0x10'));_0x23083b(_0x59d0b3['result']['message']);}})['catch'](function(_0x1c40fe){logger[_0x5170('0x12')]('SalesforceField,\x20%s,\x20%s',_0x4d0be3,_0x1c40fe);_0x1bb28e(_0x1c40fe);});});}