Built motion from commit b5996064.|2.6.21
[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 _0x6211=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info'];(function(_0x27f4e7,_0x5b1433){var _0x2b2c7e=function(_0x13b773){while(--_0x13b773){_0x27f4e7['push'](_0x27f4e7['shift']());}};_0x2b2c7e(++_0x5b1433);}(_0x6211,0x1d2));var _0x1621=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x6211[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1621('0x0'));var util=require(_0x1621('0x1'));var moment=require(_0x1621('0x2'));var BPromise=require(_0x1621('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1621('0x4'));var db=require(_0x1621('0x5'))['db'];var utils=require(_0x1621('0x6'));var logger=require(_0x1621('0x7'))(_0x1621('0x8'));var config=require(_0x1621('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1621('0xa')][_0x1621('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x87ba90,_0xd9f54e,_0x3a1d6e){return new BPromise(function(_0x212be5,_0x55d5a8){return client['request'](_0x87ba90,_0x3a1d6e)[_0x1621('0xc')](function(_0x5744b2){logger[_0x1621('0xd')](_0x1621('0xe'),_0xd9f54e,_0x1621('0xf'));logger[_0x1621('0x10')](_0x1621('0x11'),_0xd9f54e,_0x1621('0xf'),JSON[_0x1621('0x12')](_0x5744b2));if(_0x5744b2['error']){if(_0x5744b2[_0x1621('0x13')][_0x1621('0x14')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0xd9f54e,_0x5744b2['error'][_0x1621('0x15')]);return _0x55d5a8(_0x5744b2[_0x1621('0x13')][_0x1621('0x15')]);}logger[_0x1621('0x13')](_0x1621('0xe'),_0xd9f54e,_0x5744b2['error']['message']);return _0x212be5(_0x5744b2[_0x1621('0x13')][_0x1621('0x15')]);}else{logger[_0x1621('0xd')]('SugarcrmField,\x20%s,\x20%s',_0xd9f54e,_0x1621('0xf'));_0x212be5(_0x5744b2[_0x1621('0x16')][_0x1621('0x15')]);}})[_0x1621('0x17')](function(_0x3558c6){logger[_0x1621('0x13')](_0x1621('0xe'),_0xd9f54e,_0x3558c6);_0x55d5a8(_0x3558c6);});});}