Exemplo n.º 1
0
    def ConstatarComprobantes(self, *args, **kwargs):
        cbte_modo = kwargs['cbte_modo']  # modalidad de emision: CAI, CAE, CAEA
        cuit_emisor = LeerIni(clave='cuit', key='WSFEv1')  # proveedor
        pto_vta = kwargs['pto_vta']  # punto de venta habilitado en AFIP
        cbte_tipo = kwargs[
            'cbte_tipo']  # 1: factura A (ver tabla de parametros)
        cbte_nro = kwargs['cbte_nro']  # numero de factura
        cbte_fch = kwargs['cbte_fch']  # fecha en formato aaaammdd
        imp_total = kwargs['imp_total']  # importe total
        cod_autorizacion = kwargs[
            'cod_autorizacion']  # numero de CAI, CAE o CAEA
        doc_tipo_receptor = kwargs[
            'doc_tipo_receptor']  # CUIT (obligatorio Facturas A o M)
        doc_nro_receptor = kwargs[
            'doc_nro_receptor']  # numero de CUIT del cliente
        wscdc = WSCDC()
        ta = self.Autenticar()
        wscdc.SetTicketAcceso(ta_string=ta)
        wscdc.SetParametros(cuit=LeerIni(clave='cuit', key='WSFEv1'),
                            token=self.Token,
                            sign=self.Sign)
        ok = wscdc.ConstatarComprobante(cbte_modo, cuit_emisor, pto_vta,
                                        cbte_tipo, cbte_nro, cbte_fch,
                                        imp_total, cod_autorizacion,
                                        doc_tipo_receptor, doc_nro_receptor)
        if not ok:
            Ventanas.showAlert(LeerIni('nombre_sistema'),
                               "ERROR: {}".format(wscdc.ErrMsg))

        return ok
Exemplo n.º 2
0
    def _get_ws(self, afip_ws):
        """
        Method to be inherited
        """
        ws = super(AfipwsConnection, self)._get_ws(afip_ws)
        if afip_ws == 'wsfe':
            from pyafipws.wsfev1 import WSFEv1
            ws = WSFEv1()
        elif afip_ws == "wsfex":
            from pyafipws.wsfexv1 import WSFEXv1
            ws = WSFEXv1()
        elif afip_ws == "wsmtxca":
            from pyafipws.wsmtx import WSMTXCA
            ws = WSMTXCA()
        elif afip_ws == "wscdc":
            from pyafipws.wscdc import WSCDC
            ws = WSCDC()
        elif afip_ws == "ws_sr_padron_a4":
            from pyafipws.ws_sr_padron import WSSrPadronA4
            ws = WSSrPadronA4()
            if self.type == 'production':
                ws.H**O = False
                ws.WSDL = "https://aws.afip.gov.ar/sr-padron/webservices/personaServiceA4?wsdl"
        elif afip_ws == "ws_sr_constancia_inscripcion":
            from pyafipws.ws_sr_padron import WSSrPadronA5
            ws = WSSrPadronA5()
            if self.type == 'production':
                ws.H**O = False
                ws.WSDL = "https://aws.afip.gov.ar/sr-padron/webservices/personaServiceA5?wsdl"

        return ws
Exemplo n.º 3
0
 def setUp(self):
     sys.argv.append("--trace")  # TODO: use logging
     self.wscdc = wslpg = WSCDC()
     wslpg.LanzarExcepciones = True
     wslpg.Conectar(wsdl=WSDL, cacert=None, cache=CACHE)
     wslpg.Cuit = CUIT
     wslpg.Token = wsaa.Token
     wslpg.Sign = wsaa.Sign
 def _get_ws(self, afip_ws):
     """
     Method to be inherited
     """
     ws = super(AfipwsConnection, self)._get_ws(afip_ws)
     if afip_ws == 'wsfe':
         from pyafipws.wsfev1 import WSFEv1
         ws = WSFEv1()
     elif afip_ws == "wsfex":
         from pyafipws.wsfexv1 import WSFEXv1
         ws = WSFEXv1()
     elif afip_ws == "wsmtxca":
         from pyafipws.wsmtx import WSMTXCA
         ws = WSMTXCA()
     elif afip_ws == "wscdc":
         from pyafipws.wscdc import WSCDC
         ws = WSCDC()
     return ws
Exemplo n.º 5
0
 def __init__(self):
     WSCDC.__init__(self)
Exemplo n.º 6
0
import os
import sys
import pytest
from pyafipws.wsaa import WSAA
from pyafipws.wscdc import WSCDC, main
from pyafipws import wscdc as ws

WSDL = "https://wswhomo.afip.gov.ar/WSCDC/service.asmx?WSDL"
CUIT = os.environ["CUIT"]
CERT = "reingart.crt"
PKEY = "reingart.key"
CACHE = ""

pytestmark = [pytest.mark.vcr, pytest.mark.dontusefix]

wscdc = WSCDC()


@pytest.fixture(autouse=True)
def wscdc_():
    wsc = ws
    ta = WSAA().Autenticar("wscdc", CERT, PKEY)
    wscdc.Cuit = CUIT
    wscdc.SetTicketAcceso(ta)
    wscdc.Conectar(CACHE, WSDL)
    return [wscdc, wsc]


@pytest.mark.skip
def test_server_status(wscdc_):
    """Test de estado de servidores."""