commit 22c03559b1b2ecd81f1e54dc7117f700505fc2f7
parent ba3a39cda360ae0b69015203a2fda7b3b2c967ea
Author: NicholasFarrow <nicholas.w.farrow@gmail.com>
Date: Sat, 26 Dec 2020 19:10:43 +1100
Improved qr code saving
Diffstat:
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/invoice/payment_invoice.py b/invoice/payment_invoice.py
@@ -1,19 +1,25 @@
import uuid
+import qrcode
import config
from .price_feed import get_btc_value
-
class invoice:
def __init__(self, dollar_value, currency, label):
self.dollar_value = dollar_value
self.currency = currency
self.value = round(get_btc_value(dollar_value, currency), 8)
self.label = label
- self.id = str(uuid.uuid4())
+ self.uuid = str(uuid.uuid4())
self.status = 'Payment initialised.'
self.response = ''
self.time_left = config.payment_timeout
self.confirmed_paid = 0
self.unconfirmed_paid = 0
self.paid = False
+
+
+ def create_qr(self):
+ img = qrcode.make(self.address)
+ img.save('static/qr_codes/{}.png'.format(self.uuid))
+ return