d04af6787ae88993b2b816d3c068796e5237209a
[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 _0xe84a=['code','error','message','catch','body','options','raw','where','limit','then','UpdateFaxApplication','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FaxApplication,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x36d301,_0x22d467){var _0x1ac8d2=function(_0x46a670){while(--_0x46a670){_0x36d301['push'](_0x36d301['shift']());}};_0x1ac8d2(++_0x22d467);}(_0xe84a,0x97));var _0xae84=function(_0x192bfa,_0x54901c){_0x192bfa=_0x192bfa-0x0;var _0x37f066=_0xe84a[_0x192bfa];return _0x37f066;};'use strict';var _=require(_0xae84('0x0'));var util=require(_0xae84('0x1'));var moment=require(_0xae84('0x2'));var BPromise=require(_0xae84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xae84('0x4'));var db=require(_0xae84('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xae84('0x6'))(_0xae84('0x7'));var config=require(_0xae84('0x8'));var jayson=require(_0xae84('0x9'));var client=jayson['client'][_0xae84('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x21ebf2,_0x1d3028,_0x402701){return new BPromise(function(_0x36bd5f,_0xf6d2c2){return client[_0xae84('0xb')](_0x21ebf2,_0x402701)['then'](function(_0x5261b8){logger[_0xae84('0xc')](_0xae84('0xd'),_0x1d3028,'request\x20sent');logger[_0xae84('0xe')]('FaxApplication,\x20%s,\x20%s,\x20%s',_0x1d3028,_0xae84('0xf'),JSON[_0xae84('0x10')](_0x5261b8));if(_0x5261b8['error']){if(_0x5261b8['error'][_0xae84('0x11')]===0x1f4){logger[_0xae84('0x12')](_0xae84('0xd'),_0x1d3028,_0x5261b8[_0xae84('0x12')][_0xae84('0x13')]);return _0xf6d2c2(_0x5261b8[_0xae84('0x12')][_0xae84('0x13')]);}logger[_0xae84('0x12')](_0xae84('0xd'),_0x1d3028,_0x5261b8[_0xae84('0x12')]['message']);return _0x36bd5f(_0x5261b8['error'][_0xae84('0x13')]);}else{logger[_0xae84('0xc')](_0xae84('0xd'),_0x1d3028,_0xae84('0xf'));_0x36bd5f(_0x5261b8['result']['message']);}})[_0xae84('0x14')](function(_0x11329b){logger[_0xae84('0x12')](_0xae84('0xd'),_0x1d3028,_0x11329b);_0xf6d2c2(_0x11329b);});});}exports['UpdateFaxApplication']=function(_0x32eb37){var _0x52ec2b=this;return new Promise(function(_0x52803a,_0x1050e5){return db['FaxApplication']['update'](_0x32eb37[_0xae84('0x15')],{'raw':_0x32eb37[_0xae84('0x16')]?_0x32eb37[_0xae84('0x16')][_0xae84('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x32eb37[_0xae84('0x16')]?_0x32eb37['options'][_0xae84('0x18')]||null:null,'attributes':_0x32eb37[_0xae84('0x16')]?_0x32eb37[_0xae84('0x16')]['attributes']||null:null,'limit':_0x32eb37[_0xae84('0x16')]?_0x32eb37[_0xae84('0x16')][_0xae84('0x19')]||null:null})[_0xae84('0x1a')](function(_0x555915){logger['info'](_0xae84('0x1b'),_0x32eb37);logger[_0xae84('0xe')](_0xae84('0x1b'),_0x32eb37,JSON[_0xae84('0x10')](_0x555915));_0x52803a(_0x555915);})[_0xae84('0x14')](function(_0x185ee5){logger[_0xae84('0x12')]('UpdateFaxApplication',_0x185ee5['message'],_0x32eb37);_0x1050e5(_0x52ec2b[_0xae84('0x12')](0x1f4,_0x185ee5['message']));});});};