Built motion from commit 9d7072cc.|2.5.39
[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 _0x946c=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmField,\x20%s,\x20%s','message','result','lodash','moment'];(function(_0x4b5d08,_0x106fea){var _0x5a827b=function(_0x16242b){while(--_0x16242b){_0x4b5d08['push'](_0x4b5d08['shift']());}};_0x5a827b(++_0x106fea);}(_0x946c,0x15e));var _0xc946=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x946c[_0x3ff085];return _0x2b68c3;};'use strict';var _=require(_0xc946('0x0'));var util=require('util');var moment=require(_0xc946('0x1'));var BPromise=require('bluebird');var rs=require(_0xc946('0x2'));var fs=require('fs');var Redis=require(_0xc946('0x3'));var db=require(_0xc946('0x4'))['db'];var utils=require(_0xc946('0x5'));var logger=require(_0xc946('0x6'))(_0xc946('0x7'));var config=require('../../config/environment');var jayson=require(_0xc946('0x8'));var client=jayson[_0xc946('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24eeeb,_0x37f11b,_0x33d6e4){return new BPromise(function(_0x4fdb7e,_0x4eb9ed){return client[_0xc946('0xa')](_0x24eeeb,_0x33d6e4)[_0xc946('0xb')](function(_0x2a4859){logger[_0xc946('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x37f11b,_0xc946('0xd'));logger[_0xc946('0xe')](_0xc946('0xf'),_0x37f11b,'request\x20sent',JSON[_0xc946('0x10')](_0x2a4859));if(_0x2a4859[_0xc946('0x11')]){if(_0x2a4859[_0xc946('0x11')][_0xc946('0x12')]===0x1f4){logger[_0xc946('0x11')](_0xc946('0x13'),_0x37f11b,_0x2a4859[_0xc946('0x11')]['message']);return _0x4eb9ed(_0x2a4859[_0xc946('0x11')][_0xc946('0x14')]);}logger[_0xc946('0x11')](_0xc946('0x13'),_0x37f11b,_0x2a4859[_0xc946('0x11')][_0xc946('0x14')]);return _0x4fdb7e(_0x2a4859[_0xc946('0x11')][_0xc946('0x14')]);}else{logger[_0xc946('0xc')](_0xc946('0x13'),_0x37f11b,'request\x20sent');_0x4fdb7e(_0x2a4859[_0xc946('0x15')][_0xc946('0x14')]);}})['catch'](function(_0x5ce6ec){logger[_0xc946('0x11')](_0xc946('0x13'),_0x37f11b,_0x5ce6ec);_0x4eb9ed(_0x5ce6ec);});});}