cc458b45b20f6b6af5ec664f842f4471293a18fc
[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 _0x76f3=['request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x5440d3,_0x68412d){var _0x49b20a=function(_0x328c52){while(--_0x328c52){_0x5440d3['push'](_0x5440d3['shift']());}};_0x49b20a(++_0x68412d);}(_0x76f3,0x170));var _0x376f=function(_0x18668a,_0x3a3945){_0x18668a=_0x18668a-0x0;var _0x387cf3=_0x76f3[_0x18668a];return _0x387cf3;};'use strict';var _=require(_0x376f('0x0'));var util=require(_0x376f('0x1'));var moment=require(_0x376f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x376f('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x376f('0x4'));var logger=require('../../config/logger')(_0x376f('0x5'));var config=require(_0x376f('0x6'));var jayson=require(_0x376f('0x7'));var client=jayson[_0x376f('0x8')][_0x376f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44aa1b,_0x445e2e,_0x5d9199){return new BPromise(function(_0x4491da,_0x21d59a){return client['request'](_0x44aa1b,_0x5d9199)[_0x376f('0xa')](function(_0x328052){logger['info'](_0x376f('0xb'),_0x445e2e,_0x376f('0xc'));logger[_0x376f('0xd')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x445e2e,_0x376f('0xc'),JSON[_0x376f('0xe')](_0x328052));if(_0x328052[_0x376f('0xf')]){if(_0x328052[_0x376f('0xf')]['code']===0x1f4){logger[_0x376f('0xf')](_0x376f('0xb'),_0x445e2e,_0x328052[_0x376f('0xf')][_0x376f('0x10')]);return _0x21d59a(_0x328052['error'][_0x376f('0x10')]);}logger['error'](_0x376f('0xb'),_0x445e2e,_0x328052[_0x376f('0xf')][_0x376f('0x10')]);return _0x4491da(_0x328052[_0x376f('0xf')][_0x376f('0x10')]);}else{logger[_0x376f('0x11')](_0x376f('0xb'),_0x445e2e,'request\x20sent');_0x4491da(_0x328052[_0x376f('0x12')]['message']);}})['catch'](function(_0x59c8d5){logger['error'](_0x376f('0xb'),_0x445e2e,_0x59c8d5);_0x21d59a(_0x59c8d5);});});}