Esempio n. 1
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

from afip.endpoints import Testing
from afip.wsaa import AuthorizationTicket

# The key and certificate are the only values you should need to change.
ticket = AuthorizationTicket(Testing(), "hyperion.key", "hyperion.crt", "wsfe")
ticket.login()

print(ticket.dump())
Esempio n. 2
0
#!/usr/bin/env python2
# -*- coding: utf-8 -*-

from afip.endpoints import Testing
from afip.wsaa import AuthorizationTicket
from afip.wsfev1 import InvoiceService, Invoice, InvoiceDetail, Vat
from datetime import datetime, timedelta

import json

# Run `test/wsaa.py > ticket` to generate a ticket file.
ticket_data = open("ticket")
# This is the only variable you should need to modify.
cuit = 20329642330

ticket = AuthorizationTicket(Testing(), "hyperion.key", "hyperion.crt", "wsfe")
ticket.load(ticket_data.read())

# ~~~ A-type invoice ~~~
print("~~~ Type C invoices ~~~")
invoice_type = 11

# ~~~ Test last_authorized_id ~~~
invoice_service = InvoiceService(Testing, ticket, cuit)
last_id = invoice_service.last_authorized_id(sales_point=1,
                                             invoice_type=invoice_type)
print("Last invoice of type {}: {}.".format(invoice_type, last_id))

# ~~~ Test authorize_invoice, C-type invoice ~~~

now = datetime.now()