mirror of
https://github.com/believethehype/nostrdvm.git
synced 2025-05-24 17:20:03 +02:00
stricter checks for subscription
This commit is contained in:
parent
f3a6a7caf0
commit
565526145a
@ -383,6 +383,9 @@ class Subscription:
|
|||||||
|
|
||||||
async def handle_subscription_renewal(subscription):
|
async def handle_subscription_renewal(subscription):
|
||||||
zaps = json.loads(subscription.zaps)
|
zaps = json.loads(subscription.zaps)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
success = await pay_zap_split(subscription.nwc, subscription.amount, zaps, subscription.tier,
|
success = await pay_zap_split(subscription.nwc, subscription.amount, zaps, subscription.tier,
|
||||||
subscription.unit)
|
subscription.unit)
|
||||||
if success:
|
if success:
|
||||||
@ -393,6 +396,7 @@ class Subscription:
|
|||||||
else:
|
else:
|
||||||
end = Timestamp.now().as_secs()
|
end = Timestamp.now().as_secs()
|
||||||
recipe = subscription.recipe
|
recipe = subscription.recipe
|
||||||
|
delete_from_subscription_sql_table(dvm_config.DB, subscription.id)
|
||||||
|
|
||||||
update_subscription_sql_table(dvm_config.DB, subscription.id,
|
update_subscription_sql_table(dvm_config.DB, subscription.id,
|
||||||
subscription.recipent,
|
subscription.recipent,
|
||||||
@ -421,6 +425,12 @@ class Subscription:
|
|||||||
subscriptions = get_all_subscriptions_from_sql_table(dvm_config.DB)
|
subscriptions = get_all_subscriptions_from_sql_table(dvm_config.DB)
|
||||||
|
|
||||||
for subscription in subscriptions:
|
for subscription in subscriptions:
|
||||||
|
|
||||||
|
|
||||||
|
if subscription.nwc == "":
|
||||||
|
delete_from_subscription_sql_table(dvm_config.DB, subscription.id)
|
||||||
|
|
||||||
|
|
||||||
if subscription.active:
|
if subscription.active:
|
||||||
if subscription.end < Timestamp.now().as_secs():
|
if subscription.end < Timestamp.now().as_secs():
|
||||||
# We could directly zap, but let's make another check if our subscription expired
|
# We could directly zap, but let's make another check if our subscription expired
|
||||||
|
2
setup.py
2
setup.py
@ -1,6 +1,6 @@
|
|||||||
from setuptools import setup, find_packages
|
from setuptools import setup, find_packages
|
||||||
|
|
||||||
VERSION = '0.8.17'
|
VERSION = '0.8.18'
|
||||||
DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines'
|
DESCRIPTION = 'A framework to build and run Nostr NIP90 Data Vending Machines'
|
||||||
LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information')
|
LONG_DESCRIPTION = ('A framework to build and run Nostr NIP90 Data Vending Machines. See the github repository for more information')
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user