25eab5e4987cc9cf0b937fabfaf765794d4692d8
[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 _0xf132=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util'];(function(_0x4e9b4e,_0x22796d){var _0x4a5217=function(_0xb433b7){while(--_0xb433b7){_0x4e9b4e['push'](_0x4e9b4e['shift']());}};_0x4a5217(++_0x22796d);}(_0xf132,0xd1));var _0x2f13=function(_0x4f7286,_0x3f017b){_0x4f7286=_0x4f7286-0x0;var _0x46720f=_0xf132[_0x4f7286];return _0x46720f;};'use strict';var _=require('lodash');var util=require(_0x2f13('0x0'));var moment=require(_0x2f13('0x1'));var BPromise=require(_0x2f13('0x2'));var rs=require(_0x2f13('0x3'));var fs=require('fs');var Redis=require(_0x2f13('0x4'));var db=require(_0x2f13('0x5'))['db'];var utils=require(_0x2f13('0x6'));var logger=require('../../config/logger')(_0x2f13('0x7'));var config=require(_0x2f13('0x8'));var jayson=require(_0x2f13('0x9'));var client=jayson[_0x2f13('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4914f8,_0x8b32b1,_0x5c0aa2){return new BPromise(function(_0x5293fe,_0x29c95d){return client[_0x2f13('0xb')](_0x4914f8,_0x5c0aa2)['then'](function(_0x1b952f){logger[_0x2f13('0xc')](_0x2f13('0xd'),_0x8b32b1,_0x2f13('0xe'));logger['debug'](_0x2f13('0xf'),_0x8b32b1,_0x2f13('0xe'),JSON[_0x2f13('0x10')](_0x1b952f));if(_0x1b952f[_0x2f13('0x11')]){if(_0x1b952f[_0x2f13('0x11')][_0x2f13('0x12')]===0x1f4){logger[_0x2f13('0x11')](_0x2f13('0xd'),_0x8b32b1,_0x1b952f['error'][_0x2f13('0x13')]);return _0x29c95d(_0x1b952f[_0x2f13('0x11')][_0x2f13('0x13')]);}logger[_0x2f13('0x11')](_0x2f13('0xd'),_0x8b32b1,_0x1b952f[_0x2f13('0x11')][_0x2f13('0x13')]);return _0x5293fe(_0x1b952f[_0x2f13('0x11')][_0x2f13('0x13')]);}else{logger[_0x2f13('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x8b32b1,'request\x20sent');_0x5293fe(_0x1b952f['result'][_0x2f13('0x13')]);}})[_0x2f13('0x14')](function(_0x1af7d1){logger[_0x2f13('0x11')](_0x2f13('0xd'),_0x8b32b1,_0x1af7d1);_0x29c95d(_0x1af7d1);});});}