ccc145f48dc4887500f5b21bf590ccbba0fd8888
[motion2.git] / server / api / intZendeskField / intZendeskField.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 _0x344f=['code','ZendeskField,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4669fc,_0x4b181b){var _0x19068f=function(_0x1f5e5e){while(--_0x1f5e5e){_0x4669fc['push'](_0x4669fc['shift']());}};_0x19068f(++_0x4b181b);}(_0x344f,0x101));var _0xf344=function(_0x347f98,_0x466b87){_0x347f98=_0x347f98-0x0;var _0x200aa2=_0x344f[_0x347f98];return _0x200aa2;};'use strict';var _=require('lodash');var util=require(_0xf344('0x0'));var moment=require(_0xf344('0x1'));var BPromise=require(_0xf344('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf344('0x3'));var db=require(_0xf344('0x4'))['db'];var utils=require(_0xf344('0x5'));var logger=require(_0xf344('0x6'))('rpc');var config=require(_0xf344('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf344('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd6a2b,_0x3115e0,_0x446c59){return new BPromise(function(_0x48260a,_0x5004e9){return client[_0xf344('0x9')](_0xd6a2b,_0x446c59)[_0xf344('0xa')](function(_0x587719){logger['info']('ZendeskField,\x20%s,\x20%s',_0x3115e0,_0xf344('0xb'));logger[_0xf344('0xc')](_0xf344('0xd'),_0x3115e0,'request\x20sent',JSON[_0xf344('0xe')](_0x587719));if(_0x587719[_0xf344('0xf')]){if(_0x587719[_0xf344('0xf')][_0xf344('0x10')]===0x1f4){logger[_0xf344('0xf')](_0xf344('0x11'),_0x3115e0,_0x587719[_0xf344('0xf')]['message']);return _0x5004e9(_0x587719[_0xf344('0xf')][_0xf344('0x12')]);}logger[_0xf344('0xf')](_0xf344('0x11'),_0x3115e0,_0x587719[_0xf344('0xf')][_0xf344('0x12')]);return _0x48260a(_0x587719['error'][_0xf344('0x12')]);}else{logger['info'](_0xf344('0x11'),_0x3115e0,_0xf344('0xb'));_0x48260a(_0x587719[_0xf344('0x13')][_0xf344('0x12')]);}})[_0xf344('0x14')](function(_0x151c74){logger[_0xf344('0xf')](_0xf344('0x11'),_0x3115e0,_0x151c74);_0x5004e9(_0x151c74);});});}