62d20f88db380e1207cece639e23c285ba20470a
[motion2.git] / server / api / userMailQueue / userMailQueue.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 _0x8e20=['jayson/promise','http','request','then','UserMailQueue,\x20%s,\x20%s','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5001fc,_0x45116f){var _0x27682e=function(_0x5a9e38){while(--_0x5a9e38){_0x5001fc['push'](_0x5001fc['shift']());}};_0x27682e(++_0x45116f);}(_0x8e20,0x1af));var _0x08e2=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0x8e20[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require(_0x08e2('0x0'));var util=require(_0x08e2('0x1'));var moment=require(_0x08e2('0x2'));var BPromise=require('bluebird');var rs=require(_0x08e2('0x3'));var fs=require('fs');var Redis=require(_0x08e2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x08e2('0x5'));var logger=require(_0x08e2('0x6'))(_0x08e2('0x7'));var config=require(_0x08e2('0x8'));var jayson=require(_0x08e2('0x9'));var client=jayson['client'][_0x08e2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x427444,_0x5e5a52,_0x24af30){return new BPromise(function(_0x38a4f4,_0x31d86b){return client[_0x08e2('0xb')](_0x427444,_0x24af30)[_0x08e2('0xc')](function(_0x168bc0){logger['info'](_0x08e2('0xd'),_0x5e5a52,'request\x20sent');logger['debug'](_0x08e2('0xe'),_0x5e5a52,_0x08e2('0xf'),JSON[_0x08e2('0x10')](_0x168bc0));if(_0x168bc0[_0x08e2('0x11')]){if(_0x168bc0['error']['code']===0x1f4){logger[_0x08e2('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x5e5a52,_0x168bc0['error'][_0x08e2('0x12')]);return _0x31d86b(_0x168bc0['error'][_0x08e2('0x12')]);}logger['error'](_0x08e2('0xd'),_0x5e5a52,_0x168bc0['error']['message']);return _0x38a4f4(_0x168bc0['error'][_0x08e2('0x12')]);}else{logger[_0x08e2('0x13')](_0x08e2('0xd'),_0x5e5a52,'request\x20sent');_0x38a4f4(_0x168bc0['result']['message']);}})['catch'](function(_0x509f23){logger['error'](_0x08e2('0xd'),_0x5e5a52,_0x509f23);_0x31d86b(_0x509f23);});});}