57495cffb89063bbe5a8801617f90f9d7d2cac76
[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 _0xfe11=['error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x455c6c,_0x1e78b7){var _0x488242=function(_0x3e8fb0){while(--_0x3e8fb0){_0x455c6c['push'](_0x455c6c['shift']());}};_0x488242(++_0x1e78b7);}(_0xfe11,0x1bd));var _0x1fe1=function(_0x2526e3,_0x5f22f8){_0x2526e3=_0x2526e3-0x0;var _0xcf6f48=_0xfe11[_0x2526e3];return _0xcf6f48;};'use strict';var _=require(_0x1fe1('0x0'));var util=require('util');var moment=require(_0x1fe1('0x1'));var BPromise=require(_0x1fe1('0x2'));var rs=require(_0x1fe1('0x3'));var fs=require('fs');var Redis=require(_0x1fe1('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1fe1('0x5'))(_0x1fe1('0x6'));var config=require(_0x1fe1('0x7'));var jayson=require(_0x1fe1('0x8'));var client=jayson[_0x1fe1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x77a1a6,_0x267b3f,_0x1b2fef){return new BPromise(function(_0x40c658,_0x3134d5){return client[_0x1fe1('0xa')](_0x77a1a6,_0x1b2fef)['then'](function(_0x4f5351){logger[_0x1fe1('0xb')](_0x1fe1('0xc'),_0x267b3f,_0x1fe1('0xd'));logger[_0x1fe1('0xe')](_0x1fe1('0xf'),_0x267b3f,'request\x20sent',JSON[_0x1fe1('0x10')](_0x4f5351));if(_0x4f5351[_0x1fe1('0x11')]){if(_0x4f5351[_0x1fe1('0x11')][_0x1fe1('0x12')]===0x1f4){logger['error'](_0x1fe1('0xc'),_0x267b3f,_0x4f5351[_0x1fe1('0x11')]['message']);return _0x3134d5(_0x4f5351['error'][_0x1fe1('0x13')]);}logger[_0x1fe1('0x11')](_0x1fe1('0xc'),_0x267b3f,_0x4f5351[_0x1fe1('0x11')]['message']);return _0x40c658(_0x4f5351[_0x1fe1('0x11')][_0x1fe1('0x13')]);}else{logger[_0x1fe1('0xb')]('ZendeskField,\x20%s,\x20%s',_0x267b3f,_0x1fe1('0xd'));_0x40c658(_0x4f5351[_0x1fe1('0x14')]['message']);}})['catch'](function(_0x12ea2b){logger['error'](_0x1fe1('0xc'),_0x267b3f,_0x12ea2b);_0x3134d5(_0x12ea2b);});});}