Built motion from commit 26d08302.|2.6.31
[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 _0x5203=['result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5203,0x174));var _0x3520=function(_0x4ee473,_0x34b44b){_0x4ee473=_0x4ee473-0x0;var _0x24f8c9=_0x5203[_0x4ee473];return _0x24f8c9;};'use strict';var _=require(_0x3520('0x0'));var util=require('util');var moment=require(_0x3520('0x1'));var BPromise=require('bluebird');var rs=require(_0x3520('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3520('0x3'))['db'];var utils=require(_0x3520('0x4'));var logger=require(_0x3520('0x5'))(_0x3520('0x6'));var config=require(_0x3520('0x7'));var jayson=require(_0x3520('0x8'));var client=jayson['client'][_0x3520('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd224b5,_0x117000,_0xff3301){return new BPromise(function(_0x44d99a,_0x1e9bfb){return client[_0x3520('0xa')](_0xd224b5,_0xff3301)['then'](function(_0x2129a5){logger['info'](_0x3520('0xb'),_0x117000,_0x3520('0xc'));logger[_0x3520('0xd')](_0x3520('0xe'),_0x117000,_0x3520('0xc'),JSON[_0x3520('0xf')](_0x2129a5));if(_0x2129a5[_0x3520('0x10')]){if(_0x2129a5[_0x3520('0x10')][_0x3520('0x11')]===0x1f4){logger['error'](_0x3520('0xb'),_0x117000,_0x2129a5['error'][_0x3520('0x12')]);return _0x1e9bfb(_0x2129a5['error'][_0x3520('0x12')]);}logger[_0x3520('0x10')](_0x3520('0xb'),_0x117000,_0x2129a5['error']['message']);return _0x44d99a(_0x2129a5[_0x3520('0x10')][_0x3520('0x12')]);}else{logger[_0x3520('0x13')](_0x3520('0xb'),_0x117000,_0x3520('0xc'));_0x44d99a(_0x2129a5[_0x3520('0x14')][_0x3520('0x12')]);}})[_0x3520('0x15')](function(_0x1dd640){logger[_0x3520('0x10')](_0x3520('0xb'),_0x117000,_0x1dd640);_0x1e9bfb(_0x1dd640);});});}exports[_0x3520('0x16')]=function(_0x10e4d8){var _0x5e3be1=this;return new Promise(function(_0x2e2205,_0x240827){return db[_0x3520('0x17')]['update'](_0x10e4d8[_0x3520('0x18')],{'raw':_0x10e4d8[_0x3520('0x19')]?_0x10e4d8[_0x3520('0x19')][_0x3520('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x10e4d8[_0x3520('0x19')]?_0x10e4d8[_0x3520('0x19')][_0x3520('0x1b')]||null:null,'attributes':_0x10e4d8[_0x3520('0x19')]?_0x10e4d8[_0x3520('0x19')]['attributes']||null:null,'limit':_0x10e4d8[_0x3520('0x19')]?_0x10e4d8[_0x3520('0x19')]['limit']||null:null})['then'](function(_0x305048){logger[_0x3520('0x13')](_0x3520('0x16'),_0x10e4d8);logger[_0x3520('0xd')](_0x3520('0x16'),_0x10e4d8,JSON['stringify'](_0x305048));_0x2e2205(_0x305048);})[_0x3520('0x15')](function(_0x851b18){logger[_0x3520('0x10')](_0x3520('0x16'),_0x851b18[_0x3520('0x12')],_0x10e4d8);_0x240827(_0x5e3be1['error'](0x1f4,_0x851b18[_0x3520('0x12')]));});});};