Built motion from commit 753c950e.|2.5.42
[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 _0x440d=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x9a51b3,_0x34ac18){var _0x4ca7b1=function(_0x455c6d){while(--_0x455c6d){_0x9a51b3['push'](_0x9a51b3['shift']());}};_0x4ca7b1(++_0x34ac18);}(_0x440d,0x111));var _0xd440=function(_0x2627c5,_0x3a0394){_0x2627c5=_0x2627c5-0x0;var _0x4f11fd=_0x440d[_0x2627c5];return _0x4f11fd;};'use strict';var _=require(_0xd440('0x0'));var util=require('util');var moment=require(_0xd440('0x1'));var BPromise=require(_0xd440('0x2'));var rs=require(_0xd440('0x3'));var fs=require('fs');var Redis=require(_0xd440('0x4'));var db=require(_0xd440('0x5'))['db'];var utils=require(_0xd440('0x6'));var logger=require(_0xd440('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd440('0x8'));var client=jayson[_0xd440('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7df9d9,_0x3e9c48,_0x4b58ed){return new BPromise(function(_0xe3c180,_0x2f4f40){return client[_0xd440('0xa')](_0x7df9d9,_0x4b58ed)['then'](function(_0x4a8756){logger[_0xd440('0xb')](_0xd440('0xc'),_0x3e9c48,_0xd440('0xd'));logger[_0xd440('0xe')](_0xd440('0xf'),_0x3e9c48,_0xd440('0xd'),JSON[_0xd440('0x10')](_0x4a8756));if(_0x4a8756[_0xd440('0x11')]){if(_0x4a8756[_0xd440('0x11')][_0xd440('0x12')]===0x1f4){logger['error'](_0xd440('0xc'),_0x3e9c48,_0x4a8756[_0xd440('0x11')][_0xd440('0x13')]);return _0x2f4f40(_0x4a8756[_0xd440('0x11')][_0xd440('0x13')]);}logger[_0xd440('0x11')](_0xd440('0xc'),_0x3e9c48,_0x4a8756[_0xd440('0x11')]['message']);return _0xe3c180(_0x4a8756['error'][_0xd440('0x13')]);}else{logger[_0xd440('0xb')](_0xd440('0xc'),_0x3e9c48,'request\x20sent');_0xe3c180(_0x4a8756[_0xd440('0x14')][_0xd440('0x13')]);}})[_0xd440('0x15')](function(_0x5b55b0){logger[_0xd440('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x3e9c48,_0x5b55b0);_0x2f4f40(_0x5b55b0);});});}