Built motion from commit 85328c08.|2.5.50
[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 _0x3e06=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','raw','where','attributes','limit','stringify','lodash','util'];(function(_0x4788fa,_0xd6c28e){var _0x835143=function(_0x266968){while(--_0x266968){_0x4788fa['push'](_0x4788fa['shift']());}};_0x835143(++_0xd6c28e);}(_0x3e06,0x153));var _0x63e0=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3e06[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x63e0('0x0'));var util=require(_0x63e0('0x1'));var moment=require(_0x63e0('0x2'));var BPromise=require(_0x63e0('0x3'));var rs=require(_0x63e0('0x4'));var fs=require('fs');var Redis=require(_0x63e0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x63e0('0x6'));var logger=require(_0x63e0('0x7'))(_0x63e0('0x8'));var config=require(_0x63e0('0x9'));var jayson=require(_0x63e0('0xa'));var client=jayson['client'][_0x63e0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x467e91,_0xa6ae91,_0x29ad2e){return new BPromise(function(_0x20ba81,_0x2482fb){return client[_0x63e0('0xc')](_0x467e91,_0x29ad2e)[_0x63e0('0xd')](function(_0x4a7bf2){logger[_0x63e0('0xe')]('FaxApplication,\x20%s,\x20%s',_0xa6ae91,_0x63e0('0xf'));logger[_0x63e0('0x10')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0xa6ae91,_0x63e0('0xf'),JSON['stringify'](_0x4a7bf2));if(_0x4a7bf2['error']){if(_0x4a7bf2[_0x63e0('0x11')]['code']===0x1f4){logger[_0x63e0('0x11')](_0x63e0('0x12'),_0xa6ae91,_0x4a7bf2['error'][_0x63e0('0x13')]);return _0x2482fb(_0x4a7bf2[_0x63e0('0x11')]['message']);}logger[_0x63e0('0x11')](_0x63e0('0x12'),_0xa6ae91,_0x4a7bf2['error'][_0x63e0('0x13')]);return _0x20ba81(_0x4a7bf2[_0x63e0('0x11')][_0x63e0('0x13')]);}else{logger[_0x63e0('0xe')](_0x63e0('0x12'),_0xa6ae91,_0x63e0('0xf'));_0x20ba81(_0x4a7bf2[_0x63e0('0x14')]['message']);}})[_0x63e0('0x15')](function(_0x4f0831){logger[_0x63e0('0x11')]('FaxApplication,\x20%s,\x20%s',_0xa6ae91,_0x4f0831);_0x2482fb(_0x4f0831);});});}exports[_0x63e0('0x16')]=function(_0x5b10bf){var _0x892942=this;return new Promise(function(_0x2a9400,_0x195911){return db[_0x63e0('0x17')]['update'](_0x5b10bf[_0x63e0('0x18')],{'raw':_0x5b10bf[_0x63e0('0x19')]?_0x5b10bf[_0x63e0('0x19')][_0x63e0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b10bf[_0x63e0('0x19')]?_0x5b10bf[_0x63e0('0x19')][_0x63e0('0x1b')]||null:null,'attributes':_0x5b10bf[_0x63e0('0x19')]?_0x5b10bf[_0x63e0('0x19')][_0x63e0('0x1c')]||null:null,'limit':_0x5b10bf[_0x63e0('0x19')]?_0x5b10bf[_0x63e0('0x19')][_0x63e0('0x1d')]||null:null})[_0x63e0('0xd')](function(_0x4b9518){logger[_0x63e0('0xe')](_0x63e0('0x16'),_0x5b10bf);logger['debug'](_0x63e0('0x16'),_0x5b10bf,JSON[_0x63e0('0x1e')](_0x4b9518));_0x2a9400(_0x4b9518);})['catch'](function(_0x4aeb3a){logger[_0x63e0('0x11')]('UpdateFaxApplication',_0x4aeb3a[_0x63e0('0x13')],_0x5b10bf);_0x195911(_0x892942[_0x63e0('0x11')](0x1f4,_0x4aeb3a[_0x63e0('0x13')]));});});};