cdb8051b98f2e4faaa8e6c48ccb6b8f37dd48c89
[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 _0x63e1=['util','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash'];(function(_0x4e5931,_0x30fe94){var _0xae5ee=function(_0x17e2e9){while(--_0x17e2e9){_0x4e5931['push'](_0x4e5931['shift']());}};_0xae5ee(++_0x30fe94);}(_0x63e1,0xbd));var _0x163e=function(_0x5a4cf9,_0x1852b6){_0x5a4cf9=_0x5a4cf9-0x0;var _0x508328=_0x63e1[_0x5a4cf9];return _0x508328;};'use strict';var _=require(_0x163e('0x0'));var util=require(_0x163e('0x1'));var moment=require(_0x163e('0x2'));var BPromise=require(_0x163e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x163e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x163e('0x5'))(_0x163e('0x6'));var config=require(_0x163e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x163e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b1847,_0x4ec54f,_0x1e5b0b){return new BPromise(function(_0x1ed158,_0x34486a){return client[_0x163e('0x9')](_0x5b1847,_0x1e5b0b)[_0x163e('0xa')](function(_0x95760f){logger[_0x163e('0xb')](_0x163e('0xc'),_0x4ec54f,_0x163e('0xd'));logger[_0x163e('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x4ec54f,_0x163e('0xd'),JSON[_0x163e('0xf')](_0x95760f));if(_0x95760f[_0x163e('0x10')]){if(_0x95760f[_0x163e('0x10')]['code']===0x1f4){logger[_0x163e('0x10')](_0x163e('0xc'),_0x4ec54f,_0x95760f['error'][_0x163e('0x11')]);return _0x34486a(_0x95760f['error'][_0x163e('0x11')]);}logger[_0x163e('0x10')](_0x163e('0xc'),_0x4ec54f,_0x95760f[_0x163e('0x10')][_0x163e('0x11')]);return _0x1ed158(_0x95760f[_0x163e('0x10')]['message']);}else{logger['info'](_0x163e('0xc'),_0x4ec54f,'request\x20sent');_0x1ed158(_0x95760f[_0x163e('0x12')]['message']);}})['catch'](function(_0x4ec095){logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x4ec54f,_0x4ec095);_0x34486a(_0x4ec095);});});}