24097a809c0ceedc29a7b413a28d20b77522cbb0
[motion2.git] / server / api / intDeskField / intDeskField.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 _0x7158=['error','message','catch','util','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x403a1c,_0x3ba1ce){var _0x3f1045=function(_0x24e33c){while(--_0x24e33c){_0x403a1c['push'](_0x403a1c['shift']());}};_0x3f1045(++_0x3ba1ce);}(_0x7158,0xf1));var _0x8715=function(_0xbb9dbf,_0x5dafa4){_0xbb9dbf=_0xbb9dbf-0x0;var _0x30223c=_0x7158[_0xbb9dbf];return _0x30223c;};'use strict';var _=require('lodash');var util=require(_0x8715('0x0'));var moment=require('moment');var BPromise=require(_0x8715('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8715('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x8715('0x3'))(_0x8715('0x4'));var config=require('../../config/environment');var jayson=require(_0x8715('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x32f78e,_0x4ae5a8,_0x35ea21){return new BPromise(function(_0x59725a,_0xb8c1e6){return client['request'](_0x32f78e,_0x35ea21)['then'](function(_0x32c563){logger[_0x8715('0x6')](_0x8715('0x7'),_0x4ae5a8,_0x8715('0x8'));logger['debug'](_0x8715('0x9'),_0x4ae5a8,_0x8715('0x8'),JSON[_0x8715('0xa')](_0x32c563));if(_0x32c563[_0x8715('0xb')]){if(_0x32c563['error']['code']===0x1f4){logger['error'](_0x8715('0x7'),_0x4ae5a8,_0x32c563[_0x8715('0xb')][_0x8715('0xc')]);return _0xb8c1e6(_0x32c563[_0x8715('0xb')][_0x8715('0xc')]);}logger[_0x8715('0xb')](_0x8715('0x7'),_0x4ae5a8,_0x32c563[_0x8715('0xb')][_0x8715('0xc')]);return _0x59725a(_0x32c563[_0x8715('0xb')]['message']);}else{logger[_0x8715('0x6')](_0x8715('0x7'),_0x4ae5a8,_0x8715('0x8'));_0x59725a(_0x32c563['result']['message']);}})[_0x8715('0xd')](function(_0x28b00c){logger[_0x8715('0xb')](_0x8715('0x7'),_0x4ae5a8,_0x28b00c);_0xb8c1e6(_0x28b00c);});});}