8c99593753aa669fe6e9ff3a6cb3192abe5814b2
[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 _0x8e89=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment'];(function(_0x4e8286,_0x4eaeb4){var _0x44a440=function(_0x5e0907){while(--_0x5e0907){_0x4e8286['push'](_0x4e8286['shift']());}};_0x44a440(++_0x4eaeb4);}(_0x8e89,0x139));var _0x98e8=function(_0x11f226,_0x491e30){_0x11f226=_0x11f226-0x0;var _0x30be77=_0x8e89[_0x11f226];return _0x30be77;};'use strict';var _=require('lodash');var util=require(_0x98e8('0x0'));var moment=require(_0x98e8('0x1'));var BPromise=require(_0x98e8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98e8('0x3'));var db=require(_0x98e8('0x4'))['db'];var utils=require(_0x98e8('0x5'));var logger=require(_0x98e8('0x6'))(_0x98e8('0x7'));var config=require('../../config/environment');var jayson=require(_0x98e8('0x8'));var client=jayson[_0x98e8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x511ff7,_0x1418d0,_0x23d0c5){return new BPromise(function(_0x2bf644,_0x43dab1){return client['request'](_0x511ff7,_0x23d0c5)[_0x98e8('0xa')](function(_0xd2a1df){logger[_0x98e8('0xb')](_0x98e8('0xc'),_0x1418d0,_0x98e8('0xd'));logger[_0x98e8('0xe')](_0x98e8('0xf'),_0x1418d0,_0x98e8('0xd'),JSON[_0x98e8('0x10')](_0xd2a1df));if(_0xd2a1df[_0x98e8('0x11')]){if(_0xd2a1df[_0x98e8('0x11')]['code']===0x1f4){logger[_0x98e8('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1418d0,_0xd2a1df[_0x98e8('0x11')]['message']);return _0x43dab1(_0xd2a1df[_0x98e8('0x11')][_0x98e8('0x12')]);}logger[_0x98e8('0x11')](_0x98e8('0xc'),_0x1418d0,_0xd2a1df[_0x98e8('0x11')][_0x98e8('0x12')]);return _0x2bf644(_0xd2a1df['error']['message']);}else{logger[_0x98e8('0xb')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1418d0,_0x98e8('0xd'));_0x2bf644(_0xd2a1df[_0x98e8('0x13')]['message']);}})[_0x98e8('0x14')](function(_0xac70b1){logger[_0x98e8('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x1418d0,_0xac70b1);_0x43dab1(_0xac70b1);});});}