b234a7c6e6e9cbebdd0a1adfe6d7f5ca4bcecfce
[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 _0x2f72=['message','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SugarcrmConfiguration,\x20%s,\x20%s','result'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x2f72,0x94));var _0x22f7=function(_0x4903bd,_0x3b01f8){_0x4903bd=_0x4903bd-0x0;var _0x4eceba=_0x2f72[_0x4903bd];return _0x4eceba;};'use strict';var _=require(_0x22f7('0x0'));var util=require(_0x22f7('0x1'));var moment=require(_0x22f7('0x2'));var BPromise=require(_0x22f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x22f7('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x22f7('0x5'))(_0x22f7('0x6'));var config=require(_0x22f7('0x7'));var jayson=require(_0x22f7('0x8'));var client=jayson[_0x22f7('0x9')][_0x22f7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x70a153,_0x382b6d,_0x6c4674){return new BPromise(function(_0xfa0af6,_0x5e5b7f){return client[_0x22f7('0xb')](_0x70a153,_0x6c4674)[_0x22f7('0xc')](function(_0xbd7d25){logger[_0x22f7('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x382b6d,'request\x20sent');logger['debug'](_0x22f7('0xe'),_0x382b6d,_0x22f7('0xf'),JSON[_0x22f7('0x10')](_0xbd7d25));if(_0xbd7d25['error']){if(_0xbd7d25[_0x22f7('0x11')]['code']===0x1f4){logger[_0x22f7('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x382b6d,_0xbd7d25[_0x22f7('0x11')]['message']);return _0x5e5b7f(_0xbd7d25[_0x22f7('0x11')]['message']);}logger[_0x22f7('0x11')](_0x22f7('0x12'),_0x382b6d,_0xbd7d25[_0x22f7('0x11')]['message']);return _0xfa0af6(_0xbd7d25['error']['message']);}else{logger[_0x22f7('0xd')](_0x22f7('0x12'),_0x382b6d,_0x22f7('0xf'));_0xfa0af6(_0xbd7d25[_0x22f7('0x13')][_0x22f7('0x14')]);}})['catch'](function(_0x210197){logger[_0x22f7('0x11')](_0x22f7('0x12'),_0x382b6d,_0x210197);_0x5e5b7f(_0x210197);});});}