7fd8a40e20dcc33c3dec2d023fac00ee7c8267d8
[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 _0xb9ea=['../../config/environment','jayson/promise','client','http','then','info','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0xb9ea,0x175));var _0xab9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb9ea[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xab9e('0x0'));var util=require(_0xab9e('0x1'));var moment=require(_0xab9e('0x2'));var BPromise=require(_0xab9e('0x3'));var rs=require(_0xab9e('0x4'));var fs=require('fs');var Redis=require(_0xab9e('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab9e('0x6'))('rpc');var config=require(_0xab9e('0x7'));var jayson=require(_0xab9e('0x8'));var client=jayson[_0xab9e('0x9')][_0xab9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11fba3,_0x15110c,_0x53930d){return new BPromise(function(_0x348b3a,_0x45f8c4){return client['request'](_0x11fba3,_0x53930d)[_0xab9e('0xb')](function(_0x42400d){logger[_0xab9e('0xc')](_0xab9e('0xd'),_0x15110c,'request\x20sent');logger['debug'](_0xab9e('0xe'),_0x15110c,'request\x20sent',JSON[_0xab9e('0xf')](_0x42400d));if(_0x42400d[_0xab9e('0x10')]){if(_0x42400d[_0xab9e('0x10')][_0xab9e('0x11')]===0x1f4){logger[_0xab9e('0x10')](_0xab9e('0xd'),_0x15110c,_0x42400d['error'][_0xab9e('0x12')]);return _0x45f8c4(_0x42400d[_0xab9e('0x10')][_0xab9e('0x12')]);}logger[_0xab9e('0x10')]('ZendeskField,\x20%s,\x20%s',_0x15110c,_0x42400d['error'][_0xab9e('0x12')]);return _0x348b3a(_0x42400d[_0xab9e('0x10')][_0xab9e('0x12')]);}else{logger[_0xab9e('0xc')](_0xab9e('0xd'),_0x15110c,'request\x20sent');_0x348b3a(_0x42400d['result'][_0xab9e('0x12')]);}})[_0xab9e('0x13')](function(_0xb2a485){logger['error'](_0xab9e('0xd'),_0x15110c,_0xb2a485);_0x45f8c4(_0xb2a485);});});}