854675f86accfc40051ce01bd0a309fee00c9344
[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 _0x787f=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','SugarcrmField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x417441,_0x1e64d1){var _0x431950=function(_0x1e0261){while(--_0x1e0261){_0x417441['push'](_0x417441['shift']());}};_0x431950(++_0x1e64d1);}(_0x787f,0x1d4));var _0xf787=function(_0x4291d3,_0x760d53){_0x4291d3=_0x4291d3-0x0;var _0x507bd7=_0x787f[_0x4291d3];return _0x507bd7;};'use strict';var _=require(_0xf787('0x0'));var util=require(_0xf787('0x1'));var moment=require(_0xf787('0x2'));var BPromise=require(_0xf787('0x3'));var rs=require(_0xf787('0x4'));var fs=require('fs');var Redis=require(_0xf787('0x5'));var db=require(_0xf787('0x6'))['db'];var utils=require(_0xf787('0x7'));var logger=require(_0xf787('0x8'))(_0xf787('0x9'));var config=require('../../config/environment');var jayson=require(_0xf787('0xa'));var client=jayson[_0xf787('0xb')][_0xf787('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5494fd,_0x289b6c,_0x3677d8){return new BPromise(function(_0x3b0985,_0x345919){return client[_0xf787('0xd')](_0x5494fd,_0x3677d8)[_0xf787('0xe')](function(_0x2470d1){logger['info']('SugarcrmField,\x20%s,\x20%s',_0x289b6c,'request\x20sent');logger[_0xf787('0xf')](_0xf787('0x10'),_0x289b6c,'request\x20sent',JSON['stringify'](_0x2470d1));if(_0x2470d1[_0xf787('0x11')]){if(_0x2470d1['error']['code']===0x1f4){logger['error'](_0xf787('0x12'),_0x289b6c,_0x2470d1[_0xf787('0x11')][_0xf787('0x13')]);return _0x345919(_0x2470d1[_0xf787('0x11')][_0xf787('0x13')]);}logger['error'](_0xf787('0x12'),_0x289b6c,_0x2470d1[_0xf787('0x11')]['message']);return _0x3b0985(_0x2470d1[_0xf787('0x11')]['message']);}else{logger['info'](_0xf787('0x12'),_0x289b6c,_0xf787('0x14'));_0x3b0985(_0x2470d1[_0xf787('0x15')][_0xf787('0x13')]);}})[_0xf787('0x16')](function(_0x585026){logger[_0xf787('0x11')](_0xf787('0x12'),_0x289b6c,_0x585026);_0x345919(_0x585026);});});}