Built motion from commit 994c64e1.|2.6.1
[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 _0x8a51=['request\x20sent','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshdeskField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x15425c,_0x38a0c2){var _0x208762=function(_0x2a6222){while(--_0x2a6222){_0x15425c['push'](_0x15425c['shift']());}};_0x208762(++_0x38a0c2);}(_0x8a51,0x17f));var _0x18a5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x8a51[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0x18a5('0x0'));var util=require(_0x18a5('0x1'));var moment=require(_0x18a5('0x2'));var BPromise=require(_0x18a5('0x3'));var rs=require(_0x18a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x18a5('0x5'))('rpc');var config=require(_0x18a5('0x6'));var jayson=require(_0x18a5('0x7'));var client=jayson[_0x18a5('0x8')][_0x18a5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bebbf,_0x413c61,_0x2d0ec1){return new BPromise(function(_0x1c8128,_0x2d1394){return client[_0x18a5('0xa')](_0x1bebbf,_0x2d0ec1)[_0x18a5('0xb')](function(_0x3983e){logger[_0x18a5('0xc')]('FreshdeskField,\x20%s,\x20%s',_0x413c61,_0x18a5('0xd'));logger['debug'](_0x18a5('0xe'),_0x413c61,'request\x20sent',JSON[_0x18a5('0xf')](_0x3983e));if(_0x3983e['error']){if(_0x3983e[_0x18a5('0x10')][_0x18a5('0x11')]===0x1f4){logger[_0x18a5('0x10')](_0x18a5('0x12'),_0x413c61,_0x3983e[_0x18a5('0x10')][_0x18a5('0x13')]);return _0x2d1394(_0x3983e[_0x18a5('0x10')][_0x18a5('0x13')]);}logger['error'](_0x18a5('0x12'),_0x413c61,_0x3983e['error'][_0x18a5('0x13')]);return _0x1c8128(_0x3983e['error'][_0x18a5('0x13')]);}else{logger[_0x18a5('0xc')](_0x18a5('0x12'),_0x413c61,_0x18a5('0xd'));_0x1c8128(_0x3983e[_0x18a5('0x14')][_0x18a5('0x13')]);}})[_0x18a5('0x15')](function(_0x58a853){logger[_0x18a5('0x10')](_0x18a5('0x12'),_0x413c61,_0x58a853);_0x2d1394(_0x58a853);});});}