Built motion from commit 00bf23f6.|2.6.16
[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 _0x1a69=['message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x528442,_0x3f7aed){var _0x4c42cd=function(_0x304a36){while(--_0x304a36){_0x528442['push'](_0x528442['shift']());}};_0x4c42cd(++_0x3f7aed);}(_0x1a69,0xf5));var _0x91a6=function(_0x1ea6f6,_0x415117){_0x1ea6f6=_0x1ea6f6-0x0;var _0x10fe52=_0x1a69[_0x1ea6f6];return _0x10fe52;};'use strict';var _=require('lodash');var util=require(_0x91a6('0x0'));var moment=require('moment');var BPromise=require(_0x91a6('0x1'));var rs=require(_0x91a6('0x2'));var fs=require('fs');var Redis=require(_0x91a6('0x3'));var db=require(_0x91a6('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x91a6('0x5'));var config=require(_0x91a6('0x6'));var jayson=require(_0x91a6('0x7'));var client=jayson[_0x91a6('0x8')][_0x91a6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1bccde,_0x5074b2,_0x48cba8){return new BPromise(function(_0x74cf0e,_0x43b7a3){return client[_0x91a6('0xa')](_0x1bccde,_0x48cba8)['then'](function(_0x47f170){logger[_0x91a6('0xb')](_0x91a6('0xc'),_0x5074b2,'request\x20sent');logger[_0x91a6('0xd')](_0x91a6('0xe'),_0x5074b2,_0x91a6('0xf'),JSON[_0x91a6('0x10')](_0x47f170));if(_0x47f170[_0x91a6('0x11')]){if(_0x47f170['error'][_0x91a6('0x12')]===0x1f4){logger[_0x91a6('0x11')](_0x91a6('0xc'),_0x5074b2,_0x47f170[_0x91a6('0x11')]['message']);return _0x43b7a3(_0x47f170['error']['message']);}logger[_0x91a6('0x11')](_0x91a6('0xc'),_0x5074b2,_0x47f170[_0x91a6('0x11')][_0x91a6('0x13')]);return _0x74cf0e(_0x47f170[_0x91a6('0x11')]['message']);}else{logger[_0x91a6('0xb')](_0x91a6('0xc'),_0x5074b2,_0x91a6('0xf'));_0x74cf0e(_0x47f170[_0x91a6('0x14')][_0x91a6('0x13')]);}})[_0x91a6('0x15')](function(_0x11842b){logger['error'](_0x91a6('0xc'),_0x5074b2,_0x11842b);_0x43b7a3(_0x11842b);});});}