54f1ea751e3de09acd7d01be0ac139561687c1f9
[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 _0xb9f9=['then','info','ZendeskField,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x474bc0,_0x26989c){var _0x4b24cf=function(_0x4be866){while(--_0x4be866){_0x474bc0['push'](_0x474bc0['shift']());}};_0x4b24cf(++_0x26989c);}(_0xb9f9,0x1ea));var _0x9b9f=function(_0x25ef94,_0x224618){_0x25ef94=_0x25ef94-0x0;var _0x27b450=_0xb9f9[_0x25ef94];return _0x27b450;};'use strict';var _=require('lodash');var util=require(_0x9b9f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x9b9f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9b9f('0x2'))['db'];var utils=require(_0x9b9f('0x3'));var logger=require(_0x9b9f('0x4'))('rpc');var config=require(_0x9b9f('0x5'));var jayson=require(_0x9b9f('0x6'));var client=jayson[_0x9b9f('0x7')][_0x9b9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c2706,_0xbee212,_0x89e175){return new BPromise(function(_0x377fe0,_0x316f1d){return client[_0x9b9f('0x9')](_0x4c2706,_0x89e175)[_0x9b9f('0xa')](function(_0x5efc56){logger[_0x9b9f('0xb')](_0x9b9f('0xc'),_0xbee212,'request\x20sent');logger[_0x9b9f('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0xbee212,_0x9b9f('0xe'),JSON['stringify'](_0x5efc56));if(_0x5efc56[_0x9b9f('0xf')]){if(_0x5efc56[_0x9b9f('0xf')][_0x9b9f('0x10')]===0x1f4){logger[_0x9b9f('0xf')](_0x9b9f('0xc'),_0xbee212,_0x5efc56[_0x9b9f('0xf')][_0x9b9f('0x11')]);return _0x316f1d(_0x5efc56[_0x9b9f('0xf')][_0x9b9f('0x11')]);}logger[_0x9b9f('0xf')]('ZendeskField,\x20%s,\x20%s',_0xbee212,_0x5efc56[_0x9b9f('0xf')][_0x9b9f('0x11')]);return _0x377fe0(_0x5efc56[_0x9b9f('0xf')]['message']);}else{logger[_0x9b9f('0xb')]('ZendeskField,\x20%s,\x20%s',_0xbee212,_0x9b9f('0xe'));_0x377fe0(_0x5efc56[_0x9b9f('0x12')][_0x9b9f('0x11')]);}})[_0x9b9f('0x13')](function(_0x8b478){logger[_0x9b9f('0xf')](_0x9b9f('0xc'),_0xbee212,_0x8b478);_0x316f1d(_0x8b478);});});}