Built motion from commit (unavailable).|2.4.18
[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 _0xf854=['rpc','../../config/environment','jayson/promise','client','http','request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','../../mysqldb'];(function(_0x16b969,_0x4f8d09){var _0x73e023=function(_0x446840){while(--_0x446840){_0x16b969['push'](_0x16b969['shift']());}};_0x73e023(++_0x4f8d09);}(_0xf854,0x10b));var _0x4f85=function(_0xe6815e,_0xdb14ba){_0xe6815e=_0xe6815e-0x0;var _0x1e5cb7=_0xf854[_0xe6815e];return _0x1e5cb7;};'use strict';var _=require(_0x4f85('0x0'));var util=require(_0x4f85('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f85('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4f85('0x3'));var config=require(_0x4f85('0x4'));var jayson=require(_0x4f85('0x5'));var client=jayson[_0x4f85('0x6')][_0x4f85('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x24c4b4,_0x31ae4f,_0x5ead92){return new BPromise(function(_0x54807d,_0x264eaf){return client[_0x4f85('0x8')](_0x24c4b4,_0x5ead92)[_0x4f85('0x9')](function(_0x18db71){logger['info'](_0x4f85('0xa'),_0x31ae4f,'request\x20sent');logger[_0x4f85('0xb')](_0x4f85('0xc'),_0x31ae4f,'request\x20sent',JSON[_0x4f85('0xd')](_0x18db71));if(_0x18db71[_0x4f85('0xe')]){if(_0x18db71[_0x4f85('0xe')]['code']===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x31ae4f,_0x18db71['error']['message']);return _0x264eaf(_0x18db71['error'][_0x4f85('0xf')]);}logger[_0x4f85('0xe')]('ZendeskField,\x20%s,\x20%s',_0x31ae4f,_0x18db71[_0x4f85('0xe')][_0x4f85('0xf')]);return _0x54807d(_0x18db71[_0x4f85('0xe')][_0x4f85('0xf')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x31ae4f,'request\x20sent');_0x54807d(_0x18db71[_0x4f85('0x10')][_0x4f85('0xf')]);}})[_0x4f85('0x11')](function(_0x3ce26f){logger['error'](_0x4f85('0xa'),_0x31ae4f,_0x3ce26f);_0x264eaf(_0x3ce26f);});});}