python-stdnum icon indicating copy to clipboard operation
python-stdnum copied to clipboard

Update rnc.py

Open kvillar93 opened this issue 10 months ago • 6 comments

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.

kvillar93 avatar Jan 23 '25 14:01 kvillar93

Hello @arthurdejong, kind reminder.

kvillar93 avatar Jan 27 '25 23:01 kvillar93

Hellow, @kvillar93 thanks!!!!

raulovallet avatar Jan 29 '25 21:01 raulovallet

I'm tried this new link and do not working :(

raulovallet avatar Jan 30 '25 07:01 raulovallet

@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>

Yepecpp avatar Feb 05 '25 07:02 Yepecpp

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

Yepecpp avatar Feb 05 '25 07:02 Yepecpp

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'

arthurdejong avatar Feb 15 '25 14:02 arthurdejong

does it was merged to master?

ctactuk avatar Mar 24 '25 13:03 ctactuk

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?

arthurdejong avatar Mar 27 '25 13:03 arthurdejong