39fbf626810facc01faae5f4d2ee66fd75bf3fcc
[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 _0x6e62=['rpc','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','UpdateFaxApplication','FaxApplication','body','options','raw','attributes','limit','debug','stringify','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x320243,_0x55038d){var _0x1c9c6a=function(_0x209e5e){while(--_0x209e5e){_0x320243['push'](_0x320243['shift']());}};_0x1c9c6a(++_0x55038d);}(_0x6e62,0x1ab));var _0x26e6=function(_0x355eb4,_0x54ac5a){_0x355eb4=_0x355eb4-0x0;var _0x2ff0a8=_0x6e62[_0x355eb4];return _0x2ff0a8;};'use strict';var _=require(_0x26e6('0x0'));var util=require(_0x26e6('0x1'));var moment=require(_0x26e6('0x2'));var BPromise=require(_0x26e6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26e6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x26e6('0x5'));var logger=require(_0x26e6('0x6'))(_0x26e6('0x7'));var config=require(_0x26e6('0x8'));var jayson=require(_0x26e6('0x9'));var client=jayson[_0x26e6('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x369475,_0x26cd06,_0x42af41){return new BPromise(function(_0x2ba161,_0x5b083c){return client[_0x26e6('0xb')](_0x369475,_0x42af41)[_0x26e6('0xc')](function(_0x5f1b66){logger[_0x26e6('0xd')](_0x26e6('0xe'),_0x26cd06,_0x26e6('0xf'));logger['debug'](_0x26e6('0x10'),_0x26cd06,_0x26e6('0xf'),JSON['stringify'](_0x5f1b66));if(_0x5f1b66[_0x26e6('0x11')]){if(_0x5f1b66[_0x26e6('0x11')][_0x26e6('0x12')]===0x1f4){logger[_0x26e6('0x11')](_0x26e6('0xe'),_0x26cd06,_0x5f1b66[_0x26e6('0x11')]['message']);return _0x5b083c(_0x5f1b66[_0x26e6('0x11')][_0x26e6('0x13')]);}logger[_0x26e6('0x11')](_0x26e6('0xe'),_0x26cd06,_0x5f1b66[_0x26e6('0x11')][_0x26e6('0x13')]);return _0x2ba161(_0x5f1b66[_0x26e6('0x11')][_0x26e6('0x13')]);}else{logger[_0x26e6('0xd')](_0x26e6('0xe'),_0x26cd06,_0x26e6('0xf'));_0x2ba161(_0x5f1b66[_0x26e6('0x14')][_0x26e6('0x13')]);}})['catch'](function(_0x4cd96f){logger[_0x26e6('0x11')]('FaxApplication,\x20%s,\x20%s',_0x26cd06,_0x4cd96f);_0x5b083c(_0x4cd96f);});});}exports[_0x26e6('0x15')]=function(_0x5927c2){var _0x1a4b17=this;return new Promise(function(_0x2f720d,_0x14e411){return db[_0x26e6('0x16')]['update'](_0x5927c2[_0x26e6('0x17')],{'raw':_0x5927c2[_0x26e6('0x18')]?_0x5927c2[_0x26e6('0x18')][_0x26e6('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5927c2['options']?_0x5927c2[_0x26e6('0x18')]['where']||null:null,'attributes':_0x5927c2[_0x26e6('0x18')]?_0x5927c2[_0x26e6('0x18')][_0x26e6('0x1a')]||null:null,'limit':_0x5927c2['options']?_0x5927c2[_0x26e6('0x18')][_0x26e6('0x1b')]||null:null})[_0x26e6('0xc')](function(_0x3a3023){logger[_0x26e6('0xd')](_0x26e6('0x15'),_0x5927c2);logger[_0x26e6('0x1c')]('UpdateFaxApplication',_0x5927c2,JSON[_0x26e6('0x1d')](_0x3a3023));_0x2f720d(_0x3a3023);})[_0x26e6('0x1e')](function(_0x51af67){logger['error'](_0x26e6('0x15'),_0x51af67['message'],_0x5927c2);_0x14e411(_0x1a4b17[_0x26e6('0x11')](0x1f4,_0x51af67[_0x26e6('0x13')]));});});};