django-afip icon indicating copy to clipboard operation
django-afip copied to clipboard

Qn: What about adding new services to the project.

Open Alvezgr opened this issue 1 year ago • 5 comments

@WhyNotHugo I'm wondering what 'ill be the welcoming of adding new AFIP services to the project such as padrones or any other basic services. The project today is very useful and with wsaa and wsfe is working and solving the main needs for general purpose, but I recently needed to use another service in AFIP and I'm asking if it's only my need or if 'ill be a nice to have. I'm working in getting a person from one of the possible padrones that are in AFIP. So I'm thinking on creating a Person model that will have AFIP persona data on it with some methods to fetch that data. Whats are your thoughts about it?

Alvezgr avatar Jul 29 '22 15:07 Alvezgr

I think the ticket-fetching logic should work as-is. We also need to add the urls to clients.py.

There's a few different ws_sr_padron_a* services. Do you know how they related? Does each one add new fields on top of previous ones, or are they different methods? Which one do you have in mind?

WhyNotHugo avatar Apr 13 '23 11:04 WhyNotHugo

I'm generally open to adding other webservices to the project; most of it is designed in a way to make it easy to extend.

WhyNotHugo avatar Apr 13 '23 11:04 WhyNotHugo

The main motivation that I had, to implement this was to automate what kind of receipt a person can receive depending on his vat condition and the taxpayer vat condition and also to fill the receipt PDF for a given DNI or CUIT, getting the name, last_name, vat condition and address directly from AFIP.

I end it up implementing with some helpers and cleaners around ws_sr_constancia_de_inscripcion and ws_sr_padron_a13 services, reaching to the conclusion that there is not a "clean" way to implement this into the library, due to:

  • validations/checks we must do.
  • ws_sr_padron_a13 does not work for Consumidor Final.
  • vat_condition, IVA Exento or IVA RI not always are explicit.

Any recomendation or hints will be great to validate the need for this and the following path to implement.

Alvezgr avatar Apr 14 '23 21:04 Alvezgr

ws_sr_padron_a13 at least allows confirming that a CUIT is valid, correct?

Saving the province in Receipt instances would be useful. Pretty much all tax reports require the province where the buyer lives. Is that exposed?

vat_condition, IVA Exento or IVA RI not always are explicit.

Is this available in some other version of ws_sr_padron_a*?

WhyNotHugo avatar Apr 15 '23 18:04 WhyNotHugo

ws_sr_padron_a13 Will return:

  • Persona if a CUIT is valid and active.
  • Throw Fault: Persona inactiva if a CUIT is valid but inactive.
  • Fault: No existe persona con ese Id if a CUIT is not valid.

So I think you can just check for Fault: No existe persona con ese Id to validate or not a CUIT.

Is this available in some other version of ws_sr_padron_a*?

Yeah It is available (otherwise is: Consumidor Final) in ws_sr_constancia_de_inscripcion (known before as ws_sr_padron_a5).

PD: As you mention above the ticket-fetching logic is the same and the urls to clients.py were added in the commit 1b7b0f5.

Alvezgr avatar Apr 15 '23 21:04 Alvezgr