You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

38 lines
1.1 KiB

from django.core.management.base import BaseCommand, CommandError
from django.utils.timezone import now
from paymentwall.pingback import Pingback
from apps.payment.tasks import transaction_to_roistat
from apps.payment.models import Payment
import logging
logger = logging.getLogger(__name__)
class Command(BaseCommand):
help = 'Send '
def add_arguments(self, parser):
parser.add_argument(
'start_id', type=int,
help='Start payment id',
)
def handle(self, *args, **options):
start_id = options.get('start_id')
print('start_id=' + str(start_id))
payments = Payment.objects.filter(id__gte=start_id, status__in=Payment.PW_PAID_STATUSES)
for payment in payments:
print('TRANSACTION: ' + str(payment.id))
transaction_to_roistat.delay(
payment.user.id,
payment.id,
f'School payment',
payment.amount,
payment.created_at.strftime('%Y-%m-%d %H:%M:%S'),
0,
f'school',
payment.roistat_visit,
)