9b4d5ebca0a675a3b617ccbb7317bb9130bb37ff
[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 _0x2609=['error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x521a71,_0x435881){var _0x93a7c0=function(_0x50d991){while(--_0x50d991){_0x521a71['push'](_0x521a71['shift']());}};_0x93a7c0(++_0x435881);}(_0x2609,0x91));var _0x9260=function(_0x5524b1,_0x39d412){_0x5524b1=_0x5524b1-0x0;var _0x4c0635=_0x2609[_0x5524b1];return _0x4c0635;};'use strict';var _=require('lodash');var util=require(_0x9260('0x0'));var moment=require(_0x9260('0x1'));var BPromise=require(_0x9260('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9260('0x3'));var db=require(_0x9260('0x4'))['db'];var utils=require(_0x9260('0x5'));var logger=require(_0x9260('0x6'))(_0x9260('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9260('0x8')][_0x9260('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1126bc,_0x26f15f,_0x4de0dd){return new BPromise(function(_0x140837,_0x329db9){return client['request'](_0x1126bc,_0x4de0dd)['then'](function(_0x1099eb){logger['info'](_0x9260('0xa'),_0x26f15f,_0x9260('0xb'));logger[_0x9260('0xc')](_0x9260('0xd'),_0x26f15f,_0x9260('0xb'),JSON[_0x9260('0xe')](_0x1099eb));if(_0x1099eb['error']){if(_0x1099eb[_0x9260('0xf')][_0x9260('0x10')]===0x1f4){logger[_0x9260('0xf')](_0x9260('0xa'),_0x26f15f,_0x1099eb['error']['message']);return _0x329db9(_0x1099eb['error'][_0x9260('0x11')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x26f15f,_0x1099eb[_0x9260('0xf')][_0x9260('0x11')]);return _0x140837(_0x1099eb[_0x9260('0xf')]['message']);}else{logger['info'](_0x9260('0xa'),_0x26f15f,_0x9260('0xb'));_0x140837(_0x1099eb[_0x9260('0x12')][_0x9260('0x11')]);}})[_0x9260('0x13')](function(_0x32fe84){logger[_0x9260('0xf')](_0x9260('0xa'),_0x26f15f,_0x32fe84);_0x329db9(_0x32fe84);});});}