From 1396ec44c95e86a3913a12cacec29552db575401 Mon Sep 17 00:00:00 2001 From: DhananjayPurohit Date: Thu, 21 Sep 2023 21:58:03 +0530 Subject: [PATCH 1/2] fix: multiple slot with a single token --- src/controllers/api_controller.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/controllers/api_controller.js b/src/controllers/api_controller.js index e0dfe0f..d933858 100644 --- a/src/controllers/api_controller.js +++ b/src/controllers/api_controller.js @@ -1289,7 +1289,7 @@ module.exports = { if (tokenDetails.amount >= FEE_RATE_PER_MONTH_IN_MSAT) { const months = tokenDetails.amount / FEE_RATE_PER_MONTH_IN_MSAT; - if (slot_id === 0) { + if (!isNaN(slot_id) && Number(slot_id) === 0) { const clientDetailsData = await create_slot_with_token(months); reply_msg(res, { auth_token: clientDetailsData.auth_token, @@ -1304,6 +1304,8 @@ module.exports = { expiry_date: clientDetailsData.expiry_date }, startTime); } + tokenDetails.amount = 0; + await tokenDetails.save(); } else { reply_err(res, 'Token contains insufficient balance', startTime); } From a808efbe1c96be365b785a3fa8b3069b85be261a Mon Sep 17 00:00:00 2001 From: DhananjayPurohit Date: Fri, 22 Sep 2023 21:37:34 +0530 Subject: [PATCH 2/2] feat: add qr code for invoice --- assets/stylesheets/styles.scss | 7 +++++++ package.json | 1 + src/view/modals/CreateSlotModal.jsx | 4 +++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/assets/stylesheets/styles.scss b/assets/stylesheets/styles.scss index cdf1687..e855548 100644 --- a/assets/stylesheets/styles.scss +++ b/assets/stylesheets/styles.scss @@ -3267,6 +3267,13 @@ div#root { font-size: 30px; } +.qr-code { + display: flex; + margin-inline: auto; + margin-bottom: 30px; + height: 160px !important; + width: 160px !important; +} @media (max-width: 575px) { .carousel-image__overlay { diff --git a/package.json b/package.json index aa16473..807eb50 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "nodemailer": "^6.3.0", "path-to-regexp": "^3.0.0", "prop-types": "^15.7.2", + "qrcode.react": "^3.1.0", "query-string": "^6.2.0", "react": "^16.8.6", "react-dom": "^16.9.0", diff --git a/src/view/modals/CreateSlotModal.jsx b/src/view/modals/CreateSlotModal.jsx index 972477e..7427d6e 100644 --- a/src/view/modals/CreateSlotModal.jsx +++ b/src/view/modals/CreateSlotModal.jsx @@ -5,6 +5,7 @@ import swal from 'sweetalert'; import {Button, Form, FormGroup, Input, Label, Modal, ModalBody, ModalFooter, ModalHeader, InputGroup, InputGroupAddon} from 'reactstrap'; import apiService from '../../helpers/api-service'; +import QRCode from "qrcode.react"; function milliSatsToSats(milliSats) { return milliSats / 1000; @@ -180,7 +181,8 @@ class CreateSlotModal extends React.PureComponent { ) : null} {this.state.invoice !== '' ? ( - + +