717392b202d46d51801e1b38e90b1e4f3f44bad5
[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 _0x3f40=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','FreshdeskField,\x20%s,\x20%s','result','catch','util','moment','ioredis','../../mysqldb'];(function(_0x3178a5,_0x277d23){var _0x214e8d=function(_0x4a1f3e){while(--_0x4a1f3e){_0x3178a5['push'](_0x3178a5['shift']());}};_0x214e8d(++_0x277d23);}(_0x3f40,0x6a));var _0x03f4=function(_0x1af84b,_0x467a7a){_0x1af84b=_0x1af84b-0x0;var _0x30f582=_0x3f40[_0x1af84b];return _0x30f582;};'use strict';var _=require('lodash');var util=require(_0x03f4('0x0'));var moment=require(_0x03f4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x03f4('0x2'));var db=require(_0x03f4('0x3'))['db'];var utils=require(_0x03f4('0x4'));var logger=require(_0x03f4('0x5'))(_0x03f4('0x6'));var config=require(_0x03f4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x03f4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5e7f14,_0x1f060e,_0x18e258){return new BPromise(function(_0x2fc487,_0x44bac0){return client[_0x03f4('0x9')](_0x5e7f14,_0x18e258)[_0x03f4('0xa')](function(_0x11ed95){logger[_0x03f4('0xb')]('FreshdeskField,\x20%s,\x20%s',_0x1f060e,_0x03f4('0xc'));logger[_0x03f4('0xd')](_0x03f4('0xe'),_0x1f060e,_0x03f4('0xc'),JSON[_0x03f4('0xf')](_0x11ed95));if(_0x11ed95[_0x03f4('0x10')]){if(_0x11ed95[_0x03f4('0x10')][_0x03f4('0x11')]===0x1f4){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x1f060e,_0x11ed95[_0x03f4('0x10')][_0x03f4('0x12')]);return _0x44bac0(_0x11ed95['error'][_0x03f4('0x12')]);}logger[_0x03f4('0x10')](_0x03f4('0x13'),_0x1f060e,_0x11ed95[_0x03f4('0x10')][_0x03f4('0x12')]);return _0x2fc487(_0x11ed95[_0x03f4('0x10')][_0x03f4('0x12')]);}else{logger[_0x03f4('0xb')](_0x03f4('0x13'),_0x1f060e,_0x03f4('0xc'));_0x2fc487(_0x11ed95[_0x03f4('0x14')]['message']);}})[_0x03f4('0x15')](function(_0x49d855){logger['error']('FreshdeskField,\x20%s,\x20%s',_0x1f060e,_0x49d855);_0x44bac0(_0x49d855);});});}