Built motion from commit 0415ced0.|2.6.28
[motion2.git] / server / api / intFreshdeskConfiguration / intFreshdeskConfiguration.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 _0x237a=['info','catch','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x237a,0xe2));var _0xa237=function(_0x49e2e1,_0x274865){_0x49e2e1=_0x49e2e1-0x0;var _0x4cff62=_0x237a[_0x49e2e1];return _0x4cff62;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa237('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa237('0x1'));var db=require(_0xa237('0x2'))['db'];var utils=require(_0xa237('0x3'));var logger=require(_0xa237('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa237('0x5')][_0xa237('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2beeff,_0x276475,_0x11a715){return new BPromise(function(_0x24d64e,_0x7a1d7a){return client[_0xa237('0x7')](_0x2beeff,_0x11a715)['then'](function(_0x634f6c){logger['info'](_0xa237('0x8'),_0x276475,_0xa237('0x9'));logger['debug'](_0xa237('0xa'),_0x276475,_0xa237('0x9'),JSON['stringify'](_0x634f6c));if(_0x634f6c[_0xa237('0xb')]){if(_0x634f6c['error'][_0xa237('0xc')]===0x1f4){logger[_0xa237('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x276475,_0x634f6c['error'][_0xa237('0xd')]);return _0x7a1d7a(_0x634f6c[_0xa237('0xb')][_0xa237('0xd')]);}logger[_0xa237('0xb')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x276475,_0x634f6c[_0xa237('0xb')][_0xa237('0xd')]);return _0x24d64e(_0x634f6c[_0xa237('0xb')][_0xa237('0xd')]);}else{logger[_0xa237('0xe')](_0xa237('0x8'),_0x276475,_0xa237('0x9'));_0x24d64e(_0x634f6c['result']['message']);}})[_0xa237('0xf')](function(_0x4cdd6f){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x276475,_0x4cdd6f);_0x7a1d7a(_0x4cdd6f);});});}