b9585dbd206e8adcabc56ee81d6af856472e75dd
[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 _0xa400=['lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x21524a,_0x1ce544){var _0x46a75d=function(_0x52eb8c){while(--_0x52eb8c){_0x21524a['push'](_0x21524a['shift']());}};_0x46a75d(++_0x1ce544);}(_0xa400,0x10a));var _0x0a40=function(_0x2a2f96,_0x5a5572){_0x2a2f96=_0x2a2f96-0x0;var _0x4d590a=_0xa400[_0x2a2f96];return _0x4d590a;};'use strict';var _=require(_0x0a40('0x0'));var util=require('util');var moment=require(_0x0a40('0x1'));var BPromise=require('bluebird');var rs=require(_0x0a40('0x2'));var fs=require('fs');var Redis=require(_0x0a40('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a40('0x4'));var logger=require('../../config/logger')(_0x0a40('0x5'));var config=require(_0x0a40('0x6'));var jayson=require(_0x0a40('0x7'));var client=jayson['client'][_0x0a40('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5b7c9c,_0x1bb374,_0xfd29c6){return new BPromise(function(_0x16774e,_0x2dcdc9){return client['request'](_0x5b7c9c,_0xfd29c6)['then'](function(_0x59e1d0){logger[_0x0a40('0x9')](_0x0a40('0xa'),_0x1bb374,_0x0a40('0xb'));logger['debug'](_0x0a40('0xc'),_0x1bb374,_0x0a40('0xb'),JSON[_0x0a40('0xd')](_0x59e1d0));if(_0x59e1d0[_0x0a40('0xe')]){if(_0x59e1d0[_0x0a40('0xe')][_0x0a40('0xf')]===0x1f4){logger[_0x0a40('0xe')](_0x0a40('0xa'),_0x1bb374,_0x59e1d0[_0x0a40('0xe')][_0x0a40('0x10')]);return _0x2dcdc9(_0x59e1d0[_0x0a40('0xe')][_0x0a40('0x10')]);}logger['error'](_0x0a40('0xa'),_0x1bb374,_0x59e1d0[_0x0a40('0xe')][_0x0a40('0x10')]);return _0x16774e(_0x59e1d0[_0x0a40('0xe')][_0x0a40('0x10')]);}else{logger['info'](_0x0a40('0xa'),_0x1bb374,'request\x20sent');_0x16774e(_0x59e1d0[_0x0a40('0x11')][_0x0a40('0x10')]);}})[_0x0a40('0x12')](function(_0x1c2259){logger[_0x0a40('0xe')](_0x0a40('0xa'),_0x1bb374,_0x1c2259);_0x2dcdc9(_0x1c2259);});});}