Built motion from commit 6a0adb95.|2.6.31
[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 _0x5f11=['../../config/environment','client','request','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x25cf75,_0x549314){var _0x26c9f0=function(_0x1465c6){while(--_0x1465c6){_0x25cf75['push'](_0x25cf75['shift']());}};_0x26c9f0(++_0x549314);}(_0x5f11,0xfb));var _0x15f1=function(_0x3ecbdc,_0x3a71fe){_0x3ecbdc=_0x3ecbdc-0x0;var _0xad4dea=_0x5f11[_0x3ecbdc];return _0xad4dea;};'use strict';var _=require('lodash');var util=require(_0x15f1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x15f1('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15f1('0x2'))['db'];var utils=require(_0x15f1('0x3'));var logger=require(_0x15f1('0x4'))('rpc');var config=require(_0x15f1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x15f1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x366079,_0x44b2c3,_0x406981){return new BPromise(function(_0x3532bc,_0x451936){return client[_0x15f1('0x7')](_0x366079,_0x406981)['then'](function(_0x4855ae){logger['info'](_0x15f1('0x8'),_0x44b2c3,_0x15f1('0x9'));logger[_0x15f1('0xa')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x44b2c3,_0x15f1('0x9'),JSON[_0x15f1('0xb')](_0x4855ae));if(_0x4855ae[_0x15f1('0xc')]){if(_0x4855ae[_0x15f1('0xc')][_0x15f1('0xd')]===0x1f4){logger['error'](_0x15f1('0x8'),_0x44b2c3,_0x4855ae[_0x15f1('0xc')][_0x15f1('0xe')]);return _0x451936(_0x4855ae[_0x15f1('0xc')][_0x15f1('0xe')]);}logger[_0x15f1('0xc')](_0x15f1('0x8'),_0x44b2c3,_0x4855ae['error'][_0x15f1('0xe')]);return _0x3532bc(_0x4855ae['error']['message']);}else{logger['info'](_0x15f1('0x8'),_0x44b2c3,_0x15f1('0x9'));_0x3532bc(_0x4855ae[_0x15f1('0xf')]['message']);}})['catch'](function(_0x1b3af9){logger[_0x15f1('0xc')](_0x15f1('0x8'),_0x44b2c3,_0x1b3af9);_0x451936(_0x1b3af9);});});}