Built motion from commit 497d3d92.|2.5.43
[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 _0xae27=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xae27,0x134));var _0x7ae2=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0xae27[_0x3f0b30];return _0x2748a5;};'use strict';var _=require('lodash');var util=require(_0x7ae2('0x0'));var moment=require(_0x7ae2('0x1'));var BPromise=require('bluebird');var rs=require(_0x7ae2('0x2'));var fs=require('fs');var Redis=require(_0x7ae2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ae2('0x4'));var logger=require('../../config/logger')(_0x7ae2('0x5'));var config=require(_0x7ae2('0x6'));var jayson=require(_0x7ae2('0x7'));var client=jayson[_0x7ae2('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x430fc5,_0x84b6a,_0x1e5bc9){return new BPromise(function(_0x4f52a0,_0x45bf92){return client[_0x7ae2('0x9')](_0x430fc5,_0x1e5bc9)[_0x7ae2('0xa')](function(_0x2555aa){logger[_0x7ae2('0xb')](_0x7ae2('0xc'),_0x84b6a,_0x7ae2('0xd'));logger[_0x7ae2('0xe')](_0x7ae2('0xf'),_0x84b6a,_0x7ae2('0xd'),JSON['stringify'](_0x2555aa));if(_0x2555aa[_0x7ae2('0x10')]){if(_0x2555aa[_0x7ae2('0x10')][_0x7ae2('0x11')]===0x1f4){logger['error'](_0x7ae2('0xc'),_0x84b6a,_0x2555aa['error'][_0x7ae2('0x12')]);return _0x45bf92(_0x2555aa[_0x7ae2('0x10')][_0x7ae2('0x12')]);}logger['error'](_0x7ae2('0xc'),_0x84b6a,_0x2555aa[_0x7ae2('0x10')][_0x7ae2('0x12')]);return _0x4f52a0(_0x2555aa[_0x7ae2('0x10')][_0x7ae2('0x12')]);}else{logger[_0x7ae2('0xb')](_0x7ae2('0xc'),_0x84b6a,_0x7ae2('0xd'));_0x4f52a0(_0x2555aa['result'][_0x7ae2('0x12')]);}})[_0x7ae2('0x13')](function(_0x2e6154){logger['error'](_0x7ae2('0xc'),_0x84b6a,_0x2e6154);_0x45bf92(_0x2e6154);});});}