42434c981c9d63c04b26d72a5954eb0a402d4ed1
[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 _0x29b1=['SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x31848d,_0x225cda){var _0x1165fe=function(_0x312533){while(--_0x312533){_0x31848d['push'](_0x31848d['shift']());}};_0x1165fe(++_0x225cda);}(_0x29b1,0x1c1));var _0x129b=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x29b1[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x129b('0x0'));var BPromise=require(_0x129b('0x1'));var rs=require(_0x129b('0x2'));var fs=require('fs');var Redis=require(_0x129b('0x3'));var db=require(_0x129b('0x4'))['db'];var utils=require(_0x129b('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x129b('0x6'));var jayson=require(_0x129b('0x7'));var client=jayson[_0x129b('0x8')][_0x129b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3a09a5,_0x3c8576,_0x141ce5){return new BPromise(function(_0x351983,_0x133908){return client[_0x129b('0xa')](_0x3a09a5,_0x141ce5)[_0x129b('0xb')](function(_0x23fc62){logger[_0x129b('0xc')](_0x129b('0xd'),_0x3c8576,_0x129b('0xe'));logger[_0x129b('0xf')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x3c8576,_0x129b('0xe'),JSON[_0x129b('0x10')](_0x23fc62));if(_0x23fc62[_0x129b('0x11')]){if(_0x23fc62['error'][_0x129b('0x12')]===0x1f4){logger[_0x129b('0x11')](_0x129b('0xd'),_0x3c8576,_0x23fc62[_0x129b('0x11')][_0x129b('0x13')]);return _0x133908(_0x23fc62[_0x129b('0x11')][_0x129b('0x13')]);}logger['error'](_0x129b('0xd'),_0x3c8576,_0x23fc62[_0x129b('0x11')][_0x129b('0x13')]);return _0x351983(_0x23fc62[_0x129b('0x11')]['message']);}else{logger['info'](_0x129b('0xd'),_0x3c8576,_0x129b('0xe'));_0x351983(_0x23fc62[_0x129b('0x14')][_0x129b('0x13')]);}})[_0x129b('0x15')](function(_0x56ba64){logger[_0x129b('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x3c8576,_0x56ba64);_0x133908(_0x56ba64);});});}