python-stdnum
python-stdnum copied to clipboard
Update rnc.py
The dgii_wsdl URL changed from https://www.dgii.gov.do/wsMovilDGII/WSMovilDGII.asmx?WSDL to https://www.dgii.gov.do/ventanillaunica/ventanillaunica.asmx?WSDL.
Hello @arthurdejong, kind reminder.
Hellow, @kvillar93 thanks!!!!
I'm tried this new link and do not working :(
@raulovallet, @kvillar93 it seems that dgii changed the structure and gatekeeps rnc validation with basic auth (username, password)
<s:element name="BuscaRnc">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="pUsuario" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="pPassword" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="pNumero_Documento" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="VerificaRnc">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="pUsuario" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="pPassword" type="s:string" />
<s:element minOccurs="0" maxOccurs="1" name="pRnc" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
this is the old structure, use it as reference https://web.archive.org/web/20180208032245/http://www.dgii.gov.do/wsMovilDGII/WSMovilDGII.asmx?op=GetContribuyentes
Hi @kvillar93,
Thanks for the notification. Can you update the PR to fix the problem with the changed API? You can run the tests for this with ONLINE_TESTS=1 pytest --no-cov -k rnc (by default the online tests are not run to not overload online services).
The tests currently fail with:
E AttributeError: Service has no operation 'GetContribuyentes'
does it was merged to master?
A fix for the problem has not been merged because there is no solution available yet that works.
I've had a look at the WSDL provided at https://www.dgii.gov.do/ventanillaunica/ventanillaunica.asmx?WSDL and it seems that authentication may be enforced (the API states that username and password are optional but I have not been able to make a successful call yet).
<s:element name="VerificaRnc">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="pUsuario" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="pPassword" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="pRnc" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
I always seem to get some variation of:
>>> from stdnum.util import get_soap_client
>>> client = get_soap_client('https://www.dgii.gov.do/ventanillaunica/ventanillaunica.asmx?WSDL', timeout=30, verify=True)
Forcing soap:address location to HTTPS
Forcing soap:address location to HTTPS
>>> client.VerificaRnc(pRnc='131098193')
{
'CodigoMensaje': 7,
'DescripcionMensaje': 'Error: Error Interno del Webservice! Extendido:Object reference not set to an instance of an object.',
'RNC_Cedula': None,
'NombreRazonSocial': None,
'Estatus': 'Inactivo'
}
Does anyone have a pointer to the documentation?