c954d2e53e263913cd1bb578f12630784d180fb0
[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 _0xfe8b=['catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x207d3a,_0x44d239){var _0x51a26b=function(_0x5d795a){while(--_0x5d795a){_0x207d3a['push'](_0x207d3a['shift']());}};_0x51a26b(++_0x44d239);}(_0xfe8b,0x1e4));var _0xbfe8=function(_0x920ae3,_0x4652ef){_0x920ae3=_0x920ae3-0x0;var _0x19ea79=_0xfe8b[_0x920ae3];return _0x19ea79;};'use strict';var _=require(_0xbfe8('0x0'));var util=require('util');var moment=require(_0xbfe8('0x1'));var BPromise=require(_0xbfe8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbfe8('0x3'));var db=require(_0xbfe8('0x4'))['db'];var utils=require(_0xbfe8('0x5'));var logger=require(_0xbfe8('0x6'))(_0xbfe8('0x7'));var config=require(_0xbfe8('0x8'));var jayson=require(_0xbfe8('0x9'));var client=jayson[_0xbfe8('0xa')][_0xbfe8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ce15f,_0x45340b,_0x332910){return new BPromise(function(_0x4a7786,_0x1fd0c9){return client[_0xbfe8('0xc')](_0x1ce15f,_0x332910)[_0xbfe8('0xd')](function(_0x2fc7c6){logger['info'](_0xbfe8('0xe'),_0x45340b,_0xbfe8('0xf'));logger[_0xbfe8('0x10')]('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x45340b,_0xbfe8('0xf'),JSON['stringify'](_0x2fc7c6));if(_0x2fc7c6[_0xbfe8('0x11')]){if(_0x2fc7c6['error'][_0xbfe8('0x12')]===0x1f4){logger['error'](_0xbfe8('0xe'),_0x45340b,_0x2fc7c6['error'][_0xbfe8('0x13')]);return _0x1fd0c9(_0x2fc7c6[_0xbfe8('0x11')][_0xbfe8('0x13')]);}logger[_0xbfe8('0x11')](_0xbfe8('0xe'),_0x45340b,_0x2fc7c6['error']['message']);return _0x4a7786(_0x2fc7c6['error'][_0xbfe8('0x13')]);}else{logger[_0xbfe8('0x14')](_0xbfe8('0xe'),_0x45340b,_0xbfe8('0xf'));_0x4a7786(_0x2fc7c6[_0xbfe8('0x15')][_0xbfe8('0x13')]);}})[_0xbfe8('0x16')](function(_0x100b9c){logger[_0xbfe8('0x11')](_0xbfe8('0xe'),_0x45340b,_0x100b9c);_0x1fd0c9(_0x100b9c);});});}