Built motion from commit 10af8726.|2.6.34
[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 _0x5966=['jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x1f7a55,_0x352d22){var _0x2a291b=function(_0xc9d9f6){while(--_0xc9d9f6){_0x1f7a55['push'](_0x1f7a55['shift']());}};_0x2a291b(++_0x352d22);}(_0x5966,0x19a));var _0x6596=function(_0x10e983,_0x2f4eda){_0x10e983=_0x10e983-0x0;var _0x324138=_0x5966[_0x10e983];return _0x324138;};'use strict';var _=require('lodash');var util=require(_0x6596('0x0'));var moment=require(_0x6596('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6596('0x2'));var db=require(_0x6596('0x3'))['db'];var utils=require(_0x6596('0x4'));var logger=require(_0x6596('0x5'))(_0x6596('0x6'));var config=require(_0x6596('0x7'));var jayson=require(_0x6596('0x8'));var client=jayson[_0x6596('0x9')][_0x6596('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x47079d,_0x44098f,_0x51157f){return new BPromise(function(_0xbde18c,_0x2a819e){return client[_0x6596('0xb')](_0x47079d,_0x51157f)[_0x6596('0xc')](function(_0x5a3c74){logger[_0x6596('0xd')](_0x6596('0xe'),_0x44098f,_0x6596('0xf'));logger['debug'](_0x6596('0x10'),_0x44098f,_0x6596('0xf'),JSON[_0x6596('0x11')](_0x5a3c74));if(_0x5a3c74[_0x6596('0x12')]){if(_0x5a3c74[_0x6596('0x12')][_0x6596('0x13')]===0x1f4){logger[_0x6596('0x12')](_0x6596('0xe'),_0x44098f,_0x5a3c74['error']['message']);return _0x2a819e(_0x5a3c74[_0x6596('0x12')][_0x6596('0x14')]);}logger[_0x6596('0x12')](_0x6596('0xe'),_0x44098f,_0x5a3c74[_0x6596('0x12')][_0x6596('0x14')]);return _0xbde18c(_0x5a3c74[_0x6596('0x12')][_0x6596('0x14')]);}else{logger['info'](_0x6596('0xe'),_0x44098f,_0x6596('0xf'));_0xbde18c(_0x5a3c74['result'][_0x6596('0x14')]);}})[_0x6596('0x15')](function(_0x116292){logger[_0x6596('0x12')](_0x6596('0xe'),_0x44098f,_0x116292);_0x2a819e(_0x116292);});});}