Built motion from commit 25580385.|2.6.2
[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 _0x262a=['request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x2c8484,_0x167fc0){var _0xd28ba=function(_0x5b6387){while(--_0x5b6387){_0x2c8484['push'](_0x2c8484['shift']());}};_0xd28ba(++_0x167fc0);}(_0x262a,0x1ec));var _0xa262=function(_0xb1174e,_0x1e68a7){_0xb1174e=_0xb1174e-0x0;var _0x285bac=_0x262a[_0xb1174e];return _0x285bac;};'use strict';var _=require('lodash');var util=require(_0xa262('0x0'));var moment=require('moment');var BPromise=require(_0xa262('0x1'));var rs=require(_0xa262('0x2'));var fs=require('fs');var Redis=require(_0xa262('0x3'));var db=require(_0xa262('0x4'))['db'];var utils=require(_0xa262('0x5'));var logger=require(_0xa262('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa262('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2ebdc3,_0x4ca480,_0xfa966a){return new BPromise(function(_0x17c771,_0x51167c){return client[_0xa262('0x8')](_0x2ebdc3,_0xfa966a)[_0xa262('0x9')](function(_0x106f29){logger[_0xa262('0xa')](_0xa262('0xb'),_0x4ca480,_0xa262('0xc'));logger[_0xa262('0xd')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x4ca480,_0xa262('0xc'),JSON[_0xa262('0xe')](_0x106f29));if(_0x106f29[_0xa262('0xf')]){if(_0x106f29['error'][_0xa262('0x10')]===0x1f4){logger['error'](_0xa262('0xb'),_0x4ca480,_0x106f29[_0xa262('0xf')][_0xa262('0x11')]);return _0x51167c(_0x106f29[_0xa262('0xf')][_0xa262('0x11')]);}logger[_0xa262('0xf')](_0xa262('0xb'),_0x4ca480,_0x106f29[_0xa262('0xf')][_0xa262('0x11')]);return _0x17c771(_0x106f29[_0xa262('0xf')][_0xa262('0x11')]);}else{logger[_0xa262('0xa')](_0xa262('0xb'),_0x4ca480,_0xa262('0xc'));_0x17c771(_0x106f29[_0xa262('0x12')]['message']);}})[_0xa262('0x13')](function(_0x1fabf2){logger[_0xa262('0xf')](_0xa262('0xb'),_0x4ca480,_0x1fabf2);_0x51167c(_0x1fabf2);});});}