422bf4ca3ee57b2d374def5a119a8e5a87d83829
[motion2.git] / server / api / intSugarcrmConfiguration / intSugarcrmConfiguration.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 _0x74e1=['../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x44ff7d,_0x16542e){var _0x524573=function(_0x43a9fa){while(--_0x43a9fa){_0x44ff7d['push'](_0x44ff7d['shift']());}};_0x524573(++_0x16542e);}(_0x74e1,0x15a));var _0x174e=function(_0xfc87ae,_0x4416c8){_0xfc87ae=_0xfc87ae-0x0;var _0x551d2a=_0x74e1[_0xfc87ae];return _0x551d2a;};'use strict';var _=require(_0x174e('0x0'));var util=require(_0x174e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x174e('0x2'));var fs=require('fs');var Redis=require(_0x174e('0x3'));var db=require(_0x174e('0x4'))['db'];var utils=require(_0x174e('0x5'));var logger=require(_0x174e('0x6'))('rpc');var config=require(_0x174e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x174e('0x8')][_0x174e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x30d466,_0x293dc5,_0x527d15){return new BPromise(function(_0xd717ca,_0x1b5020){return client[_0x174e('0xa')](_0x30d466,_0x527d15)[_0x174e('0xb')](function(_0x22fa57){logger[_0x174e('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x293dc5,_0x174e('0xd'));logger['debug'](_0x174e('0xe'),_0x293dc5,'request\x20sent',JSON[_0x174e('0xf')](_0x22fa57));if(_0x22fa57[_0x174e('0x10')]){if(_0x22fa57[_0x174e('0x10')][_0x174e('0x11')]===0x1f4){logger[_0x174e('0x10')](_0x174e('0x12'),_0x293dc5,_0x22fa57[_0x174e('0x10')]['message']);return _0x1b5020(_0x22fa57[_0x174e('0x10')][_0x174e('0x13')]);}logger[_0x174e('0x10')](_0x174e('0x12'),_0x293dc5,_0x22fa57[_0x174e('0x10')][_0x174e('0x13')]);return _0xd717ca(_0x22fa57[_0x174e('0x10')][_0x174e('0x13')]);}else{logger[_0x174e('0xc')](_0x174e('0x12'),_0x293dc5,'request\x20sent');_0xd717ca(_0x22fa57[_0x174e('0x14')][_0x174e('0x13')]);}})[_0x174e('0x15')](function(_0x3375dd){logger[_0x174e('0x10')](_0x174e('0x12'),_0x293dc5,_0x3375dd);_0x1b5020(_0x3375dd);});});}