5aa5412664ab8d0d037eed25d7938252133bf308
[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 _0xfe84=['jayson/promise','client','http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x58848e,_0x369460){var _0x4d04a5=function(_0x4adab9){while(--_0x4adab9){_0x58848e['push'](_0x58848e['shift']());}};_0x4d04a5(++_0x369460);}(_0xfe84,0xf9));var _0x4fe8=function(_0x4c0d2b,_0x2ff906){_0x4c0d2b=_0x4c0d2b-0x0;var _0x58c4fe=_0xfe84[_0x4c0d2b];return _0x58c4fe;};'use strict';var _=require(_0x4fe8('0x0'));var util=require(_0x4fe8('0x1'));var moment=require(_0x4fe8('0x2'));var BPromise=require(_0x4fe8('0x3'));var rs=require(_0x4fe8('0x4'));var fs=require('fs');var Redis=require(_0x4fe8('0x5'));var db=require(_0x4fe8('0x6'))['db'];var utils=require(_0x4fe8('0x7'));var logger=require(_0x4fe8('0x8'))(_0x4fe8('0x9'));var config=require(_0x4fe8('0xa'));var jayson=require(_0x4fe8('0xb'));var client=jayson[_0x4fe8('0xc')][_0x4fe8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x486715,_0x41095f,_0x287f6a){return new BPromise(function(_0xbb21ad,_0x24f8b1){return client[_0x4fe8('0xe')](_0x486715,_0x287f6a)[_0x4fe8('0xf')](function(_0x1a1e50){logger[_0x4fe8('0x10')](_0x4fe8('0x11'),_0x41095f,'request\x20sent');logger[_0x4fe8('0x12')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x41095f,_0x4fe8('0x13'),JSON[_0x4fe8('0x14')](_0x1a1e50));if(_0x1a1e50['error']){if(_0x1a1e50[_0x4fe8('0x15')][_0x4fe8('0x16')]===0x1f4){logger[_0x4fe8('0x15')](_0x4fe8('0x11'),_0x41095f,_0x1a1e50['error'][_0x4fe8('0x17')]);return _0x24f8b1(_0x1a1e50[_0x4fe8('0x15')][_0x4fe8('0x17')]);}logger[_0x4fe8('0x15')](_0x4fe8('0x11'),_0x41095f,_0x1a1e50[_0x4fe8('0x15')][_0x4fe8('0x17')]);return _0xbb21ad(_0x1a1e50[_0x4fe8('0x15')][_0x4fe8('0x17')]);}else{logger[_0x4fe8('0x10')](_0x4fe8('0x11'),_0x41095f,_0x4fe8('0x13'));_0xbb21ad(_0x1a1e50[_0x4fe8('0x18')][_0x4fe8('0x17')]);}})[_0x4fe8('0x19')](function(_0xf939d5){logger[_0x4fe8('0x15')](_0x4fe8('0x11'),_0x41095f,_0xf939d5);_0x24f8b1(_0xf939d5);});});}