Built motion from commit fe909640.|2.6.8
[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 _0xa367=['info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then'];(function(_0x367a3d,_0x452717){var _0x460539=function(_0x1e8beb){while(--_0x1e8beb){_0x367a3d['push'](_0x367a3d['shift']());}};_0x460539(++_0x452717);}(_0xa367,0x14a));var _0x7a36=function(_0x10df18,_0x13338c){_0x10df18=_0x10df18-0x0;var _0x1f9a1d=_0xa367[_0x10df18];return _0x1f9a1d;};'use strict';var _=require(_0x7a36('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7a36('0x1'));var rs=require(_0x7a36('0x2'));var fs=require('fs');var Redis=require(_0x7a36('0x3'));var db=require(_0x7a36('0x4'))['db'];var utils=require(_0x7a36('0x5'));var logger=require('../../config/logger')(_0x7a36('0x6'));var config=require(_0x7a36('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7a36('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49d9f8,_0x24c4a9,_0xefb33b){return new BPromise(function(_0xa4fb4,_0x4bdbac){return client['request'](_0x49d9f8,_0xefb33b)[_0x7a36('0x9')](function(_0x67335f){logger[_0x7a36('0xa')](_0x7a36('0xb'),_0x24c4a9,_0x7a36('0xc'));logger[_0x7a36('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x24c4a9,_0x7a36('0xc'),JSON[_0x7a36('0xe')](_0x67335f));if(_0x67335f[_0x7a36('0xf')]){if(_0x67335f[_0x7a36('0xf')][_0x7a36('0x10')]===0x1f4){logger[_0x7a36('0xf')]('SugarcrmField,\x20%s,\x20%s',_0x24c4a9,_0x67335f[_0x7a36('0xf')]['message']);return _0x4bdbac(_0x67335f['error'][_0x7a36('0x11')]);}logger[_0x7a36('0xf')](_0x7a36('0xb'),_0x24c4a9,_0x67335f[_0x7a36('0xf')][_0x7a36('0x11')]);return _0xa4fb4(_0x67335f[_0x7a36('0xf')][_0x7a36('0x11')]);}else{logger[_0x7a36('0xa')](_0x7a36('0xb'),_0x24c4a9,_0x7a36('0xc'));_0xa4fb4(_0x67335f[_0x7a36('0x12')][_0x7a36('0x11')]);}})[_0x7a36('0x13')](function(_0x4084cd){logger['error'](_0x7a36('0xb'),_0x24c4a9,_0x4084cd);_0x4bdbac(_0x4084cd);});});}