ae2c77223b4bbc45aeb1600c0abbec95dbcfd47c
[motion2.git] / server / api / intFreshdeskField / intFreshdeskField.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 _0x21c1=['result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x21c1,0x1c3));var _0x121c=function(_0xd2dfa,_0x335a68){_0xd2dfa=_0xd2dfa-0x0;var _0x363e44=_0x21c1[_0xd2dfa];return _0x363e44;};'use strict';var _=require('lodash');var util=require(_0x121c('0x0'));var moment=require('moment');var BPromise=require(_0x121c('0x1'));var rs=require(_0x121c('0x2'));var fs=require('fs');var Redis=require(_0x121c('0x3'));var db=require(_0x121c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x121c('0x5'));var jayson=require(_0x121c('0x6'));var client=jayson[_0x121c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c2fcf,_0x115f76,_0x2989b7){return new BPromise(function(_0x3e90c9,_0x5ea9b1){return client[_0x121c('0x8')](_0x6c2fcf,_0x2989b7)[_0x121c('0x9')](function(_0x5e0331){logger['info'](_0x121c('0xa'),_0x115f76,'request\x20sent');logger['debug'](_0x121c('0xb'),_0x115f76,_0x121c('0xc'),JSON[_0x121c('0xd')](_0x5e0331));if(_0x5e0331[_0x121c('0xe')]){if(_0x5e0331[_0x121c('0xe')][_0x121c('0xf')]===0x1f4){logger[_0x121c('0xe')](_0x121c('0xa'),_0x115f76,_0x5e0331[_0x121c('0xe')][_0x121c('0x10')]);return _0x5ea9b1(_0x5e0331[_0x121c('0xe')][_0x121c('0x10')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x115f76,_0x5e0331[_0x121c('0xe')][_0x121c('0x10')]);return _0x3e90c9(_0x5e0331[_0x121c('0xe')]['message']);}else{logger['info'](_0x121c('0xa'),_0x115f76,'request\x20sent');_0x3e90c9(_0x5e0331[_0x121c('0x11')][_0x121c('0x10')]);}})['catch'](function(_0x582aa5){logger[_0x121c('0xe')](_0x121c('0xa'),_0x115f76,_0x582aa5);_0x5ea9b1(_0x582aa5);});});}