79a49803c1e7d54122fbe9fe06db7e6cddea48ba
[motion2.git] / server / services / email / client.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 _0xa276=['client','http','request','then','rpc','routing','error','message','result','catch','exports','bluebird','../../config/logger'];(function(_0x572f7c,_0x86f6f8){var _0x17d96b=function(_0x926745){while(--_0x926745){_0x572f7c['push'](_0x572f7c['shift']());}};_0x17d96b(++_0x86f6f8);}(_0xa276,0x9a));var _0x6a27=function(_0x56abe6,_0x3851c1){_0x56abe6=_0x56abe6-0x0;var _0xf58c82=_0xa276[_0x56abe6];return _0xf58c82;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6a27('0x0'));var logger=require(_0x6a27('0x1'))('routing');var client=jayson[_0x6a27('0x2')][_0x6a27('0x3')]({'port':0x2329});client['Request']=function(_0x15b2e6,_0x431d9c){return new BPromise(function(_0x18289f,_0x5c9089){return client[_0x6a27('0x4')](_0x15b2e6,_0x431d9c)[_0x6a27('0x5')](function(_0x41c595){logger['debug'](_0x6a27('0x6'),'routing',_0x15b2e6,_0x431d9c,_0x41c595);if(_0x41c595['error']){logger['error']('rpc',_0x6a27('0x7'),_0x15b2e6,_0x41c595[_0x6a27('0x8')][_0x6a27('0x9')],_0x431d9c);return _0x5c9089(_0x41c595['error']['message']);}else{return _0x18289f(_0x41c595[_0x6a27('0xa')]);}})[_0x6a27('0xb')](function(_0x15f5bf){logger[_0x6a27('0x8')](_0x6a27('0x6'),_0x6a27('0x7'),_0x15b2e6,_0x15f5bf,_0x431d9c);return _0x5c9089(_0x15f5bf);});});};module[_0x6a27('0xc')]=client;