dedb2d1baee09de9c2d44e37140edc2a2f449baf
[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 _0xeacd=['error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x199dcc,_0x13e81e){var _0x20f808=function(_0x4bfc7c){while(--_0x4bfc7c){_0x199dcc['push'](_0x199dcc['shift']());}};_0x20f808(++_0x13e81e);}(_0xeacd,0x10c));var _0xdeac=function(_0x4a8540,_0x5050f9){_0x4a8540=_0x4a8540-0x0;var _0x38ffe4=_0xeacd[_0x4a8540];return _0x38ffe4;};'use strict';var _=require(_0xdeac('0x0'));var util=require(_0xdeac('0x1'));var moment=require(_0xdeac('0x2'));var BPromise=require('bluebird');var rs=require(_0xdeac('0x3'));var fs=require('fs');var Redis=require(_0xdeac('0x4'));var db=require(_0xdeac('0x5'))['db'];var utils=require(_0xdeac('0x6'));var logger=require(_0xdeac('0x7'))(_0xdeac('0x8'));var config=require(_0xdeac('0x9'));var jayson=require(_0xdeac('0xa'));var client=jayson[_0xdeac('0xb')][_0xdeac('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4379dd,_0x38b052,_0x363a24){return new BPromise(function(_0x3d7f0d,_0x1a7b6f){return client[_0xdeac('0xd')](_0x4379dd,_0x363a24)[_0xdeac('0xe')](function(_0x4b0101){logger[_0xdeac('0xf')](_0xdeac('0x10'),_0x38b052,'request\x20sent');logger['debug'](_0xdeac('0x11'),_0x38b052,_0xdeac('0x12'),JSON[_0xdeac('0x13')](_0x4b0101));if(_0x4b0101['error']){if(_0x4b0101['error']['code']===0x1f4){logger['error'](_0xdeac('0x10'),_0x38b052,_0x4b0101[_0xdeac('0x14')]['message']);return _0x1a7b6f(_0x4b0101[_0xdeac('0x14')][_0xdeac('0x15')]);}logger['error'](_0xdeac('0x10'),_0x38b052,_0x4b0101[_0xdeac('0x14')][_0xdeac('0x15')]);return _0x3d7f0d(_0x4b0101['error'][_0xdeac('0x15')]);}else{logger[_0xdeac('0xf')](_0xdeac('0x10'),_0x38b052,_0xdeac('0x12'));_0x3d7f0d(_0x4b0101[_0xdeac('0x16')][_0xdeac('0x15')]);}})[_0xdeac('0x17')](function(_0x4d01f8){logger[_0xdeac('0x14')](_0xdeac('0x10'),_0x38b052,_0x4d01f8);_0x1a7b6f(_0x4d01f8);});});}