829f46d29c7b5ad149644789e8eef443393ec7c3
[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 _0xedb2=['jayson/promise','../../config/logger','routing','client','http','Request','then','debug','rpc','error','message','exports'];(function(_0x1319d6,_0x227e84){var _0x5c0e98=function(_0x1169de){while(--_0x1169de){_0x1319d6['push'](_0x1319d6['shift']());}};_0x5c0e98(++_0x227e84);}(_0xedb2,0x180));var _0x2edb=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xedb2[_0x5c351c];return _0x26f3b3;};'use strict';var jayson=require(_0x2edb('0x0'));var BPromise=require('bluebird');var logger=require(_0x2edb('0x1'))(_0x2edb('0x2'));var client=jayson[_0x2edb('0x3')][_0x2edb('0x4')]({'port':0x2329});client[_0x2edb('0x5')]=function(_0xc09141,_0xfd8e2c){return new BPromise(function(_0x1d3f52,_0x2c0b43){return client['request'](_0xc09141,_0xfd8e2c)[_0x2edb('0x6')](function(_0x552cf6){logger[_0x2edb('0x7')](_0x2edb('0x8'),_0x2edb('0x2'),_0xc09141,_0xfd8e2c,_0x552cf6);if(_0x552cf6[_0x2edb('0x9')]){logger[_0x2edb('0x9')](_0x2edb('0x8'),'routing',_0xc09141,_0x552cf6['error']['message'],_0xfd8e2c);return _0x2c0b43(_0x552cf6['error'][_0x2edb('0xa')]);}else{return _0x1d3f52(_0x552cf6['result']);}})['catch'](function(_0x25acd7){logger[_0x2edb('0x9')]('rpc',_0x2edb('0x2'),_0xc09141,_0x25acd7,_0xfd8e2c);return _0x2c0b43(_0x25acd7);});});};module[_0x2edb('0xb')]=client;