Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # services.py
- def barcode_upload_iupay(self, user, token, barcode):
- url = 'https://api.iupay.com.br/api/v5alpha/documents/barcode'
- payload = {"barcode": barcode}
- headers = {'content-type': 'application/json', 'Authorization': token}
- response = requests.post(url, data=json.dumps(payload), headers=headers)
- return response
- -----------------------------------------------------------------------------------------------
- # views.py
- class BarcodeUploadPIView(ListAPIView):
- serializer_class = BankSlipSerializer
- permission_classes = [permissions.IsAuthenticated]
- def post(self, request, *args, **kwargs):
- barcode_iupay = barcode_upload_iupay(request.data.get('barcode'))
- barcode = BankSlip.objects.get(barcode=barcode)
- return Response(barcode)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement