101ad60afa14e379f271264712cfd43e2f44893b
[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 _0x2f69=['rpc','jayson/promise','client','request','info','debug','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','request\x20sent','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4cde67,_0x368979){var _0x49f321=function(_0xa7b647){while(--_0xa7b647){_0x4cde67['push'](_0x4cde67['shift']());}};_0x49f321(++_0x368979);}(_0x2f69,0x1e7));var _0x92f6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x2f69[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0x92f6('0x0'));var moment=require(_0x92f6('0x1'));var BPromise=require(_0x92f6('0x2'));var rs=require(_0x92f6('0x3'));var fs=require('fs');var Redis=require(_0x92f6('0x4'));var db=require(_0x92f6('0x5'))['db'];var utils=require(_0x92f6('0x6'));var logger=require('../../config/logger')(_0x92f6('0x7'));var config=require('../../config/environment');var jayson=require(_0x92f6('0x8'));var client=jayson[_0x92f6('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24fce2,_0xb2c966,_0x45a9a6){return new BPromise(function(_0x2c740,_0x34cb71){return client[_0x92f6('0xa')](_0x24fce2,_0x45a9a6)['then'](function(_0x4130f7){logger[_0x92f6('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0xb2c966,'request\x20sent');logger[_0x92f6('0xc')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0xb2c966,'request\x20sent',JSON[_0x92f6('0xd')](_0x4130f7));if(_0x4130f7[_0x92f6('0xe')]){if(_0x4130f7[_0x92f6('0xe')]['code']===0x1f4){logger['error'](_0x92f6('0xf'),_0xb2c966,_0x4130f7[_0x92f6('0xe')][_0x92f6('0x10')]);return _0x34cb71(_0x4130f7[_0x92f6('0xe')][_0x92f6('0x10')]);}logger[_0x92f6('0xe')](_0x92f6('0xf'),_0xb2c966,_0x4130f7['error'][_0x92f6('0x10')]);return _0x2c740(_0x4130f7['error'][_0x92f6('0x10')]);}else{logger[_0x92f6('0xb')](_0x92f6('0xf'),_0xb2c966,_0x92f6('0x11'));_0x2c740(_0x4130f7[_0x92f6('0x12')][_0x92f6('0x10')]);}})['catch'](function(_0x208bf6){logger[_0x92f6('0xe')](_0x92f6('0xf'),_0xb2c966,_0x208bf6);_0x34cb71(_0x208bf6);});});}