Built motion from commit 351e7f9c.|2.6.31
[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 _0x8613=['ioredis','rpc','../../config/environment','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','message','lodash','util','moment','bluebird'];(function(_0x123563,_0x12acaf){var _0xf2e371=function(_0x4603eb){while(--_0x4603eb){_0x123563['push'](_0x123563['shift']());}};_0xf2e371(++_0x12acaf);}(_0x8613,0x11c));var _0x3861=function(_0x31ed12,_0x2a38f9){_0x31ed12=_0x31ed12-0x0;var _0x1afd40=_0x8613[_0x31ed12];return _0x1afd40;};'use strict';var _=require(_0x3861('0x0'));var util=require(_0x3861('0x1'));var moment=require(_0x3861('0x2'));var BPromise=require(_0x3861('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3861('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3861('0x5'));var config=require(_0x3861('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3861('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x589b6e,_0x553ce2,_0x388a00){return new BPromise(function(_0xf489fa,_0x291973){return client[_0x3861('0x8')](_0x589b6e,_0x388a00)[_0x3861('0x9')](function(_0x541817){logger[_0x3861('0xa')](_0x3861('0xb'),_0x553ce2,_0x3861('0xc'));logger[_0x3861('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x553ce2,_0x3861('0xc'),JSON['stringify'](_0x541817));if(_0x541817['error']){if(_0x541817['error']['code']===0x1f4){logger[_0x3861('0xe')](_0x3861('0xb'),_0x553ce2,_0x541817[_0x3861('0xe')][_0x3861('0xf')]);return _0x291973(_0x541817[_0x3861('0xe')][_0x3861('0xf')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x553ce2,_0x541817[_0x3861('0xe')]['message']);return _0xf489fa(_0x541817[_0x3861('0xe')][_0x3861('0xf')]);}else{logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x553ce2,_0x3861('0xc'));_0xf489fa(_0x541817['result'][_0x3861('0xf')]);}})['catch'](function(_0x21a53f){logger['error'](_0x3861('0xb'),_0x553ce2,_0x21a53f);_0x291973(_0x21a53f);});});}