refactor buyer refunds
parent
e13d551824
commit
fd5608d418
@ -1,12 +1,20 @@
|
|||||||
import logging
|
from logging import getLogger
|
||||||
from huey import crontab
|
from huey import crontab
|
||||||
from huey.contrib.djhuey import periodic_task
|
from huey.contrib.djhuey import periodic_task
|
||||||
|
from sales.models import ItemSale
|
||||||
|
|
||||||
logger = logging.getLogger('django.server')
|
logger = getLogger('django.server')
|
||||||
|
|
||||||
@periodic_task(crontab(minute='0', hour='*/12'))
|
@periodic_task(crontab(minute='0', hour='*/12'))
|
||||||
def close_completed_items_sales():
|
def close_completed_item_sales():
|
||||||
item_sales = ItemSale.objects.filter(platform_paid=True, sale_finalized=True)
|
item_sales = ItemSale.objects.filter(platform_paid=True, sale_finalized=True)
|
||||||
for sale in item_sales:
|
for sale in item_sales:
|
||||||
logger.info(f'[INFO] Deleting item #{sale.item.id} and all accompanying bids, sales, meta, etc.')
|
logger.info(f'[INFO] Deleting item #{sale.item.id} and all accompanying bids, sales, meta, etc.')
|
||||||
sale.item.delete()
|
sale.item.delete()
|
||||||
|
|
||||||
|
@periodic_task(crontab(minute='*'))
|
||||||
|
def close_cancelled_item_sales():
|
||||||
|
item_sales = ItemSale.objects.filter(sale_cancelled=True, payment_refunded=True)
|
||||||
|
for sale in item_sales:
|
||||||
|
logger.info(f'[INFO] Deleting sale #{sale.id}.')
|
||||||
|
sale.delete()
|
Reference in New Issue