finkok
- class satcfdi.pacs.finkok.PendingDocument(document_id: str, xml: bytes = None, pdf: bytes = None, status: satcfdi.pacs.finkok.DocumentStatus = None)[source]
Bases:
Document- status: DocumentStatus = None
- class satcfdi.pacs.finkok.Finkok(username: str, password: str, environment=Environment.PRODUCTION)[source]
Bases:
PACFinkok, S.A.P.I. de C.V. Finkok
- RFC = 'FIN1203015JA'
- namespaces = {'apps': 'apps.services.soap.core.views', 'cancel': 'http://facturacion.finkok.com/cancel', 'soapenv': 'http://schemas.xmlsoap.org/soap/envelope/', 'stamp': 'http://facturacion.finkok.com/stamp'}
- property host
- property stamp_url
- issue(cfdi: ~satcfdi.cfdi.CFDI, accept: ~satcfdi.pacs.Accept = <Accept.XML: 1>) Document[source]
Operation to request CFDI to be sealed and stamped by Finkok.
- Parameters:
- Raises:
NotImplementedError – If the accept parameter includes Accept.PDF
ResponseError – If the response from the Finkok SOAP web service contains an error code
- Returns:
- The stamped CFDI as a Document object with the following fields:
document_id (str): The UUID of the stamped CFDI.
xml (bytes): The XML content of the stamped CFDI.
- Return type:
Notes
This function currently only supports accepting XML responses.
If the accept parameter includes Accept.PDF, a NotImplementedError is raised.
- stamp(cfdi: ~satcfdi.cfdi.CFDI, accept: ~satcfdi.pacs.Accept = <Accept.XML: 1>) Document[source]
Operation to request sealed CFDI to be stamped by Finkok
- Parameters:
- Raises:
NotImplementedError – If the accept parameter includes Accept.PDF
ResponseError – If the response from the Finkok SOAP web service contains an error code
- Returns:
- The stamped CFDI as a Document object with the following fields:
document_id (str): The UUID of the stamped CFDI.
xml (bytes): The XML content of the stamped CFDI.
- Return type:
Notes
This function currently only supports accepting XML responses.
If the accept parameter includes Accept.PDF, a NotImplementedError is raised.
- quick_stamp(cfdi: ~satcfdi.cfdi.CFDI, accept: ~satcfdi.pacs.Accept = <Accept.XML: 1>) Document[source]
Operation to request sealed CFDI to be stamped by Finkok using the quick stamp service.
This operation is recommended for high amount of stamp requests per second.
- Parameters:
- Raises:
NotImplementedError – If the accept parameter includes Accept.PDF
ResponseError – If the response from the Finkok SOAP web service contains an error code
- Returns:
- The stamped CFDI as a Document object with the following fields:
document_id (str): The UUID of the stamped CFDI.
xml (bytes): The XML content of the stamped CFDI.
- Return type:
Notes
This function currently only supports accepting XML responses.
If the accept parameter includes Accept.PDF, a NotImplementedError is raised.
- stamped(cfdi: ~satcfdi.cfdi.CFDI, accept: ~satcfdi.pacs.Accept = <Accept.XML: 1>) Document[source]
Retrieves a previously stamped XML that failed to be retrieved in the first request.
- Parameters:
- Raises:
NotImplementedError – If the accept parameter includes Accept.PDF
ResponseError – If the response from the Finkok SOAP web service contains an error code
- Returns:
- The document with the following fields:
document_id (str): The UUID of the document.
xml (bytes): The XML content of the document.
- Return type:
Notes
This function currently only supports accepting XML responses.
If the accept parameter includes Accept.PDF, a NotImplementedError is raised.
- pending_stamp(document_id: str, accept: ~satcfdi.pacs.Accept = <Accept.XML: 1>) PendingDocument[source]
Check the status of a document that is pending to be sent to the SAT (by failure or quick stamp)
- Parameters:
document_id (str) – The UUID of the document to recover.
accept (Accept, optional) – The type of response to accept. Defaults to Accept.XML.
- Raises:
NotImplementedError – If the accept parameter includes Accept.PDF.
ResponseError – If the response from the Finkok SOAP web service contains an error code.
- Returns:
The PendingDocument object with the following attributes: - document_id (str): The UUID of the document. - xml (bytes): The XML content of the document. - status (DocumentStatus): The status of the document.
STAMPED, the document has been stamped but not sent to the SAT.
FINISHED, the document has been stamped and sent to the SAT.
- Return type:
Notes
This function currently only supports accepting XML responses.
If the accept parameter includes Accept.PDF, a NotImplementedError is raised.
- cancel(cfdi: CFDI, reason: CancelReason, substitution_id: str = None, signer: Signer = None) CancelationAcknowledgment[source]
Cancels a CFDI document using the Finkok API.
- Parameters:
cfdi (CFDI) – The CFDI document to be canceled.
reason (CancelReason) – The reason for canceling the CFDI document.
substitution_id (str, optional) – The ID of the substitution document. Defaults to None.
signer (Signer) – The signer of the CFDI document.
- Returns:
The acknowledgment of the cancellation.
- Return type:
- Raises:
ValueError – If the signer is not provided.
DocumentNotFoundError – If the CFDI document to cancel is not found.
ResponseError – If there is an error in the response from the API.
- cancel_comprobante(cancelation: Cancelacion) CancelationAcknowledgment[source]
Operation to request the cancellation of a CFDI document using a Cancelacion object.
- Parameters:
cancelation (cancelacion.Cancelacion) – The cancelation object.
- Returns:
The acknowledgment of the cancellation.
- Return type:
- Raises:
DocumentNotFoundError – If the document is not found.
ResponseError – If there is an error in the response.
- accept_reject(request: SolicitudAceptacionRechazo) AcceptRejectAcknowledgment[source]
Operation to Accept Reject a Cancellation Request
- Parameters:
request (SolicitudAceptacionRechazo) – The cancellation request.
- Returns:
The acknowledgment of the cancellation.
- Return type:
- Raises:
ResponseError – If there is an error in the response.