03488d66bcf5ba3e69b976562b7ce2e48eb56afb
[motion2.git] / server / api / faxApplication / faxApplication.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 _0x8585=['request','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','attributes','limit','then','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','http'];(function(_0xb2f3e5,_0x1650af){var _0x1900e2=function(_0x49b560){while(--_0x49b560){_0xb2f3e5['push'](_0xb2f3e5['shift']());}};_0x1900e2(++_0x1650af);}(_0x8585,0x64));var _0x5858=function(_0x7edec1,_0x31f0f0){_0x7edec1=_0x7edec1-0x0;var _0x4c58c0=_0x8585[_0x7edec1];return _0x4c58c0;};'use strict';var _=require(_0x5858('0x0'));var util=require(_0x5858('0x1'));var moment=require(_0x5858('0x2'));var BPromise=require('bluebird');var rs=require(_0x5858('0x3'));var fs=require('fs');var Redis=require(_0x5858('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5858('0x5'));var config=require(_0x5858('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5858('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d26d1,_0x3fd63f,_0x5c8e94){return new BPromise(function(_0x4d5efe,_0x46f019){return client[_0x5858('0x8')](_0x1d26d1,_0x5c8e94)['then'](function(_0x490bce){logger[_0x5858('0x9')](_0x5858('0xa'),_0x3fd63f,'request\x20sent');logger[_0x5858('0xb')](_0x5858('0xc'),_0x3fd63f,_0x5858('0xd'),JSON[_0x5858('0xe')](_0x490bce));if(_0x490bce[_0x5858('0xf')]){if(_0x490bce[_0x5858('0xf')][_0x5858('0x10')]===0x1f4){logger[_0x5858('0xf')](_0x5858('0xa'),_0x3fd63f,_0x490bce['error'][_0x5858('0x11')]);return _0x46f019(_0x490bce[_0x5858('0xf')][_0x5858('0x11')]);}logger['error'](_0x5858('0xa'),_0x3fd63f,_0x490bce[_0x5858('0xf')][_0x5858('0x11')]);return _0x4d5efe(_0x490bce[_0x5858('0xf')][_0x5858('0x11')]);}else{logger[_0x5858('0x9')](_0x5858('0xa'),_0x3fd63f,_0x5858('0xd'));_0x4d5efe(_0x490bce[_0x5858('0x12')][_0x5858('0x11')]);}})[_0x5858('0x13')](function(_0x310e4c){logger[_0x5858('0xf')](_0x5858('0xa'),_0x3fd63f,_0x310e4c);_0x46f019(_0x310e4c);});});}exports[_0x5858('0x14')]=function(_0x46d6ae){var _0x5d9768=this;return new Promise(function(_0x18100f,_0x461e6f){return db[_0x5858('0x15')]['update'](_0x46d6ae[_0x5858('0x16')],{'raw':_0x46d6ae[_0x5858('0x17')]?_0x46d6ae[_0x5858('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46d6ae[_0x5858('0x17')]?_0x46d6ae[_0x5858('0x17')]['where']||null:null,'attributes':_0x46d6ae[_0x5858('0x17')]?_0x46d6ae[_0x5858('0x17')][_0x5858('0x18')]||null:null,'limit':_0x46d6ae[_0x5858('0x17')]?_0x46d6ae[_0x5858('0x17')][_0x5858('0x19')]||null:null})[_0x5858('0x1a')](function(_0x24ae6c){logger[_0x5858('0x9')]('UpdateFaxApplication',_0x46d6ae);logger[_0x5858('0xb')](_0x5858('0x14'),_0x46d6ae,JSON[_0x5858('0xe')](_0x24ae6c));_0x18100f(_0x24ae6c);})[_0x5858('0x13')](function(_0x4c957f){logger['error'](_0x5858('0x14'),_0x4c957f[_0x5858('0x11')],_0x46d6ae);_0x461e6f(_0x5d9768['error'](0x1f4,_0x4c957f['message']));});});};