Built motion from commit a61a4a20.|2.5.46
[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 _0xa70f=['debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateFaxApplication','options','where','attributes','limit','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s'];(function(_0x4c9c28,_0x4c6af4){var _0x58d45=function(_0x4683d2){while(--_0x4683d2){_0x4c9c28['push'](_0x4c9c28['shift']());}};_0x58d45(++_0x4c6af4);}(_0xa70f,0xb4));var _0xfa70=function(_0x336265,_0x131fc2){_0x336265=_0x336265-0x0;var _0x4b1a4b=_0xa70f[_0x336265];return _0x4b1a4b;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xfa70('0x0'));var rs=require(_0xfa70('0x1'));var fs=require('fs');var Redis=require(_0xfa70('0x2'));var db=require(_0xfa70('0x3'))['db'];var utils=require(_0xfa70('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfa70('0x5'));var client=jayson[_0xfa70('0x6')][_0xfa70('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2fd406,_0xae7c5,_0x527aa1){return new BPromise(function(_0x5c5bb4,_0x46fbac){return client[_0xfa70('0x8')](_0x2fd406,_0x527aa1)[_0xfa70('0x9')](function(_0x210a44){logger[_0xfa70('0xa')](_0xfa70('0xb'),_0xae7c5,'request\x20sent');logger[_0xfa70('0xc')](_0xfa70('0xd'),_0xae7c5,'request\x20sent',JSON['stringify'](_0x210a44));if(_0x210a44[_0xfa70('0xe')]){if(_0x210a44['error'][_0xfa70('0xf')]===0x1f4){logger[_0xfa70('0xe')](_0xfa70('0xb'),_0xae7c5,_0x210a44[_0xfa70('0xe')][_0xfa70('0x10')]);return _0x46fbac(_0x210a44[_0xfa70('0xe')][_0xfa70('0x10')]);}logger[_0xfa70('0xe')](_0xfa70('0xb'),_0xae7c5,_0x210a44['error'][_0xfa70('0x10')]);return _0x5c5bb4(_0x210a44[_0xfa70('0xe')]['message']);}else{logger[_0xfa70('0xa')](_0xfa70('0xb'),_0xae7c5,'request\x20sent');_0x5c5bb4(_0x210a44[_0xfa70('0x11')][_0xfa70('0x10')]);}})[_0xfa70('0x12')](function(_0x3b4496){logger[_0xfa70('0xe')](_0xfa70('0xb'),_0xae7c5,_0x3b4496);_0x46fbac(_0x3b4496);});});}exports[_0xfa70('0x13')]=function(_0x1f6660){var _0x5baa43=this;return new Promise(function(_0x55e2ef,_0x1da480){return db['FaxApplication']['update'](_0x1f6660['body'],{'raw':_0x1f6660[_0xfa70('0x14')]?_0x1f6660[_0xfa70('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f6660[_0xfa70('0x14')]?_0x1f6660[_0xfa70('0x14')][_0xfa70('0x15')]||null:null,'attributes':_0x1f6660[_0xfa70('0x14')]?_0x1f6660[_0xfa70('0x14')][_0xfa70('0x16')]||null:null,'limit':_0x1f6660[_0xfa70('0x14')]?_0x1f6660[_0xfa70('0x14')][_0xfa70('0x17')]||null:null})['then'](function(_0x123c30){logger[_0xfa70('0xa')]('UpdateFaxApplication',_0x1f6660);logger[_0xfa70('0xc')](_0xfa70('0x13'),_0x1f6660,JSON['stringify'](_0x123c30));_0x55e2ef(_0x123c30);})[_0xfa70('0x12')](function(_0x4c836c){logger['error'](_0xfa70('0x13'),_0x4c836c[_0xfa70('0x10')],_0x1f6660);_0x1da480(_0x5baa43[_0xfa70('0xe')](0x1f4,_0x4c836c[_0xfa70('0x10')]));});});};