f741436818a2289adc6e65b5333ad896e7a18080
[motion2.git] / server / api / intZendeskConfiguration / intZendeskConfiguration.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 _0x1b76=['result','catch','util','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x4eebd9,_0x57afb9){var _0x1d6117=function(_0x4740f3){while(--_0x4740f3){_0x4eebd9['push'](_0x4eebd9['shift']());}};_0x1d6117(++_0x57afb9);}(_0x1b76,0x70));var _0x61b7=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x1b76[_0x513047];return _0x15b779;};'use strict';var _=require('lodash');var util=require(_0x61b7('0x0'));var moment=require(_0x61b7('0x1'));var BPromise=require(_0x61b7('0x2'));var rs=require(_0x61b7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x61b7('0x4'))(_0x61b7('0x5'));var config=require(_0x61b7('0x6'));var jayson=require(_0x61b7('0x7'));var client=jayson[_0x61b7('0x8')][_0x61b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49791c,_0x11a9a5,_0x3fbe72){return new BPromise(function(_0x1e770e,_0x4a923a){return client['request'](_0x49791c,_0x3fbe72)[_0x61b7('0xa')](function(_0x5fe64a){logger['info'](_0x61b7('0xb'),_0x11a9a5,_0x61b7('0xc'));logger[_0x61b7('0xd')](_0x61b7('0xe'),_0x11a9a5,_0x61b7('0xc'),JSON[_0x61b7('0xf')](_0x5fe64a));if(_0x5fe64a['error']){if(_0x5fe64a[_0x61b7('0x10')][_0x61b7('0x11')]===0x1f4){logger[_0x61b7('0x10')](_0x61b7('0xb'),_0x11a9a5,_0x5fe64a['error'][_0x61b7('0x12')]);return _0x4a923a(_0x5fe64a['error'][_0x61b7('0x12')]);}logger['error'](_0x61b7('0xb'),_0x11a9a5,_0x5fe64a[_0x61b7('0x10')][_0x61b7('0x12')]);return _0x1e770e(_0x5fe64a[_0x61b7('0x10')][_0x61b7('0x12')]);}else{logger[_0x61b7('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x11a9a5,'request\x20sent');_0x1e770e(_0x5fe64a[_0x61b7('0x14')][_0x61b7('0x12')]);}})[_0x61b7('0x15')](function(_0x1864e8){logger[_0x61b7('0x10')](_0x61b7('0xb'),_0x11a9a5,_0x1864e8);_0x4a923a(_0x1864e8);});});}