3aa07bd296d45d76c48c4f811cc96f2c8b2bef60
[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 _0xf368=['debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmField,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','request\x20sent'];(function(_0x90bb2a,_0x45ce4c){var _0x42f167=function(_0x5cd1e8){while(--_0x5cd1e8){_0x90bb2a['push'](_0x90bb2a['shift']());}};_0x42f167(++_0x45ce4c);}(_0xf368,0xc5));var _0x8f36=function(_0x21de40,_0x582e95){_0x21de40=_0x21de40-0x0;var _0x266dc8=_0xf368[_0x21de40];return _0x266dc8;};'use strict';var _=require(_0x8f36('0x0'));var util=require(_0x8f36('0x1'));var moment=require(_0x8f36('0x2'));var BPromise=require(_0x8f36('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f36('0x4'));var db=require(_0x8f36('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f36('0x6'))(_0x8f36('0x7'));var config=require(_0x8f36('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8f36('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4708b3,_0x5bb170,_0x4d80f6){return new BPromise(function(_0x415619,_0x428c21){return client[_0x8f36('0xa')](_0x4708b3,_0x4d80f6)['then'](function(_0x59ea40){logger[_0x8f36('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x5bb170,_0x8f36('0xc'));logger[_0x8f36('0xd')](_0x8f36('0xe'),_0x5bb170,'request\x20sent',JSON['stringify'](_0x59ea40));if(_0x59ea40[_0x8f36('0xf')]){if(_0x59ea40[_0x8f36('0xf')][_0x8f36('0x10')]===0x1f4){logger[_0x8f36('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x5bb170,_0x59ea40[_0x8f36('0xf')][_0x8f36('0x11')]);return _0x428c21(_0x59ea40[_0x8f36('0xf')][_0x8f36('0x11')]);}logger[_0x8f36('0xf')](_0x8f36('0x12'),_0x5bb170,_0x59ea40[_0x8f36('0xf')]['message']);return _0x415619(_0x59ea40[_0x8f36('0xf')][_0x8f36('0x11')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x5bb170,_0x8f36('0xc'));_0x415619(_0x59ea40[_0x8f36('0x13')]['message']);}})[_0x8f36('0x14')](function(_0xec432){logger['error']('SugarcrmField,\x20%s,\x20%s',_0x5bb170,_0xec432);_0x428c21(_0xec432);});});}