Built motion from commit 85328c08.|2.5.50
[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 _0x877a=['http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x148da6,_0x367a47){var _0x211e8f=function(_0xe9ae7e){while(--_0xe9ae7e){_0x148da6['push'](_0x148da6['shift']());}};_0x211e8f(++_0x367a47);}(_0x877a,0x1a9));var _0xa877=function(_0xb265b5,_0x3a1d12){_0xb265b5=_0xb265b5-0x0;var _0x4aee9e=_0x877a[_0xb265b5];return _0x4aee9e;};'use strict';var _=require(_0xa877('0x0'));var util=require(_0xa877('0x1'));var moment=require(_0xa877('0x2'));var BPromise=require(_0xa877('0x3'));var rs=require(_0xa877('0x4'));var fs=require('fs');var Redis=require(_0xa877('0x5'));var db=require(_0xa877('0x6'))['db'];var utils=require(_0xa877('0x7'));var logger=require(_0xa877('0x8'))(_0xa877('0x9'));var config=require('../../config/environment');var jayson=require(_0xa877('0xa'));var client=jayson[_0xa877('0xb')][_0xa877('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d4c0a,_0x4ece42,_0x4c9558){return new BPromise(function(_0x55af7e,_0x3ce1a1){return client[_0xa877('0xd')](_0x3d4c0a,_0x4c9558)[_0xa877('0xe')](function(_0x5b9004){logger['info'](_0xa877('0xf'),_0x4ece42,_0xa877('0x10'));logger['debug']('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x4ece42,'request\x20sent',JSON[_0xa877('0x11')](_0x5b9004));if(_0x5b9004['error']){if(_0x5b9004[_0xa877('0x12')][_0xa877('0x13')]===0x1f4){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4ece42,_0x5b9004[_0xa877('0x12')][_0xa877('0x14')]);return _0x3ce1a1(_0x5b9004[_0xa877('0x12')][_0xa877('0x14')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x4ece42,_0x5b9004[_0xa877('0x12')]['message']);return _0x55af7e(_0x5b9004['error']['message']);}else{logger['info'](_0xa877('0xf'),_0x4ece42,'request\x20sent');_0x55af7e(_0x5b9004[_0xa877('0x15')]['message']);}})[_0xa877('0x16')](function(_0x51bd16){logger[_0xa877('0x12')](_0xa877('0xf'),_0x4ece42,_0x51bd16);_0x3ce1a1(_0x51bd16);});});}