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.
50 lines
1.7 KiB
50 lines
1.7 KiB
import requests
|
|
|
|
from paymentwall import Pingback
|
|
|
|
from django.conf import settings
|
|
from django.core.management.base import BaseCommand, CommandError
|
|
|
|
|
|
class Command(BaseCommand):
|
|
help = 'Update statuses on Roistat'
|
|
|
|
def handle(self, *args, **options):
|
|
body = [
|
|
{
|
|
'id': str(Pingback.PINGBACK_TYPE_REGULAR),
|
|
'name': 'PINGBACK_TYPE_REGULAR',
|
|
'type': 'paid',
|
|
},
|
|
{
|
|
'id': str(Pingback.PINGBACK_TYPE_GOODWILL),
|
|
'name': 'PINGBACK_TYPE_GOODWILL',
|
|
'type': 'paid',
|
|
},
|
|
{
|
|
'id': str(Pingback.PINGBACK_TYPE_NEGATIVE),
|
|
'name': 'PINGBACK_TYPE_NEGATIVE',
|
|
'type': 'canceled',
|
|
},
|
|
{
|
|
'id': str(Pingback.PINGBACK_TYPE_RISK_UNDER_REVIEW),
|
|
'name': 'PINGBACK_TYPE_RISK_UNDER_REVIEW',
|
|
'type': 'progress',
|
|
},
|
|
{
|
|
'id': str(Pingback.PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED),
|
|
'name': 'PINGBACK_TYPE_RISK_REVIEWED_ACCEPTED',
|
|
'type': 'paid',
|
|
},
|
|
{
|
|
'id': str(Pingback.PINGBACK_TYPE_RISK_REVIEWED_DECLINED),
|
|
'name': 'PINGBACK_TYPE_RISK_REVIEWED_DECLINED',
|
|
'type': 'canceled',
|
|
},
|
|
]
|
|
project = settings.ROISTAT_PROJECT
|
|
key = settings.ROISTAT_KEY
|
|
url = settings.ROISTAT_API_URL + f'/project/set-statuses?key={key}&project={project}'
|
|
resp = requests.post(url, json=body)
|
|
self.stdout.write(str(resp))
|
|
self.stdout.write(str(resp.json()))
|
|
|