da5ef5e8cfb34f37bac1fa9bc99f48139e748cfa
[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 _0x6882=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x6882,0x6e));var _0x2688=function(_0x791fb,_0x4f41ae){_0x791fb=_0x791fb-0x0;var _0x34e310=_0x6882[_0x791fb];return _0x34e310;};'use strict';var _=require('lodash');var util=require(_0x2688('0x0'));var moment=require(_0x2688('0x1'));var BPromise=require(_0x2688('0x2'));var rs=require(_0x2688('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2688('0x4'))['db'];var utils=require(_0x2688('0x5'));var logger=require(_0x2688('0x6'))('rpc');var config=require(_0x2688('0x7'));var jayson=require(_0x2688('0x8'));var client=jayson[_0x2688('0x9')][_0x2688('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f29e3,_0x5aa281,_0x1d4cf8){return new BPromise(function(_0x3b4c77,_0x2963b6){return client[_0x2688('0xb')](_0x1f29e3,_0x1d4cf8)[_0x2688('0xc')](function(_0x1aa440){logger['info'](_0x2688('0xd'),_0x5aa281,'request\x20sent');logger[_0x2688('0xe')](_0x2688('0xf'),_0x5aa281,_0x2688('0x10'),JSON[_0x2688('0x11')](_0x1aa440));if(_0x1aa440[_0x2688('0x12')]){if(_0x1aa440[_0x2688('0x12')][_0x2688('0x13')]===0x1f4){logger[_0x2688('0x12')]('ZendeskField,\x20%s,\x20%s',_0x5aa281,_0x1aa440[_0x2688('0x12')][_0x2688('0x14')]);return _0x2963b6(_0x1aa440['error']['message']);}logger[_0x2688('0x12')](_0x2688('0xd'),_0x5aa281,_0x1aa440[_0x2688('0x12')]['message']);return _0x3b4c77(_0x1aa440['error']['message']);}else{logger[_0x2688('0x15')](_0x2688('0xd'),_0x5aa281,'request\x20sent');_0x3b4c77(_0x1aa440['result'][_0x2688('0x14')]);}})['catch'](function(_0x166e11){logger[_0x2688('0x12')](_0x2688('0xd'),_0x5aa281,_0x166e11);_0x2963b6(_0x166e11);});});}