a2db99de0b874ddf14b6a2e06dc3d513082c39f1
[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 _0xf0d9=['http','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','lodash','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client'];(function(_0xc02150,_0x38939c){var _0x504faa=function(_0x27728a){while(--_0x27728a){_0xc02150['push'](_0xc02150['shift']());}};_0x504faa(++_0x38939c);}(_0xf0d9,0x1e7));var _0x9f0d=function(_0x53d55a,_0x2d4bc1){_0x53d55a=_0x53d55a-0x0;var _0x38e12e=_0xf0d9[_0x53d55a];return _0x38e12e;};'use strict';var _=require(_0x9f0d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9f0d('0x1'));var fs=require('fs');var Redis=require(_0x9f0d('0x2'));var db=require(_0x9f0d('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9f0d('0x4'));var config=require(_0x9f0d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x9f0d('0x6')][_0x9f0d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1c963d,_0x15aafe,_0xde3a78){return new BPromise(function(_0x6683a0,_0x1ca957){return client[_0x9f0d('0x8')](_0x1c963d,_0xde3a78)[_0x9f0d('0x9')](function(_0x47bd03){logger[_0x9f0d('0xa')](_0x9f0d('0xb'),_0x15aafe,'request\x20sent');logger[_0x9f0d('0xc')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x15aafe,'request\x20sent',JSON[_0x9f0d('0xd')](_0x47bd03));if(_0x47bd03[_0x9f0d('0xe')]){if(_0x47bd03[_0x9f0d('0xe')]['code']===0x1f4){logger[_0x9f0d('0xe')](_0x9f0d('0xb'),_0x15aafe,_0x47bd03['error']['message']);return _0x1ca957(_0x47bd03[_0x9f0d('0xe')][_0x9f0d('0xf')]);}logger[_0x9f0d('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x15aafe,_0x47bd03[_0x9f0d('0xe')][_0x9f0d('0xf')]);return _0x6683a0(_0x47bd03[_0x9f0d('0xe')][_0x9f0d('0xf')]);}else{logger[_0x9f0d('0xa')]('SugarcrmField,\x20%s,\x20%s',_0x15aafe,_0x9f0d('0x10'));_0x6683a0(_0x47bd03[_0x9f0d('0x11')][_0x9f0d('0xf')]);}})[_0x9f0d('0x12')](function(_0x68ba25){logger[_0x9f0d('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x15aafe,_0x68ba25);_0x1ca957(_0x68ba25);});});}