Built motion from commit da617fac.|2.6.6
[motion2.git] / server / api / intSugarcrmField / intSugarcrmField.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 _0xcb2e=['SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent'];(function(_0x49b71e,_0x5cbe50){var _0x2a9e89=function(_0x221db8){while(--_0x221db8){_0x49b71e['push'](_0x49b71e['shift']());}};_0x2a9e89(++_0x5cbe50);}(_0xcb2e,0x99));var _0xecb2=function(_0x42228c,_0x2dc0e6){_0x42228c=_0x42228c-0x0;var _0x4616a5=_0xcb2e[_0x42228c];return _0x4616a5;};'use strict';var _=require(_0xecb2('0x0'));var util=require('util');var moment=require(_0xecb2('0x1'));var BPromise=require(_0xecb2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecb2('0x3'));var db=require(_0xecb2('0x4'))['db'];var utils=require(_0xecb2('0x5'));var logger=require(_0xecb2('0x6'))(_0xecb2('0x7'));var config=require(_0xecb2('0x8'));var jayson=require(_0xecb2('0x9'));var client=jayson['client'][_0xecb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x397f40,_0x560e6f,_0x4750fc){return new BPromise(function(_0x9e40c7,_0x4327b7){return client['request'](_0x397f40,_0x4750fc)[_0xecb2('0xb')](function(_0x10d48b){logger[_0xecb2('0xc')](_0xecb2('0xd'),_0x560e6f,_0xecb2('0xe'));logger['debug'](_0xecb2('0xf'),_0x560e6f,'request\x20sent',JSON[_0xecb2('0x10')](_0x10d48b));if(_0x10d48b[_0xecb2('0x11')]){if(_0x10d48b[_0xecb2('0x11')][_0xecb2('0x12')]===0x1f4){logger[_0xecb2('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x560e6f,_0x10d48b[_0xecb2('0x11')]['message']);return _0x4327b7(_0x10d48b[_0xecb2('0x11')]['message']);}logger['error'](_0xecb2('0xd'),_0x560e6f,_0x10d48b['error'][_0xecb2('0x13')]);return _0x9e40c7(_0x10d48b[_0xecb2('0x11')]['message']);}else{logger['info'](_0xecb2('0xd'),_0x560e6f,_0xecb2('0xe'));_0x9e40c7(_0x10d48b[_0xecb2('0x14')][_0xecb2('0x13')]);}})['catch'](function(_0x2c65b7){logger[_0xecb2('0x11')](_0xecb2('0xd'),_0x560e6f,_0x2c65b7);_0x4327b7(_0x2c65b7);});});}