Built motion from commit 639a1a7f.|2.6.19
[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 _0x846f=['client','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x221623,_0x14ace5){var _0x5e362c=function(_0x2aa81c){while(--_0x2aa81c){_0x221623['push'](_0x221623['shift']());}};_0x5e362c(++_0x14ace5);}(_0x846f,0x19c));var _0xf846=function(_0x6d8936,_0x39d770){_0x6d8936=_0x6d8936-0x0;var _0x41a0ed=_0x846f[_0x6d8936];return _0x41a0ed;};'use strict';var _=require(_0xf846('0x0'));var util=require('util');var moment=require(_0xf846('0x1'));var BPromise=require(_0xf846('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf846('0x3'))['db'];var utils=require(_0xf846('0x4'));var logger=require('../../config/logger')(_0xf846('0x5'));var config=require(_0xf846('0x6'));var jayson=require(_0xf846('0x7'));var client=jayson[_0xf846('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x114f36,_0x67409f,_0x51300e){return new BPromise(function(_0x2112d9,_0x4d264d){return client['request'](_0x114f36,_0x51300e)[_0xf846('0x9')](function(_0x56d9fc){logger[_0xf846('0xa')](_0xf846('0xb'),_0x67409f,_0xf846('0xc'));logger[_0xf846('0xd')](_0xf846('0xe'),_0x67409f,'request\x20sent',JSON[_0xf846('0xf')](_0x56d9fc));if(_0x56d9fc[_0xf846('0x10')]){if(_0x56d9fc['error'][_0xf846('0x11')]===0x1f4){logger['error']('ZendeskField,\x20%s,\x20%s',_0x67409f,_0x56d9fc['error'][_0xf846('0x12')]);return _0x4d264d(_0x56d9fc['error']['message']);}logger['error'](_0xf846('0xb'),_0x67409f,_0x56d9fc['error'][_0xf846('0x12')]);return _0x2112d9(_0x56d9fc[_0xf846('0x10')][_0xf846('0x12')]);}else{logger[_0xf846('0xa')](_0xf846('0xb'),_0x67409f,_0xf846('0xc'));_0x2112d9(_0x56d9fc['result'][_0xf846('0x12')]);}})[_0xf846('0x13')](function(_0x19a466){logger['error'](_0xf846('0xb'),_0x67409f,_0x19a466);_0x4d264d(_0x19a466);});});}