514114a9996b6a0220287c07fedd3b823823db13
[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 _0xb29b=['FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x53b594,_0x559767){var _0x1e616f=function(_0x333eda){while(--_0x333eda){_0x53b594['push'](_0x53b594['shift']());}};_0x1e616f(++_0x559767);}(_0xb29b,0x1ac));var _0xbb29=function(_0xbcf59f,_0x5acaa3){_0xbcf59f=_0xbcf59f-0x0;var _0x163df1=_0xb29b[_0xbcf59f];return _0x163df1;};'use strict';var _=require(_0xbb29('0x0'));var util=require('util');var moment=require(_0xbb29('0x1'));var BPromise=require(_0xbb29('0x2'));var rs=require(_0xbb29('0x3'));var fs=require('fs');var Redis=require(_0xbb29('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb29('0x5'));var logger=require('../../config/logger')(_0xbb29('0x6'));var config=require(_0xbb29('0x7'));var jayson=require(_0xbb29('0x8'));var client=jayson[_0xbb29('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc00ad1,_0x4c12c8,_0xf9d743){return new BPromise(function(_0x815285,_0x54398a){return client[_0xbb29('0xa')](_0xc00ad1,_0xf9d743)[_0xbb29('0xb')](function(_0x37b3a1){logger[_0xbb29('0xc')](_0xbb29('0xd'),_0x4c12c8,_0xbb29('0xe'));logger[_0xbb29('0xf')](_0xbb29('0x10'),_0x4c12c8,_0xbb29('0xe'),JSON[_0xbb29('0x11')](_0x37b3a1));if(_0x37b3a1[_0xbb29('0x12')]){if(_0x37b3a1['error']['code']===0x1f4){logger['error'](_0xbb29('0xd'),_0x4c12c8,_0x37b3a1[_0xbb29('0x12')][_0xbb29('0x13')]);return _0x54398a(_0x37b3a1[_0xbb29('0x12')]['message']);}logger['error'](_0xbb29('0xd'),_0x4c12c8,_0x37b3a1['error'][_0xbb29('0x13')]);return _0x815285(_0x37b3a1[_0xbb29('0x12')][_0xbb29('0x13')]);}else{logger['info']('FreshdeskField,\x20%s,\x20%s',_0x4c12c8,_0xbb29('0xe'));_0x815285(_0x37b3a1['result'][_0xbb29('0x13')]);}})[_0xbb29('0x14')](function(_0x15396a){logger[_0xbb29('0x12')](_0xbb29('0xd'),_0x4c12c8,_0x15396a);_0x54398a(_0x15396a);});});}