Built motion from commit f7863d46.|2.5.41
[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 _0x3bc7=['message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','SugarcrmField,\x20%s,\x20%s'];(function(_0x437d5b,_0x154db3){var _0x2d634e=function(_0xa5019b){while(--_0xa5019b){_0x437d5b['push'](_0x437d5b['shift']());}};_0x2d634e(++_0x154db3);}(_0x3bc7,0xa3));var _0x73bc=function(_0x28a7c9,_0x523cd5){_0x28a7c9=_0x28a7c9-0x0;var _0x459de4=_0x3bc7[_0x28a7c9];return _0x459de4;};'use strict';var _=require(_0x73bc('0x0'));var util=require(_0x73bc('0x1'));var moment=require(_0x73bc('0x2'));var BPromise=require('bluebird');var rs=require(_0x73bc('0x3'));var fs=require('fs');var Redis=require(_0x73bc('0x4'));var db=require(_0x73bc('0x5'))['db'];var utils=require(_0x73bc('0x6'));var logger=require(_0x73bc('0x7'))(_0x73bc('0x8'));var config=require(_0x73bc('0x9'));var jayson=require(_0x73bc('0xa'));var client=jayson[_0x73bc('0xb')][_0x73bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf6c68d,_0x4ef835,_0x3eb009){return new BPromise(function(_0x549654,_0x46774f){return client[_0x73bc('0xd')](_0xf6c68d,_0x3eb009)['then'](function(_0x585a81){logger[_0x73bc('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x4ef835,_0x73bc('0xf'));logger[_0x73bc('0x10')](_0x73bc('0x11'),_0x4ef835,_0x73bc('0xf'),JSON[_0x73bc('0x12')](_0x585a81));if(_0x585a81[_0x73bc('0x13')]){if(_0x585a81[_0x73bc('0x13')]['code']===0x1f4){logger[_0x73bc('0x13')](_0x73bc('0x14'),_0x4ef835,_0x585a81[_0x73bc('0x13')][_0x73bc('0x15')]);return _0x46774f(_0x585a81['error'][_0x73bc('0x15')]);}logger[_0x73bc('0x13')](_0x73bc('0x14'),_0x4ef835,_0x585a81[_0x73bc('0x13')][_0x73bc('0x15')]);return _0x549654(_0x585a81[_0x73bc('0x13')]['message']);}else{logger[_0x73bc('0xe')](_0x73bc('0x14'),_0x4ef835,_0x73bc('0xf'));_0x549654(_0x585a81[_0x73bc('0x16')][_0x73bc('0x15')]);}})['catch'](function(_0x410983){logger[_0x73bc('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x4ef835,_0x410983);_0x46774f(_0x410983);});});}