Built motion from commit 1fa89557.|2.6.10
[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 _0x680e=['error','code','message','info','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x680e,0x10f));var _0xe680=function(_0x57f3bb,_0x1bc2fd){_0x57f3bb=_0x57f3bb-0x0;var _0x202773=_0x680e[_0x57f3bb];return _0x202773;};'use strict';var _=require(_0xe680('0x0'));var util=require(_0xe680('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe680('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe680('0x3'))['db'];var utils=require(_0xe680('0x4'));var logger=require(_0xe680('0x5'))('rpc');var config=require(_0xe680('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe680('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cc864,_0x4847d0,_0x4a1d27){return new BPromise(function(_0x564b3a,_0x4015f3){return client[_0xe680('0x8')](_0x1cc864,_0x4a1d27)[_0xe680('0x9')](function(_0x5b63cf){logger['info'](_0xe680('0xa'),_0x4847d0,'request\x20sent');logger[_0xe680('0xb')](_0xe680('0xc'),_0x4847d0,_0xe680('0xd'),JSON['stringify'](_0x5b63cf));if(_0x5b63cf[_0xe680('0xe')]){if(_0x5b63cf[_0xe680('0xe')][_0xe680('0xf')]===0x1f4){logger[_0xe680('0xe')](_0xe680('0xa'),_0x4847d0,_0x5b63cf[_0xe680('0xe')][_0xe680('0x10')]);return _0x4015f3(_0x5b63cf[_0xe680('0xe')]['message']);}logger[_0xe680('0xe')]('SugarcrmField,\x20%s,\x20%s',_0x4847d0,_0x5b63cf[_0xe680('0xe')][_0xe680('0x10')]);return _0x564b3a(_0x5b63cf[_0xe680('0xe')][_0xe680('0x10')]);}else{logger[_0xe680('0x11')](_0xe680('0xa'),_0x4847d0,_0xe680('0xd'));_0x564b3a(_0x5b63cf['result'][_0xe680('0x10')]);}})[_0xe680('0x12')](function(_0x43da0e){logger['error'](_0xe680('0xa'),_0x4847d0,_0x43da0e);_0x4015f3(_0x43da0e);});});}