d6cdacf77c1d3a56c27b8bce2d0da4886ca406b0
[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 _0xec46=['FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0xec46,0x8e));var _0x6ec4=function(_0x3de99a,_0x20140b){_0x3de99a=_0x3de99a-0x0;var _0x3d9667=_0xec46[_0x3de99a];return _0x3d9667;};'use strict';var _=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var moment=require(_0x6ec4('0x2'));var BPromise=require(_0x6ec4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6ec4('0x4'));var db=require(_0x6ec4('0x5'))['db'];var utils=require(_0x6ec4('0x6'));var logger=require('../../config/logger')(_0x6ec4('0x7'));var config=require(_0x6ec4('0x8'));var jayson=require(_0x6ec4('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7a541e,_0x16f663,_0x1b6e17){return new BPromise(function(_0x144621,_0x1de80a){return client[_0x6ec4('0xa')](_0x7a541e,_0x1b6e17)[_0x6ec4('0xb')](function(_0x447db2){logger['info'](_0x6ec4('0xc'),_0x16f663,'request\x20sent');logger['debug'](_0x6ec4('0xd'),_0x16f663,_0x6ec4('0xe'),JSON[_0x6ec4('0xf')](_0x447db2));if(_0x447db2['error']){if(_0x447db2[_0x6ec4('0x10')][_0x6ec4('0x11')]===0x1f4){logger[_0x6ec4('0x10')](_0x6ec4('0xc'),_0x16f663,_0x447db2[_0x6ec4('0x10')][_0x6ec4('0x12')]);return _0x1de80a(_0x447db2[_0x6ec4('0x10')]['message']);}logger[_0x6ec4('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x16f663,_0x447db2[_0x6ec4('0x10')]['message']);return _0x144621(_0x447db2[_0x6ec4('0x10')][_0x6ec4('0x12')]);}else{logger[_0x6ec4('0x13')](_0x6ec4('0xc'),_0x16f663,_0x6ec4('0xe'));_0x144621(_0x447db2[_0x6ec4('0x14')][_0x6ec4('0x12')]);}})[_0x6ec4('0x15')](function(_0x3537b5){logger[_0x6ec4('0x10')](_0x6ec4('0xc'),_0x16f663,_0x3537b5);_0x1de80a(_0x3537b5);});});}