parent
90121323ec
commit
13eafdc518
3 changed files with 50 additions and 0 deletions
@ -0,0 +1,50 @@ |
|||||||
|
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())) |
||||||
Loading…
Reference in new issue