From: Vásáry Dániel Date: Wed, 6 Mar 2024 15:22:20 +0000 (+0100) Subject: Resolving project problems1 X-Git-Url: http://git.useribm.hu/?a=commitdiff_plain;h=962bd0d7d10968d73cc51533f6a0fd8769cb64b8;p=sly-crm.git Resolving project problems1 --- diff --git a/KB.md b/KB.md index 34041da..03b0fe7 100644 --- a/KB.md +++ b/KB.md @@ -123,3 +123,7 @@ https://github.com/zkoss-demo/zk-ringdisplay/tree/master/ringdisplay ##### org.webjars org.webjars + +##### DEBUG + +-Djavax.net.debug=ssl:handshake \ No newline at end of file diff --git a/deploy/start.sh b/deploy/start.sh index a78c752..fbb7815 100644 --- a/deploy/start.sh +++ b/deploy/start.sh @@ -1,2 +1,3 @@ #!/bin/bash java -DSLY-CRM-APPLICATION -Dspring.profiles.active=prod -jar /opt/slycrm/sly-crm-app.jar +# -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000 \ No newline at end of file diff --git a/sly-crm-app/pom.xml b/sly-crm-app/pom.xml index 5eb6979..1bf83c9 100644 --- a/sly-crm-app/pom.xml +++ b/sly-crm-app/pom.xml @@ -17,17 +17,11 @@ + - org.codehaus.mojo - exec-maven-plugin + org.apache.maven.plugins + maven-resources-plugin 3.1.0 - - hu.user.lis.build.Exec - - First - Second - - org.springframework.boot @@ -47,19 +41,6 @@ - - org.apache.maven.plugins - maven-war-plugin - - - - development - ${project.url} - value - - - - diff --git a/sly-crm-app/src/main/resources/keystore/keystore.jks b/sly-crm-app/src/main/resources/keystore/keystore.jks new file mode 100644 index 0000000..b879cae Binary files /dev/null and b/sly-crm-app/src/main/resources/keystore/keystore.jks differ diff --git a/sly-crm-app/src/main/resources/keystore/lis-keystore.jks b/sly-crm-app/src/main/resources/keystore/lis-keystore.jks index d53b743..45aeaa3 100644 Binary files a/sly-crm-app/src/main/resources/keystore/lis-keystore.jks and b/sly-crm-app/src/main/resources/keystore/lis-keystore.jks differ diff --git a/sly-crm-app/src/test/java/hu/user/lis/CerttIT.java b/sly-crm-app/src/test/java/hu/user/lis/CerttIT.java new file mode 100644 index 0000000..6301071 --- /dev/null +++ b/sly-crm-app/src/test/java/hu/user/lis/CerttIT.java @@ -0,0 +1,87 @@ + +/* + * Copyright (c) $today.year-$today.month-24. + * By elGekko + */ + +package hu.user.lis; + +import lombok.extern.log4j.Log4j2; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.core.io.Resource; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.junit4.SpringRunner; + +import java.security.KeyStore; +import java.security.KeyStoreException; +import java.security.cert.Certificate; +import java.security.cert.X509Certificate; +import java.util.Enumeration; + +import static org.junit.Assert.assertNotNull; + + +@Log4j2 +@SpringBootTest +@RunWith(SpringRunner.class) +@ActiveProfiles("test") +@ComponentScan("hu.user.lis") +public class CerttIT { + @Value("${service.nav.trust.store}") + private Resource trustStore; + + @Value("${service.nav.trust.store.password}") + private String trustStorePassword; + + @Test + public void testCert() throws Exception { + KeyStore keyStore = KeyStore.getInstance("JKS"); + keyStore.load(trustStore.getInputStream(), trustStorePassword.toCharArray()); + X509Certificate endEntityCertificate = (X509Certificate) keyStore.getCertificate("nav"); + X509Certificate rootCertificate = getRootCertificate(endEntityCertificate, keyStore); + assertNotNull(rootCertificate); + } + + static X509Certificate findIssuerCertificate(X509Certificate certificate, KeyStore trustStore) + throws KeyStoreException { + Enumeration aliases = trustStore.aliases(); + while (aliases.hasMoreElements()) { + String alias = aliases.nextElement(); + Certificate cert = trustStore.getCertificate(alias); + if (cert instanceof X509Certificate) { + X509Certificate x509Cert = (X509Certificate) cert; + if (x509Cert.getSubjectX500Principal().equals(certificate.getIssuerX500Principal())) { + return x509Cert; + } + } + } + return null; + } + + public static X509Certificate getRootCertificate(X509Certificate endEntityCertificate, KeyStore trustStore) + throws Exception { + X509Certificate issuerCertificate = findIssuerCertificate(endEntityCertificate, trustStore); + if (issuerCertificate != null) { + if (isRoot(issuerCertificate)) { + return issuerCertificate; + } else { + return getRootCertificate(issuerCertificate, trustStore); + } + } + return null; + } + + private static boolean isRoot(X509Certificate certificate) { + try { + certificate.verify(certificate.getPublicKey()); + return certificate.getKeyUsage() != null && certificate.getKeyUsage()[5]; + } catch (Exception e) { + return false; + } + } + +} diff --git a/sly-crm-app/src/test/java/hu/user/lis/workflow/TaxOfficeInvoiceApiIT.java b/sly-crm-app/src/test/java/hu/user/lis/workflow/TaxOfficeInvoiceApiIT.java index 06d8742..4e7566b 100644 --- a/sly-crm-app/src/test/java/hu/user/lis/workflow/TaxOfficeInvoiceApiIT.java +++ b/sly-crm-app/src/test/java/hu/user/lis/workflow/TaxOfficeInvoiceApiIT.java @@ -52,7 +52,7 @@ import java.util.concurrent.TimeUnit; @Log4j2 @SpringBootTest @RunWith(SpringRunner.class) -@ActiveProfiles("dev") +@ActiveProfiles("test") @ComponentScan("hu.user.lis") //@TestPropertySource("classpath:application-test.yaml") public class TaxOfficeInvoiceApiIT { diff --git a/sly-crm-app/src/test/resources/application-test.yaml b/sly-crm-app/src/test/resources/application-test.yaml index f395cf1..a6ebc39 100644 --- a/sly-crm-app/src/test/resources/application-test.yaml +++ b/sly-crm-app/src/test/resources/application-test.yaml @@ -20,12 +20,9 @@ spring: enabled: always datasource: type: com.zaxxer.hikari.HikariDataSource - # url: jdbc:db2://localhost:50000/slycrm - # username: db2admin - # password: password - url: jdbc:db2://db2.in.useribm.hu:50000/slycrm + url: jdbc:db2://localhost:50000/slycrm username: db2admin - password: Passw@rd01 + password: password camunda.bpm: generic-properties.properties: telemetry-reporter-activate: false @@ -80,7 +77,6 @@ application: proposal-template-docx: "/Users/marcellszabo/Downloads/SALES/SABLONOK/USER_Proposal_v1.docx" tig-template-docx: "/Users/marcellszabo/Downloads/SALES/SABLONOK/TIG_Sablon_v1.docx" calculation-xlsx: "/Users/marcellszabo/Downloads/SALES/SABLONOK/USER_kalkuláció_v1.xlsx" - service: nav: trust: diff --git a/sly-crm-service/pom.xml b/sly-crm-service/pom.xml index 42386ab..6f84d53 100644 --- a/sly-crm-service/pom.xml +++ b/sly-crm-service/pom.xml @@ -23,6 +23,7 @@ + src/main/resources/NAV/schemas/catalog.xml src/main/resources/NAV/schemas/ diff --git a/sly-crm-service/src/main/java/hu/user/lis/service/nav/RestTemplateSSLConfiguration.java b/sly-crm-service/src/main/java/hu/user/lis/service/nav/RestTemplateSSLConfiguration.java index 2a13a8e..1f3eb91 100644 --- a/sly-crm-service/src/main/java/hu/user/lis/service/nav/RestTemplateSSLConfiguration.java +++ b/sly-crm-service/src/main/java/hu/user/lis/service/nav/RestTemplateSSLConfiguration.java @@ -1,16 +1,13 @@ package hu.user.lis.service.nav; -import org.apache.http.conn.ssl.NoopHostnameVerifier; import org.apache.http.conn.ssl.SSLConnectionSocketFactory; import org.apache.http.impl.client.CloseableHttpClient; import org.apache.http.impl.client.HttpClients; import org.apache.http.ssl.SSLContextBuilder; -import org.apache.http.ssl.TrustStrategy; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.core.io.Resource; -import org.springframework.http.client.ClientHttpRequestFactory; import org.springframework.http.client.HttpComponentsClientHttpRequestFactory; import org.springframework.web.client.RestTemplate; @@ -40,20 +37,10 @@ public class RestTemplateSSLConfiguration { SSLConnectionSocketFactory sslConFactory = new SSLConnectionSocketFactory(sslContext); CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(sslConFactory).build(); - ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); + HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(httpClient); + //requestFactory.setReadTimeout(15000); return new RestTemplate(requestFactory); } - @Bean - public RestTemplate restTemplate2() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, - CertificateException, IOException { - TrustStrategy acceptingTrustStrategy = (x509Certificates, s) -> true; - SSLContext sslContext = org.apache.http.ssl.SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build(); - SSLConnectionSocketFactory csf = new SSLConnectionSocketFactory(sslContext, new NoopHostnameVerifier()); - CloseableHttpClient httpClient = HttpClients.custom().setSSLSocketFactory(csf).build(); - HttpComponentsClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(); - requestFactory.setHttpClient(httpClient); - return new RestTemplate(requestFactory); - } } \ No newline at end of file diff --git a/sly-crm-service/src/main/java/hu/user/lis/service/nav/TaxOfficeInvoiceService.java b/sly-crm-service/src/main/java/hu/user/lis/service/nav/TaxOfficeInvoiceService.java index 8023f78..e9e5c7b 100644 --- a/sly-crm-service/src/main/java/hu/user/lis/service/nav/TaxOfficeInvoiceService.java +++ b/sly-crm-service/src/main/java/hu/user/lis/service/nav/TaxOfficeInvoiceService.java @@ -1,6 +1,12 @@ package hu.user.lis.service.nav; -import hu.gov.nav.schemas.osa._3_0.api.*; +import hu.gov.nav.schemas.osa._3_0.api.InvoiceDataResultType; +import hu.gov.nav.schemas.osa._3_0.api.InvoiceDirectionType; +import hu.gov.nav.schemas.osa._3_0.api.InvoiceNumberQueryType; +import hu.gov.nav.schemas.osa._3_0.api.QueryInvoiceDataRequest; +import hu.gov.nav.schemas.osa._3_0.api.QueryInvoiceDataResponse; +import hu.gov.nav.schemas.osa._3_0.api.QueryInvoiceDigestRequest; +import hu.gov.nav.schemas.osa._3_0.api.QueryInvoiceDigestResponse; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -49,7 +55,7 @@ public class TaxOfficeInvoiceService { public String queryInboundInvoiceDataAsString(String invoiceNumber, String supplierTaxNumber) throws Exception { InvoiceNumberQueryType query = new InvoiceNumberQueryType(); - //query.setInvoiceDirection(InvoiceDirectionType.INBOUND); + query.setInvoiceDirection(InvoiceDirectionType.INBOUND); query.setInvoiceNumber(invoiceNumber); query.setSupplierTaxNumber(supplierTaxNumber); diff --git a/sly-crm-service/src/main/resources/NAV/schemas/catalog.xml b/sly-crm-service/src/main/resources/NAV/schemas/catalog.xml new file mode 100644 index 0000000..3886fa4 --- /dev/null +++ b/sly-crm-service/src/main/resources/NAV/schemas/catalog.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/sly-crm-service/src/main/resources/NAV/schemas/common.xsd b/sly-crm-service/src/main/resources/NAV/schemas/common.xsd index bc76bf2..6598968 100644 --- a/sly-crm-service/src/main/resources/NAV/schemas/common.xsd +++ b/sly-crm-service/src/main/resources/NAV/schemas/common.xsd @@ -3,7 +3,7 @@ # Project: NAV NTCA Common XML séma # Author: NAV Informatikai Intézet -# Version: v1.0 RC4 2023/02/10 +# Version: v1.0 2020/11/23 --> @@ -202,15 +202,6 @@ - - - Általános egész szám típus - Generic unsigned integer type - - - - - SHA256 kód megadására szolgáló típus @@ -367,27 +358,6 @@ - - - SWIFT kódot leíró típus - SWIFT code type - - - - - - - - - - Adóazonosító jel típus - Tax identification number type - - - - - - Az adószám nyolc jegyű törzsszám része @@ -466,32 +436,6 @@ - - - Lokalizációt jelölő típus - Localization type - - - - - Magyar - Hungarian - - - - - Angol - English - - - - - Német - German - - - - Felhasználónév típus diff --git a/sly-crm-service/src/main/resources/NAV/schemas/invoiceAnnulment.xsd b/sly-crm-service/src/main/resources/NAV/schemas/invoiceAnnulment.xsd index cf60de5..791fa1e 100644 --- a/sly-crm-service/src/main/resources/NAV/schemas/invoiceAnnulment.xsd +++ b/sly-crm-service/src/main/resources/NAV/schemas/invoiceAnnulment.xsd @@ -5,103 +5,82 @@ # Version: v3.0 2020/07/31 --> - - - - - - Technikai érvénytelenítés kód típusa - Technical annulment code type - - - - - Hibás adattartalom miatti technikai érvénytelenítés - - Technical annulment due to erratic data content - - - - - Hibás számlaszám miatti technikai érvénytelenítés - Technical annulment due to erratic invoice number - - - - - Hibás számla kiállítási dátum miatti technikai érvénytelenítés - - Technical annulment due to erratic invoice issue date - - - - - - Hibás elektronikus számla hash érték miatti technikai - érvénytelenítés - - Technical annulment due to erratic electronic invoice hash value - - - - - - - - Korábbi adatszolgáltatás technikai érvénytelenítésének adatai - - Data of technical annulment concerning previous data exchange - - - - - - A technikai érvénytelenítéssel érintett számla vagy módosító okirat - sorszáma - - Sequential number of the invoice or modification document to be - annuled - - - - - - A technikai érvénytelenítés időbélyege a forrásrendszerben UTC idő - szerint - - Timestamp of the technical annulment in UTC time - - - - - A technikai érvénytelenítés kódja - Technical annulment code - - - - - A technikai érvénytelenítés oka - Technical annulment reason - - - - - - - XML root element, a technikai érvénytelenítés adatait leíró típus, amelyet - BASE64 kódoltan tartalmaz az invoiceApi sémaleíró invoiceAnnulment elementje - - XML root element, technical annulment data type in BASE64 encoding, - equivalent with the invoiceApi schema definition's invoiceAnnulment element - - - - - - - - + + + + + + Technikai érvénytelenítés kód típusa + Technical annulment code type + + + + + Hibás adattartalom miatti technikai érvénytelenítés + Technical annulment due to erratic data content + + + + + Hibás számlaszám miatti technikai érvénytelenítés + Technical annulment due to erratic invoice number + + + + + Hibás számla kiállítási dátum miatti technikai érvénytelenítés + Technical annulment due to erratic invoice issue date + + + + + Hibás elektronikus számla hash érték miatti technikai érvénytelenítés + Technical annulment due to erratic electronic invoice hash value + + + + + + + Korábbi adatszolgáltatás technikai érvénytelenítésének adatai + Data of technical annulment concerning previous data exchange + + + + + A technikai érvénytelenítéssel érintett számla vagy módosító okirat sorszáma + Sequential number of the invoice or modification document to be annuled + + + + + A technikai érvénytelenítés időbélyege a forrásrendszerben UTC idő szerint + Timestamp of the technical annulment in UTC time + + + + + A technikai érvénytelenítés kódja + Technical annulment code + + + + + A technikai érvénytelenítés oka + Technical annulment reason + + + + + + + XML root element, a technikai érvénytelenítés adatait leíró típus, amelyet BASE64 kódoltan tartalmaz az invoiceApi sémaleíró invoiceAnnulment elementje + XML root element, technical annulment data type in BASE64 encoding, equivalent with the invoiceApi schema definition's invoiceAnnulment element + + + + + + + diff --git a/sly-crm-service/src/main/resources/NAV/schemas/invoiceApi.xsd b/sly-crm-service/src/main/resources/NAV/schemas/invoiceApi.xsd index 53d1209..78a6b58 100644 --- a/sly-crm-service/src/main/resources/NAV/schemas/invoiceApi.xsd +++ b/sly-crm-service/src/main/resources/NAV/schemas/invoiceApi.xsd @@ -1602,7 +1602,7 @@ A kérés feldolgozási státusza - Processing status of the request + Processing status of the request diff --git a/sly-crm-ui/src/main/resources/web/index.zul b/sly-crm-ui/src/main/resources/web/index.zul index d3f3abd..f479206 100644 --- a/sly-crm-ui/src/main/resources/web/index.zul +++ b/sly-crm-ui/src/main/resources/web/index.zul @@ -128,10 +128,10 @@ - - +