Built motion from commit f9526609.|2.6.29
[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 _0xc0af=['ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2b4cd3,_0x3b5c02){var _0x29447a=function(_0x1d5595){while(--_0x1d5595){_0x2b4cd3['push'](_0x2b4cd3['shift']());}};_0x29447a(++_0x3b5c02);}(_0xc0af,0x16b));var _0xfc0a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc0af[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xfc0a('0x0'));var util=require(_0xfc0a('0x1'));var moment=require(_0xfc0a('0x2'));var BPromise=require(_0xfc0a('0x3'));var rs=require(_0xfc0a('0x4'));var fs=require('fs');var Redis=require(_0xfc0a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfc0a('0x6'));var config=require(_0xfc0a('0x7'));var jayson=require(_0xfc0a('0x8'));var client=jayson[_0xfc0a('0x9')][_0xfc0a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x382617,_0x5ccfd5,_0x2de5ff){return new BPromise(function(_0x2525ea,_0xfeb397){return client[_0xfc0a('0xb')](_0x382617,_0x2de5ff)[_0xfc0a('0xc')](function(_0x55272e){logger[_0xfc0a('0xd')](_0xfc0a('0xe'),_0x5ccfd5,'request\x20sent');logger[_0xfc0a('0xf')](_0xfc0a('0x10'),_0x5ccfd5,_0xfc0a('0x11'),JSON[_0xfc0a('0x12')](_0x55272e));if(_0x55272e[_0xfc0a('0x13')]){if(_0x55272e[_0xfc0a('0x13')]['code']===0x1f4){logger[_0xfc0a('0x13')](_0xfc0a('0xe'),_0x5ccfd5,_0x55272e[_0xfc0a('0x13')][_0xfc0a('0x14')]);return _0xfeb397(_0x55272e[_0xfc0a('0x13')][_0xfc0a('0x14')]);}logger[_0xfc0a('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x5ccfd5,_0x55272e[_0xfc0a('0x13')][_0xfc0a('0x14')]);return _0x2525ea(_0x55272e[_0xfc0a('0x13')][_0xfc0a('0x14')]);}else{logger['info'](_0xfc0a('0xe'),_0x5ccfd5,'request\x20sent');_0x2525ea(_0x55272e[_0xfc0a('0x15')][_0xfc0a('0x14')]);}})[_0xfc0a('0x16')](function(_0x4f84b0){logger[_0xfc0a('0x13')](_0xfc0a('0xe'),_0x5ccfd5,_0x4f84b0);_0xfeb397(_0x4f84b0);});});}