6ad7da67a25cd9a458186f62f2ae44f1980a937c
[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 _0xc9e1=['code','message','result','catch','UpdateFaxApplication','FaxApplication','body','options','where','limit','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x1a51db,_0x2eecdc){var _0xea0473=function(_0x54b391){while(--_0x54b391){_0x1a51db['push'](_0x1a51db['shift']());}};_0xea0473(++_0x2eecdc);}(_0xc9e1,0x1cb));var _0x1c9e=function(_0x2c4a16,_0x47f017){_0x2c4a16=_0x2c4a16-0x0;var _0x36b838=_0xc9e1[_0x2c4a16];return _0x36b838;};'use strict';var _=require(_0x1c9e('0x0'));var util=require(_0x1c9e('0x1'));var moment=require(_0x1c9e('0x2'));var BPromise=require(_0x1c9e('0x3'));var rs=require(_0x1c9e('0x4'));var fs=require('fs');var Redis=require(_0x1c9e('0x5'));var db=require(_0x1c9e('0x6'))['db'];var utils=require(_0x1c9e('0x7'));var logger=require('../../config/logger')(_0x1c9e('0x8'));var config=require(_0x1c9e('0x9'));var jayson=require(_0x1c9e('0xa'));var client=jayson[_0x1c9e('0xb')][_0x1c9e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x192fa5,_0x5ed43d,_0x16db80){return new BPromise(function(_0x3430e2,_0x278783){return client[_0x1c9e('0xd')](_0x192fa5,_0x16db80)[_0x1c9e('0xe')](function(_0x1acc25){logger[_0x1c9e('0xf')](_0x1c9e('0x10'),_0x5ed43d,_0x1c9e('0x11'));logger['debug'](_0x1c9e('0x12'),_0x5ed43d,'request\x20sent',JSON[_0x1c9e('0x13')](_0x1acc25));if(_0x1acc25[_0x1c9e('0x14')]){if(_0x1acc25[_0x1c9e('0x14')][_0x1c9e('0x15')]===0x1f4){logger['error'](_0x1c9e('0x10'),_0x5ed43d,_0x1acc25['error']['message']);return _0x278783(_0x1acc25['error'][_0x1c9e('0x16')]);}logger[_0x1c9e('0x14')](_0x1c9e('0x10'),_0x5ed43d,_0x1acc25['error']['message']);return _0x3430e2(_0x1acc25['error']['message']);}else{logger[_0x1c9e('0xf')](_0x1c9e('0x10'),_0x5ed43d,_0x1c9e('0x11'));_0x3430e2(_0x1acc25[_0x1c9e('0x17')]['message']);}})[_0x1c9e('0x18')](function(_0x1443b2){logger[_0x1c9e('0x14')](_0x1c9e('0x10'),_0x5ed43d,_0x1443b2);_0x278783(_0x1443b2);});});}exports[_0x1c9e('0x19')]=function(_0x3b6f2d){var _0x363563=this;return new Promise(function(_0x4ab3a4,_0xf02070){return db[_0x1c9e('0x1a')]['update'](_0x3b6f2d[_0x1c9e('0x1b')],{'raw':_0x3b6f2d['options']?_0x3b6f2d['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6f2d[_0x1c9e('0x1c')]?_0x3b6f2d[_0x1c9e('0x1c')][_0x1c9e('0x1d')]||null:null,'attributes':_0x3b6f2d['options']?_0x3b6f2d[_0x1c9e('0x1c')]['attributes']||null:null,'limit':_0x3b6f2d[_0x1c9e('0x1c')]?_0x3b6f2d[_0x1c9e('0x1c')][_0x1c9e('0x1e')]||null:null})[_0x1c9e('0xe')](function(_0x3879d5){logger['info']('UpdateFaxApplication',_0x3b6f2d);logger[_0x1c9e('0x1f')](_0x1c9e('0x19'),_0x3b6f2d,JSON[_0x1c9e('0x13')](_0x3879d5));_0x4ab3a4(_0x3879d5);})[_0x1c9e('0x18')](function(_0x1eac5e){logger[_0x1c9e('0x14')](_0x1c9e('0x19'),_0x1eac5e['message'],_0x3b6f2d);_0xf02070(_0x363563['error'](0x1f4,_0x1eac5e[_0x1c9e('0x16')]));});});};