c014afe3c9b3ac4a3a428a872d3d22630a3de0f7
[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 _0x9d1c=['client','http','request','then','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4cbe26,_0x3c27c8){var _0x1a7a4f=function(_0x19d27d){while(--_0x19d27d){_0x4cbe26['push'](_0x4cbe26['shift']());}};_0x1a7a4f(++_0x3c27c8);}(_0x9d1c,0x109));var _0xc9d1=function(_0x3807bf,_0x1c44e8){_0x3807bf=_0x3807bf-0x0;var _0xcf9a97=_0x9d1c[_0x3807bf];return _0xcf9a97;};'use strict';var _=require(_0xc9d1('0x0'));var util=require('util');var moment=require(_0xc9d1('0x1'));var BPromise=require('bluebird');var rs=require(_0xc9d1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc9d1('0x3'));var logger=require(_0xc9d1('0x4'))(_0xc9d1('0x5'));var config=require(_0xc9d1('0x6'));var jayson=require(_0xc9d1('0x7'));var client=jayson[_0xc9d1('0x8')][_0xc9d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c7ab5,_0x54f23f,_0x5b1fac){return new BPromise(function(_0xa9fed9,_0x3a0602){return client[_0xc9d1('0xa')](_0x2c7ab5,_0x5b1fac)[_0xc9d1('0xb')](function(_0x2a672f){logger['info'](_0xc9d1('0xc'),_0x54f23f,_0xc9d1('0xd'));logger[_0xc9d1('0xe')]('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x54f23f,'request\x20sent',JSON[_0xc9d1('0xf')](_0x2a672f));if(_0x2a672f['error']){if(_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x11')]===0x1f4){logger[_0xc9d1('0x10')](_0xc9d1('0xc'),_0x54f23f,_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x12')]);return _0x3a0602(_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x12')]);}logger[_0xc9d1('0x10')](_0xc9d1('0xc'),_0x54f23f,_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x12')]);return _0xa9fed9(_0x2a672f[_0xc9d1('0x10')][_0xc9d1('0x12')]);}else{logger[_0xc9d1('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x54f23f,_0xc9d1('0xd'));_0xa9fed9(_0x2a672f['result']['message']);}})[_0xc9d1('0x14')](function(_0x1e89b4){logger[_0xc9d1('0x10')](_0xc9d1('0xc'),_0x54f23f,_0x1e89b4);_0x3a0602(_0x1e89b4);});});}