|
|
|
|
@ -5,6 +5,9 @@ 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 ' |
|
|
|
|
@ -19,10 +22,12 @@ class Command(BaseCommand): |
|
|
|
|
start_id = options.get('start_id') |
|
|
|
|
payments = Payment.objects.filter(id__gte=start_id, status__in=Payment.PW_PAID_STATUSES) |
|
|
|
|
for payment in payments: |
|
|
|
|
logger.info('TRANSACTION: ' + payment.id) |
|
|
|
|
|
|
|
|
|
pingback = Pingback(payment.data) |
|
|
|
|
splitted = pingback.get_product().get_id().split('_') |
|
|
|
|
product_type_name, payment_id = '_'.join(splitted[:-1]), splitted[-1] |
|
|
|
|
transaction_to_roistat.delay( |
|
|
|
|
transaction_to_roistat( |
|
|
|
|
payment.user.id, |
|
|
|
|
payment.id, |
|
|
|
|
f'{product_type_name.title()} payment', |
|
|
|
|
|