0ee53ffe9ef0751053c62bfd8454db5c9a5979f7
[motion2.git] / server / api / intFreshdeskField / intFreshdeskField.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 _0xa5c4=['client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x133643,_0x4d7f52){var _0x535ec8=function(_0x369a9e){while(--_0x369a9e){_0x133643['push'](_0x133643['shift']());}};_0x535ec8(++_0x4d7f52);}(_0xa5c4,0x69));var _0x4a5c=function(_0x198446,_0x119c8f){_0x198446=_0x198446-0x0;var _0x38d7b7=_0xa5c4[_0x198446];return _0x38d7b7;};'use strict';var _=require(_0x4a5c('0x0'));var util=require(_0x4a5c('0x1'));var moment=require('moment');var BPromise=require(_0x4a5c('0x2'));var rs=require(_0x4a5c('0x3'));var fs=require('fs');var Redis=require(_0x4a5c('0x4'));var db=require(_0x4a5c('0x5'))['db'];var utils=require(_0x4a5c('0x6'));var logger=require('../../config/logger')(_0x4a5c('0x7'));var config=require(_0x4a5c('0x8'));var jayson=require(_0x4a5c('0x9'));var client=jayson[_0x4a5c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ee24d,_0x273336,_0x246c6e){return new BPromise(function(_0x332dc5,_0x1a2e8d){return client[_0x4a5c('0xb')](_0x1ee24d,_0x246c6e)[_0x4a5c('0xc')](function(_0x3e0317){logger[_0x4a5c('0xd')](_0x4a5c('0xe'),_0x273336,_0x4a5c('0xf'));logger[_0x4a5c('0x10')](_0x4a5c('0x11'),_0x273336,'request\x20sent',JSON[_0x4a5c('0x12')](_0x3e0317));if(_0x3e0317[_0x4a5c('0x13')]){if(_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x14')]===0x1f4){logger[_0x4a5c('0x13')](_0x4a5c('0xe'),_0x273336,_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x15')]);return _0x1a2e8d(_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x15')]);}logger[_0x4a5c('0x13')](_0x4a5c('0xe'),_0x273336,_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x15')]);return _0x332dc5(_0x3e0317[_0x4a5c('0x13')][_0x4a5c('0x15')]);}else{logger[_0x4a5c('0xd')](_0x4a5c('0xe'),_0x273336,_0x4a5c('0xf'));_0x332dc5(_0x3e0317['result']['message']);}})[_0x4a5c('0x16')](function(_0x163f56){logger[_0x4a5c('0x13')](_0x4a5c('0xe'),_0x273336,_0x163f56);_0x1a2e8d(_0x163f56);});});}