20b2d10f2ab9ad84dd892902e4cc22606c835b5d
[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 _0x906f=['client','request','then','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise'];(function(_0x40ef06,_0x7efe51){var _0x33b39f=function(_0x1eae6b){while(--_0x1eae6b){_0x40ef06['push'](_0x40ef06['shift']());}};_0x33b39f(++_0x7efe51);}(_0x906f,0x1f1));var _0xf906=function(_0x3c4ba6,_0x3bd974){_0x3c4ba6=_0x3c4ba6-0x0;var _0x1a0e64=_0x906f[_0x3c4ba6];return _0x1a0e64;};'use strict';var _=require(_0xf906('0x0'));var util=require(_0xf906('0x1'));var moment=require(_0xf906('0x2'));var BPromise=require(_0xf906('0x3'));var rs=require(_0xf906('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf906('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf906('0x6'))(_0xf906('0x7'));var config=require('../../config/environment');var jayson=require(_0xf906('0x8'));var client=jayson[_0xf906('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21fb4f,_0x394bd2,_0x1dd8af){return new BPromise(function(_0x1dd06c,_0x4009c4){return client[_0xf906('0xa')](_0x21fb4f,_0x1dd8af)[_0xf906('0xb')](function(_0xe9d403){logger['info'](_0xf906('0xc'),_0x394bd2,'request\x20sent');logger[_0xf906('0xd')](_0xf906('0xe'),_0x394bd2,_0xf906('0xf'),JSON[_0xf906('0x10')](_0xe9d403));if(_0xe9d403[_0xf906('0x11')]){if(_0xe9d403['error'][_0xf906('0x12')]===0x1f4){logger[_0xf906('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x394bd2,_0xe9d403[_0xf906('0x11')][_0xf906('0x13')]);return _0x4009c4(_0xe9d403[_0xf906('0x11')]['message']);}logger[_0xf906('0x11')](_0xf906('0xc'),_0x394bd2,_0xe9d403[_0xf906('0x11')][_0xf906('0x13')]);return _0x1dd06c(_0xe9d403[_0xf906('0x11')][_0xf906('0x13')]);}else{logger[_0xf906('0x14')](_0xf906('0xc'),_0x394bd2,'request\x20sent');_0x1dd06c(_0xe9d403[_0xf906('0x15')]['message']);}})[_0xf906('0x16')](function(_0x25409c){logger[_0xf906('0x11')](_0xf906('0xc'),_0x394bd2,_0x25409c);_0x4009c4(_0x25409c);});});}