33afb96ae4a400b82dd317577993c0fe25f60fb7
[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 _0x280b=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x280b,0xd8));var _0xb280=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x280b[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xb280('0x0'));var util=require(_0xb280('0x1'));var moment=require(_0xb280('0x2'));var BPromise=require('bluebird');var rs=require(_0xb280('0x3'));var fs=require('fs');var Redis=require(_0xb280('0x4'));var db=require(_0xb280('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb280('0x6'))(_0xb280('0x7'));var config=require(_0xb280('0x8'));var jayson=require(_0xb280('0x9'));var client=jayson['client'][_0xb280('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b117b,_0xca6773,_0x54f4fc){return new BPromise(function(_0x5eb558,_0x507e4c){return client[_0xb280('0xb')](_0x3b117b,_0x54f4fc)[_0xb280('0xc')](function(_0x38c781){logger[_0xb280('0xd')](_0xb280('0xe'),_0xca6773,_0xb280('0xf'));logger[_0xb280('0x10')](_0xb280('0x11'),_0xca6773,'request\x20sent',JSON[_0xb280('0x12')](_0x38c781));if(_0x38c781[_0xb280('0x13')]){if(_0x38c781[_0xb280('0x13')][_0xb280('0x14')]===0x1f4){logger[_0xb280('0x13')](_0xb280('0xe'),_0xca6773,_0x38c781[_0xb280('0x13')][_0xb280('0x15')]);return _0x507e4c(_0x38c781[_0xb280('0x13')][_0xb280('0x15')]);}logger['error'](_0xb280('0xe'),_0xca6773,_0x38c781[_0xb280('0x13')][_0xb280('0x15')]);return _0x5eb558(_0x38c781[_0xb280('0x13')][_0xb280('0x15')]);}else{logger[_0xb280('0xd')](_0xb280('0xe'),_0xca6773,'request\x20sent');_0x5eb558(_0x38c781[_0xb280('0x16')]['message']);}})[_0xb280('0x17')](function(_0x44acf7){logger[_0xb280('0x13')](_0xb280('0xe'),_0xca6773,_0x44acf7);_0x507e4c(_0x44acf7);});});}