Built motion from commit 9d7072cc.|2.5.39
[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 _0xb94c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','moment'];(function(_0x5256a9,_0x787fa9){var _0x180092=function(_0xf8e4af){while(--_0xf8e4af){_0x5256a9['push'](_0x5256a9['shift']());}};_0x180092(++_0x787fa9);}(_0xb94c,0x132));var _0xcb94=function(_0x3aa78b,_0x1d935c){_0x3aa78b=_0x3aa78b-0x0;var _0xe10dde=_0xb94c[_0x3aa78b];return _0xe10dde;};'use strict';var _=require(_0xcb94('0x0'));var util=require('util');var moment=require(_0xcb94('0x1'));var BPromise=require(_0xcb94('0x2'));var rs=require(_0xcb94('0x3'));var fs=require('fs');var Redis=require(_0xcb94('0x4'));var db=require(_0xcb94('0x5'))['db'];var utils=require(_0xcb94('0x6'));var logger=require(_0xcb94('0x7'))('rpc');var config=require(_0xcb94('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcb94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d04b8,_0x36255b,_0x227ab9){return new BPromise(function(_0x5d72b1,_0x132f3b){return client[_0xcb94('0xa')](_0x2d04b8,_0x227ab9)[_0xcb94('0xb')](function(_0x37764b){logger[_0xcb94('0xc')](_0xcb94('0xd'),_0x36255b,_0xcb94('0xe'));logger[_0xcb94('0xf')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x36255b,'request\x20sent',JSON[_0xcb94('0x10')](_0x37764b));if(_0x37764b['error']){if(_0x37764b['error'][_0xcb94('0x11')]===0x1f4){logger[_0xcb94('0x12')]('ZendeskField,\x20%s,\x20%s',_0x36255b,_0x37764b[_0xcb94('0x12')][_0xcb94('0x13')]);return _0x132f3b(_0x37764b[_0xcb94('0x12')][_0xcb94('0x13')]);}logger['error'](_0xcb94('0xd'),_0x36255b,_0x37764b['error'][_0xcb94('0x13')]);return _0x5d72b1(_0x37764b[_0xcb94('0x12')][_0xcb94('0x13')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x36255b,_0xcb94('0xe'));_0x5d72b1(_0x37764b[_0xcb94('0x14')]['message']);}})[_0xcb94('0x15')](function(_0x199edb){logger[_0xcb94('0x12')](_0xcb94('0xd'),_0x36255b,_0x199edb);_0x132f3b(_0x199edb);});});}