11acb68184a51444e476f035acb41ac3f436ac2e
[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 _0x6491=['info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x1dbea5,_0x5e75ac){var _0x1e11dd=function(_0x420b87){while(--_0x420b87){_0x1dbea5['push'](_0x1dbea5['shift']());}};_0x1e11dd(++_0x5e75ac);}(_0x6491,0x1ad));var _0x1649=function(_0x5de840,_0x168770){_0x5de840=_0x5de840-0x0;var _0x46762b=_0x6491[_0x5de840];return _0x46762b;};'use strict';var _=require(_0x1649('0x0'));var util=require(_0x1649('0x1'));var moment=require('moment');var BPromise=require(_0x1649('0x2'));var rs=require(_0x1649('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1649('0x4'))(_0x1649('0x5'));var config=require('../../config/environment');var jayson=require(_0x1649('0x6'));var client=jayson[_0x1649('0x7')][_0x1649('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1db2c6,_0x19ccc2,_0x4bd801){return new BPromise(function(_0x843334,_0x5d85a3){return client[_0x1649('0x9')](_0x1db2c6,_0x4bd801)[_0x1649('0xa')](function(_0x4e0278){logger[_0x1649('0xb')](_0x1649('0xc'),_0x19ccc2,_0x1649('0xd'));logger[_0x1649('0xe')](_0x1649('0xf'),_0x19ccc2,_0x1649('0xd'),JSON['stringify'](_0x4e0278));if(_0x4e0278[_0x1649('0x10')]){if(_0x4e0278['error'][_0x1649('0x11')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x19ccc2,_0x4e0278['error']['message']);return _0x5d85a3(_0x4e0278[_0x1649('0x10')][_0x1649('0x12')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x19ccc2,_0x4e0278['error'][_0x1649('0x12')]);return _0x843334(_0x4e0278[_0x1649('0x10')][_0x1649('0x12')]);}else{logger[_0x1649('0xb')](_0x1649('0xc'),_0x19ccc2,_0x1649('0xd'));_0x843334(_0x4e0278['result'][_0x1649('0x12')]);}})[_0x1649('0x13')](function(_0x143b16){logger[_0x1649('0x10')](_0x1649('0xc'),_0x19ccc2,_0x143b16);_0x5d85a3(_0x143b16);});});}