Built motion from commit ce03bc3d.|2.5.39
[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 _0x3769=['raw','where','attributes','limit','UpdateFaxApplication','debug','stringify','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','message','info','result','FaxApplication','update','body','options'];(function(_0x582f72,_0x886d8){var _0x4cd5fe=function(_0x4ac1c7){while(--_0x4ac1c7){_0x582f72['push'](_0x582f72['shift']());}};_0x4cd5fe(++_0x886d8);}(_0x3769,0x15c));var _0x9376=function(_0x27abe3,_0x26bac1){_0x27abe3=_0x27abe3-0x0;var _0x1738d9=_0x3769[_0x27abe3];return _0x1738d9;};'use strict';var _=require(_0x9376('0x0'));var util=require('util');var moment=require(_0x9376('0x1'));var BPromise=require(_0x9376('0x2'));var rs=require(_0x9376('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9376('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9376('0x5'))(_0x9376('0x6'));var config=require(_0x9376('0x7'));var jayson=require(_0x9376('0x8'));var client=jayson[_0x9376('0x9')][_0x9376('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fb666,_0x489455,_0x46c3bd){return new BPromise(function(_0x236aeb,_0x170d15){return client[_0x9376('0xb')](_0x2fb666,_0x46c3bd)[_0x9376('0xc')](function(_0x3a60b8){logger['info'](_0x9376('0xd'),_0x489455,_0x9376('0xe'));logger['debug'](_0x9376('0xf'),_0x489455,_0x9376('0xe'),JSON['stringify'](_0x3a60b8));if(_0x3a60b8['error']){if(_0x3a60b8[_0x9376('0x10')]['code']===0x1f4){logger[_0x9376('0x10')](_0x9376('0xd'),_0x489455,_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);return _0x170d15(_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);}logger[_0x9376('0x10')](_0x9376('0xd'),_0x489455,_0x3a60b8[_0x9376('0x10')][_0x9376('0x11')]);return _0x236aeb(_0x3a60b8[_0x9376('0x10')]['message']);}else{logger[_0x9376('0x12')]('FaxApplication,\x20%s,\x20%s',_0x489455,_0x9376('0xe'));_0x236aeb(_0x3a60b8[_0x9376('0x13')][_0x9376('0x11')]);}})['catch'](function(_0x34fced){logger[_0x9376('0x10')]('FaxApplication,\x20%s,\x20%s',_0x489455,_0x34fced);_0x170d15(_0x34fced);});});}exports['UpdateFaxApplication']=function(_0x5d85e9){var _0x4634d7=this;return new Promise(function(_0x57c6fd,_0x25ed5a){return db[_0x9376('0x14')][_0x9376('0x15')](_0x5d85e9[_0x9376('0x16')],{'raw':_0x5d85e9[_0x9376('0x17')]?_0x5d85e9[_0x9376('0x17')][_0x9376('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d85e9[_0x9376('0x17')]?_0x5d85e9['options'][_0x9376('0x19')]||null:null,'attributes':_0x5d85e9[_0x9376('0x17')]?_0x5d85e9[_0x9376('0x17')][_0x9376('0x1a')]||null:null,'limit':_0x5d85e9[_0x9376('0x17')]?_0x5d85e9['options'][_0x9376('0x1b')]||null:null})['then'](function(_0xc11107){logger['info'](_0x9376('0x1c'),_0x5d85e9);logger[_0x9376('0x1d')](_0x9376('0x1c'),_0x5d85e9,JSON[_0x9376('0x1e')](_0xc11107));_0x57c6fd(_0xc11107);})['catch'](function(_0x10a1a0){logger['error'](_0x9376('0x1c'),_0x10a1a0['message'],_0x5d85e9);_0x25ed5a(_0x4634d7[_0x9376('0x10')](0x1f4,_0x10a1a0['message']));});});};