870f9b1f4db3a3215c2183d9afdda23f720b66b6
[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 _0x36d4=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x47f371,_0x20501e){var _0x28f538=function(_0x3fff02){while(--_0x3fff02){_0x47f371['push'](_0x47f371['shift']());}};_0x28f538(++_0x20501e);}(_0x36d4,0x13a));var _0x436d=function(_0x4cd846,_0x4a0f50){_0x4cd846=_0x4cd846-0x0;var _0x2f2a7d=_0x36d4[_0x4cd846];return _0x2f2a7d;};'use strict';var _=require(_0x436d('0x0'));var util=require(_0x436d('0x1'));var moment=require(_0x436d('0x2'));var BPromise=require(_0x436d('0x3'));var rs=require(_0x436d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x436d('0x5'))['db'];var utils=require(_0x436d('0x6'));var logger=require(_0x436d('0x7'))(_0x436d('0x8'));var config=require(_0x436d('0x9'));var jayson=require(_0x436d('0xa'));var client=jayson[_0x436d('0xb')][_0x436d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3dae33,_0x7a1790,_0x55e647){return new BPromise(function(_0x1e9968,_0x5c8a4c){return client['request'](_0x3dae33,_0x55e647)[_0x436d('0xd')](function(_0x1a1087){logger[_0x436d('0xe')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7a1790,_0x436d('0xf'));logger[_0x436d('0x10')](_0x436d('0x11'),_0x7a1790,_0x436d('0xf'),JSON[_0x436d('0x12')](_0x1a1087));if(_0x1a1087['error']){if(_0x1a1087[_0x436d('0x13')][_0x436d('0x14')]===0x1f4){logger[_0x436d('0x13')](_0x436d('0x15'),_0x7a1790,_0x1a1087[_0x436d('0x13')][_0x436d('0x16')]);return _0x5c8a4c(_0x1a1087[_0x436d('0x13')]['message']);}logger[_0x436d('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x7a1790,_0x1a1087['error'][_0x436d('0x16')]);return _0x1e9968(_0x1a1087[_0x436d('0x13')]['message']);}else{logger[_0x436d('0xe')](_0x436d('0x15'),_0x7a1790,'request\x20sent');_0x1e9968(_0x1a1087['result'][_0x436d('0x16')]);}})[_0x436d('0x17')](function(_0x214be7){logger['error'](_0x436d('0x15'),_0x7a1790,_0x214be7);_0x5c8a4c(_0x214be7);});});}