Built motion from commit (unavailable).|2.5.26
[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 _0xa3c0=['then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','catch','UpdateFaxApplication','FaxApplication','options','where','attributes','limit','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x559ac2,_0x3da489){var _0xc3e79d=function(_0x121c3c){while(--_0x121c3c){_0x559ac2['push'](_0x559ac2['shift']());}};_0xc3e79d(++_0x3da489);}(_0xa3c0,0xc5));var _0x0a3c=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa3c0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a3c('0x0'));var util=require(_0x0a3c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0a3c('0x2'));var fs=require('fs');var Redis=require(_0x0a3c('0x3'));var db=require(_0x0a3c('0x4'))['db'];var utils=require(_0x0a3c('0x5'));var logger=require(_0x0a3c('0x6'))(_0x0a3c('0x7'));var config=require(_0x0a3c('0x8'));var jayson=require(_0x0a3c('0x9'));var client=jayson[_0x0a3c('0xa')][_0x0a3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1dc6c4,_0x422683,_0x2216d6){return new BPromise(function(_0x163799,_0x5d36a6){return client[_0x0a3c('0xc')](_0x1dc6c4,_0x2216d6)[_0x0a3c('0xd')](function(_0x16a816){logger['info'](_0x0a3c('0xe'),_0x422683,_0x0a3c('0xf'));logger[_0x0a3c('0x10')](_0x0a3c('0x11'),_0x422683,_0x0a3c('0xf'),JSON[_0x0a3c('0x12')](_0x16a816));if(_0x16a816['error']){if(_0x16a816['error'][_0x0a3c('0x13')]===0x1f4){logger[_0x0a3c('0x14')](_0x0a3c('0xe'),_0x422683,_0x16a816[_0x0a3c('0x14')][_0x0a3c('0x15')]);return _0x5d36a6(_0x16a816[_0x0a3c('0x14')][_0x0a3c('0x15')]);}logger[_0x0a3c('0x14')](_0x0a3c('0xe'),_0x422683,_0x16a816[_0x0a3c('0x14')][_0x0a3c('0x15')]);return _0x163799(_0x16a816[_0x0a3c('0x14')][_0x0a3c('0x15')]);}else{logger[_0x0a3c('0x16')]('FaxApplication,\x20%s,\x20%s',_0x422683,_0x0a3c('0xf'));_0x163799(_0x16a816['result'][_0x0a3c('0x15')]);}})[_0x0a3c('0x17')](function(_0x275e1b){logger[_0x0a3c('0x14')](_0x0a3c('0xe'),_0x422683,_0x275e1b);_0x5d36a6(_0x275e1b);});});}exports[_0x0a3c('0x18')]=function(_0x193851){var _0x2c7b24=this;return new Promise(function(_0x1b2734,_0x34f31b){return db[_0x0a3c('0x19')]['update'](_0x193851['body'],{'raw':_0x193851[_0x0a3c('0x1a')]?_0x193851['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x193851[_0x0a3c('0x1a')]?_0x193851[_0x0a3c('0x1a')][_0x0a3c('0x1b')]||null:null,'attributes':_0x193851[_0x0a3c('0x1a')]?_0x193851[_0x0a3c('0x1a')][_0x0a3c('0x1c')]||null:null,'limit':_0x193851[_0x0a3c('0x1a')]?_0x193851[_0x0a3c('0x1a')][_0x0a3c('0x1d')]||null:null})['then'](function(_0xbe9834){logger['info'](_0x0a3c('0x18'),_0x193851);logger['debug'](_0x0a3c('0x18'),_0x193851,JSON['stringify'](_0xbe9834));_0x1b2734(_0xbe9834);})[_0x0a3c('0x17')](function(_0x509e80){logger[_0x0a3c('0x14')](_0x0a3c('0x18'),_0x509e80[_0x0a3c('0x15')],_0x193851);_0x34f31b(_0x2c7b24['error'](0x1f4,_0x509e80[_0x0a3c('0x15')]));});});};