819e96204fac060cbdbda98c1247e7edd478bb6f
[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 _0xc313=['message','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','debug','request\x20sent','error','code','ZendeskField,\x20%s,\x20%s'];(function(_0x5f41f0,_0x3cf76f){var _0x49aa30=function(_0x4644a){while(--_0x4644a){_0x5f41f0['push'](_0x5f41f0['shift']());}};_0x49aa30(++_0x3cf76f);}(_0xc313,0xa1));var _0x3c31=function(_0x2332de,_0x4a6f67){_0x2332de=_0x2332de-0x0;var _0x2406ca=_0xc313[_0x2332de];return _0x2406ca;};'use strict';var _=require(_0x3c31('0x0'));var util=require('util');var moment=require(_0x3c31('0x1'));var BPromise=require(_0x3c31('0x2'));var rs=require(_0x3c31('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3c31('0x4'))['db'];var utils=require(_0x3c31('0x5'));var logger=require(_0x3c31('0x6'))(_0x3c31('0x7'));var config=require(_0x3c31('0x8'));var jayson=require(_0x3c31('0x9'));var client=jayson[_0x3c31('0xa')][_0x3c31('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cfa02,_0x3bb9d5,_0x1a60b5){return new BPromise(function(_0x596298,_0x1323a4){return client['request'](_0x4cfa02,_0x1a60b5)[_0x3c31('0xc')](function(_0x5790f7){logger[_0x3c31('0xd')]('ZendeskField,\x20%s,\x20%s',_0x3bb9d5,'request\x20sent');logger[_0x3c31('0xe')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3bb9d5,_0x3c31('0xf'),JSON['stringify'](_0x5790f7));if(_0x5790f7['error']){if(_0x5790f7[_0x3c31('0x10')][_0x3c31('0x11')]===0x1f4){logger['error'](_0x3c31('0x12'),_0x3bb9d5,_0x5790f7['error'][_0x3c31('0x13')]);return _0x1323a4(_0x5790f7['error'][_0x3c31('0x13')]);}logger[_0x3c31('0x10')](_0x3c31('0x12'),_0x3bb9d5,_0x5790f7[_0x3c31('0x10')]['message']);return _0x596298(_0x5790f7['error'][_0x3c31('0x13')]);}else{logger[_0x3c31('0xd')](_0x3c31('0x12'),_0x3bb9d5,_0x3c31('0xf'));_0x596298(_0x5790f7['result'][_0x3c31('0x13')]);}})['catch'](function(_0xf5b7cb){logger[_0x3c31('0x10')]('ZendeskField,\x20%s,\x20%s',_0x3bb9d5,_0xf5b7cb);_0x1323a4(_0xf5b7cb);});});}