meta data de esta página
  •  

Diferencias

Muestra las diferencias entre dos versiones de la página.

Enlace a la vista de comparación

Ambos lados, revisión anterior Revisión previa
Próxima revisión
Revisión previa
codigo_java_dominicana [2023/11/13 19:14]
scastillo
codigo_java_dominicana [2024/03/20 02:31] (actual)
47.128.30.61 se ha restaurado la vieja versión (2023/11/13 19:08)
Línea 27: Línea 27:
     }     }
 } }
 +
 </code> </code>
  
-<code java EstatusDocumento> +<code python EstatusDocumento> 
-import org.apache.http.HttpResponse; +import requests 
-import org.apache.http.client.HttpClient; +import json
-import org.apache.http.client.methods.HttpPost; +
-import org.apache.http.entity.StringEntity; +
-import org.apache.http.impl.client.HttpClientBuilder;+
  
-import java.io.IOException;+respjson={"Codigo": 1,"Mensaje": " ", "Procesado": False} #Creamos un objeto respuesta en json
  
-public class Main { +j={"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjEzMDk2MDA1NCIsImVtYWlsIjoiMTMwOTYwMDU0X2ludCIsIm5iZiI6MTY0ODU2NjAxNCwiZXhwIjoxNjQ4NjE0NDM0LCJpYXQiOjE2NDg1NjYwMTR9.KCaf5qqQ2A_8-nUQCV-9ttwhsRwnwVL_MiHfDvfe5A4","documento": "E310000003452","rnc": "130960054" #convertimos el string a json 
-    public static void main(String[] args) throws IOException { +response = requests.post("https://testemision.thefactoryhka.com.do/api/EstatusDocumento",json=j) #enviamos el post a la url con los datos 
-        String url "https://testemision.thefactoryhka.com.do/api/EstatusDocumento"; +
-        String json = "{\"token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjEzMDk2MDA1NCIsImVtYWlsIjoiMTMwOTYwMDU0X2ludCIsIm5iZiI6MTY0ODU2NjAxNCwiZXhwIjoxNjQ4NjE0NDM0LCJpYXQiOjE2NDg1NjYwMTR9.KCaf5qqQ2A_8-nUQCV-9ttwhsRwnwVL_MiHfDvfe5A4\",\"documento\": \"E310000003452\",\"rnc\": \"130960054\"}";+
  
-        HttpClient httpClient = HttpClientBuilder.create().build()+print("\r\n"+"***********************************************************************************") 
-        HttpPost request = new HttpPost(url)+print(response.json()) #imporimimos el resultado en json 
-        StringEntity params = new StringEntity(json); +print("\r\n"+"***********************************************************************************") 
-        request.addHeader("content-type""application/json"); +respjson=json.dumps(response.json()) 
-        request.setEntity(params); +print(respjson.capitalize()) #imporimimos el resultado en json en minusculas
- +
-        HttpResponse response = httpClient.execute(request); +
-        System.out.println(response)+
-    } +
-}+
 </code> </code>
  
-<code java Enviar> +<code python Enviar> 
-import org.apache.http.HttpResponse; +import requests 
-import org.apache.http.client.HttpClient; +import json
-import org.apache.http.client.methods.HttpPost; +
-import org.apache.http.entity.StringEntity; +
-import org.apache.http.impl.client.HttpClientBuilder;+
  
-import java.io.IOException;+respjson={"xmlBase64": "","procesado":False, "codigo": 1,"mensaje":"" } #Creamos un objeto respuesta en json
  
-public class Main { +#Creamos una factura json 
-    public static void main(String[] args) throws IOException { + 
-        String url "https://testemision.thefactoryhka.com.do/api/EstatusDocumento"; +j={ 
-        String json = "{\"Token\": \"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjEzMDk2MDA1NCIsImVtYWlsIjoiMTMwOTYwMDU0X2ludCIsIm5iZiI6MTY0ODU2NjAxNCwiZXhwIjoxNjQ4NjE0NDM0LCJpYXQiOjE2NDg1NjYwMTR9.KCaf5qqQ2A_8-nUQCV-9ttwhsRwnwVL_MiHfDvfe5A4\",\"documentoElectronico\": {\"encabezado\": {\"identificacionDocumento\": {\"tipoDocumento\": \"31\",\"ncf\": \"E310000003453\",\"fechaVencimientoSecuencia\": \"31-12-2022\",\"indicadorEnvioDiferido\": \"1\",\"indicadorMontoGravado\": \"1\",\"indicadorNotaCredito\": null,\"tipoIngresos\": \"01\",\"tipoPago\": \"1\",\"fechaLimitePago\": null,\"terminoPago\": null,\"tablaFormasPago\": [{\"forma\": \"1\",\"monto\": \"400000.00\"}],\"tipoCuentaPago\": null,\"numeroCuentaPago\": null,\"bancoPago\": null,\"fechaDesde\": null,\"fechaHasta\": null},\"emisor\": {\"rnc\": \"130960054\",\"razonSocial\": \"TheFactoryHKA C.A\",\"nombreComercial\": \"TheFactoryHKA C.A\",\"sucursal\": \"Sucursal\",\"direccion\": \"Av. Los Beisbolistas esq. Ant. Carretera Duarte, Plaza Shantell, Locales B6 y B7\",\"municipio\": \"320100\",\"provincia\": \"320000\",\"tablaTelefono\": [\"809-472-7676\",\"809-491-1918\"],\"correo\": \"scastillo@thefactoryhka.com\",\"webSite\": \"www.thefactoryhka.com/rd\",\"actividadEconomica\": null,\"codigoVendedor\": \"GENETRIX0000000000000000001\",\"numeroFacturaInterna\": \"000000000000212\",\"numeroPedidoInterno\": \"000000000000212\",\"zonaVenta\": \"NORTE\",\"rutaVenta\": null,\"informacionAdicional\": null,\"fechaEmision\": \"29-03-2022\"},\"comprador\": {\"rnc\": \"101072148\",\"identificacionExtranjero\": null,\"razonSocial\": \"DISTRIBUIDORA DE COSMETICOS SAS (DISCOSA)\",\"contacto\": \"DISCOSA\",\"correo\": \"prueba@yopmail.c\"}}}"; +  "Token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1bmlxdWVfbmFtZSI6IjEzMDk2MDA1NCIsImVtYWlsIjoiMTMwOTYwMDU0X2ludCIsIm5iZiI6MTY0ODU2NjAxNCwiZXhwIjoxNjQ4NjE0NDM0LCJpYXQiOjE2NDg1NjYwMTR9.KCaf5qqQ2A_8-nUQCV-9ttwhsRwnwVL_MiHfDvfe5A4", 
-        HttpClient httpClient = HttpClientBuilder.create().build(); + "documentoElectronico": { 
-        HttpPost request = new HttpPost(url); + "encabezado": { 
-        StringEntity params = new StringEntity(json); + "identificacionDocumento": { 
-        request.addHeader("content-type", "application/json"); + "tipoDocumento": "31", 
-        request.setEntity(params); + "ncf": "E310000003453", 
-        HttpResponse response = httpClient.execute(request); + "fechaVencimientoSecuencia": "31-12-2022", 
-        System.out.println(response); + "indicadorEnvioDiferido": "1", 
-    }+ "indicadorMontoGravado": "1", 
 + "indicadorNotaCredito": None, 
 + "tipoIngresos": "01", 
 + "tipoPago": "1", 
 + "fechaLimitePago": None, 
 + "terminoPago": None, 
 + "tablaFormasPago": [ 
 + { 
 + "forma": "1", 
 + "monto": "400000.00" 
 + } 
 + ], 
 + "tipoCuentaPago": None, 
 + "numeroCuentaPago": None, 
 + "bancoPago": None, 
 + "fechaDesde": None, 
 + "fechaHasta": None 
 + }, 
 + "emisor": { 
 + "rnc": "130960054", 
 + "razonSocial": "TheFactoryHKA C.A", 
 + "nombreComercial": "TheFactoryHKA C.A", 
 + "sucursal": "Sucursal", 
 + "direccion": "Av. Los Beisbolistas esq. Ant. Carretera Duarte, Plaza Shantell, Locales B6 y B7", 
 + "municipio": "320100", 
 + "provincia": "320000", 
 + "tablaTelefono": [ 
 + "809-472-7676", 
 + "809-491-1918" 
 + ], 
 + "correo": "scastillo@thefactoryhka.com", 
 + "webSite": "www.thefactoryhka.com/rd", 
 + "actividadEconomica": None, 
 + "codigoVendedor": "GENETRIX0000000000000000001", 
 + "numeroFacturaInterna": "000000000000212", 
 + "numeroPedidoInterno": "000000000000212", 
 + "zonaVenta": "NORTE", 
 + "rutaVenta": None, 
 + "informacionAdicional": None, 
 + "fechaEmision": "29-03-2022" 
 + }, 
 + "comprador": { 
 + "rnc": "101072148", 
 + "identificacionExtranjero": None, 
 + "razonSocial": "DISTRIBUIDORA DE COSMETICOS SAS (DISCOSA)", 
 + "contacto": "DISCOSA", 
 + "correo": "prueba@yopmail.com"
 + "direccion": "RD dirección", 
 + "municipio": "010100", 
 + "provincia": "010000", 
 + "pais": "Pais", 
 + "fechaEntrega": "26-12-2021", 
 +                "FechaOrdenCompra":"10-11-2018", 
 + "contactoEntrega": None, 
 + "direccionEntrega": None, 
 + "telefonoAdicional": None, 
 + "fechaOrden": "24-12-2021", 
 + "numeroOrden": "4500352238", 
 + "codigoInterno": "10633440", 
 + "responsablePago": None, 
 + "informacionAdicional": None 
 + }
 + "informacionesAdicionales":
 + "fechaEmbarque": None, 
 + "numeroEmbarque": None, 
 + "numeroContenedor": "8019289", 
 + "numeroReferencia": "1447", 
 + "pesoBruto": None, 
 + "pesoNeto": None, 
 + "unidadPesoBruto": None, 
 + "unidadPesoNeto": None, 
 + "cantidadBulto": None, 
 + "unidadBulto": None, 
 + "volumenBulto": None, 
 + "unidadVolumen": None, 
 + "nombrePuertoEmbarque": None, 
 + "condicionesEntrega": None, 
 + "totalFob": None, 
 + "seguro": None, 
 + "flete": None, 
 + "otrosGastos": None, 
 + "totalCif": None, 
 + "regimenAduanero": None, 
 + "nombrePuertoSalida": None, 
 + "nombrePuertoDesembarque": None 
 + }
 + "transporte": None, 
 + "totales":
 + "montoGravadoTotal": None, 
 + "montoGravadoI1": None, 
 + "montoGravadoI2": None, 
 + "montoGravadoI3": None, 
 + "montoExento": "400000.00", 
 + "itbiS1": None, 
 + "itbiS2": None, 
 + "itbiS3": None, 
 + "totalITBIS": None, 
 + "totalITBIS1": None, 
 + "totalITBIS2": None, 
 + "totalITBIS3": None, 
 + "montoImpuestoAdicional": None, 
 + "impuestosAdicionales": None, 
 + "montoTotal": "400000.00"
 + "montoNoFacturable": None, 
 + "montoPeriodo": None, 
 + "saldoAnterior": None, 
 + "montoAvancePago": None, 
 + "valorPagar": None, 
 + "totalITBISRetenido": None, 
 + "totalISRRetencion": None, 
 + "totalITBISPercepcion": None, 
 + "totalISRPercepcion": None 
 +                  
 + }, 
 + "otraMoneda": None 
 + }, 
 + "detallesItems":
 +
 + "numeroLinea": "1", 
 + "tablaCodigos": None, 
 + "indicadorFacturacion": "4", 
 + "retencion": None, 
 + "nombre": "ASW DTU", 
 + "indicadorBienoServicio": "1", 
 + "descripcion": None, 
 + "cantidad": "10000.00", 
 + "unidadMedida": "47", 
 + "cantidadReferencia": None, 
 + "unidadReferencia": None, 
 + "tablaSubcantidad": None, 
 + "gradosAlcohol": None, 
 + "precioUnitarioReferencia": None, 
 + "fechaElaboracion": None, 
 + "fechaVencimiento": None, 
 + "mineria": None, 
 + "precioUnitario": "40.00", 
 + "descuentoMonto": None, 
 + "tablaSubDescuento": None, 
 + "recargoMonto": None, 
 + "tablaSubRecargo": None, 
 + "tablaImpuestoAdicional": None, 
 + "otraMonedaDetalle": None, 
 + "monto": "400000.00" 
 +
 + ], 
 + "subtotales": None, 
 + "descuentosORecargos": None, 
 + "informacionReferencia": None 
 + }
 } }
  
 +
 + #convertimos el string a json y capturamos la respuesta
 +response = requests.post("https://testemision.thefactoryhka.com.do/api/Enviar",json=j) #enviamos el post a la url con los datos 
 +
 +
 +
 +print("\r\n"+"***********************************************************************************")
 +print(response.json()) #Imprimimos el resultado en json
 +print("\r\n"+"***********************************************************************************")
 +respjson=json.dumps(response.json())
 +print(respjson.capitalize()) #imporimimos el resultado en json en minusculas
 </code> </code>