Anpassung SEPA Export Polen
This commit is contained in:
parent
13bef49e39
commit
77bad00696
4 changed files with 397 additions and 5 deletions
|
|
@ -54,9 +54,9 @@ public class TestSEPATransform {
|
||||||
@Test
|
@Test
|
||||||
public void testBankPolski() throws IOException {
|
public void testBankPolski() throws IOException {
|
||||||
String MODEL_PATH_XML = "sepa/beispiel-daten.xml";
|
String MODEL_PATH_XML = "sepa/beispiel-daten.xml";
|
||||||
String MODEL_PATH_XSL = "sepa/sepa-2.0.10-pl.xsl";
|
String MODEL_PATH_XSL = "sepa/sepa-2.0.11-pl.xsl";
|
||||||
try {
|
try {
|
||||||
XSLTester.transform(MODEL_PATH_XML, MODEL_PATH_XSL, "../reports/sepa/result_sepa02.xml");
|
XSLTester.transform(MODEL_PATH_XML, MODEL_PATH_XSL, "../reports/sepa/result_sepa-pl.xml");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Assert.fail();
|
Assert.fail();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -165,8 +165,8 @@
|
||||||
<item name="$workflowsummary">
|
<item name="$workflowsummary">
|
||||||
<value xsi:type="xs:string">Invoice Example-2</value>
|
<value xsi:type="xs:string">Invoice Example-2</value>
|
||||||
</item>
|
</item>
|
||||||
<item name="numsequencenumber">
|
<item name="sequencenumber">
|
||||||
<value xsi:type="xs:string">3453540000</value>
|
<value xsi:type="xs:string">7000005</value>
|
||||||
</item>
|
</item>
|
||||||
<item name="cdtr.bic">
|
<item name="cdtr.bic">
|
||||||
<value xsi:type="xs:string">XXXADEMM</value>
|
<value xsi:type="xs:string">XXXADEMM</value>
|
||||||
|
|
@ -193,7 +193,7 @@
|
||||||
<value xsi:type="xs:dateTime">2020-07-07T00:00:00+02:00</value>
|
<value xsi:type="xs:dateTime">2020-07-07T00:00:00+02:00</value>
|
||||||
</item>
|
</item>
|
||||||
<item name="invoice.number">
|
<item name="invoice.number">
|
||||||
<value xsi:type="xs:string">202007000175</value>
|
<value xsi:type="xs:string">20200700017-xxxAA-üü5</value>
|
||||||
</item>
|
</item>
|
||||||
<item name="invoice.total">
|
<item name="invoice.total">
|
||||||
<value xsi:type="xs:decimal">73.06</value>
|
<value xsi:type="xs:decimal">73.06</value>
|
||||||
|
|
|
||||||
196
reports/sepa/sepa-2.0.11-pl.imixs-report
Normal file
196
reports/sepa/sepa-2.0.11-pl.imixs-report
Normal file
File diff suppressed because one or more lines are too long
196
reports/sepa/sepa-2.0.11-pl.xsl
Normal file
196
reports/sepa/sepa-2.0.11-pl.xsl
Normal file
|
|
@ -0,0 +1,196 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
|
<xsl:stylesheet
|
||||||
|
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||||
|
xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||||
|
version="2.0">
|
||||||
|
<xsl:strip-space elements="*" />
|
||||||
|
<xsl:output method="xml" indent="yes" encoding="UTF-8" standalone="yes" />
|
||||||
|
|
||||||
|
<xsl:template match="/">
|
||||||
|
<xsl:variable name="now" select="current-dateTime()" />
|
||||||
|
|
||||||
|
<Document
|
||||||
|
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03 pain.001.001.03.xsd">
|
||||||
|
<CstmrCdtTrfInitn>
|
||||||
|
|
||||||
|
<!-- generate header info -->
|
||||||
|
<!-- compute count of invoices -->
|
||||||
|
<xsl:variable name="count"
|
||||||
|
select="count(/data/document[starts-with(normalize-space(item[@name = '$modelversion']/value),'rechnungseingang')]/item[@name='$uniqueid']/value)" />
|
||||||
|
<!-- compute total amount -->
|
||||||
|
<xsl:variable name="totalsum"
|
||||||
|
select="xs:decimal(sum(/data/document[starts-with(normalize-space(item[@name = '$modelversion']/value),'rechnungseingang')]/item[@name='invoice.total']/value))" />
|
||||||
|
<!-- round to 2 digits -->
|
||||||
|
<xsl:variable name="total"
|
||||||
|
select="format-number(xs:decimal(round-half-to-even($totalsum, 2)), '0.00')" />
|
||||||
|
|
||||||
|
<!-- shortcut for the sepa export document -->
|
||||||
|
<xsl:variable name="exportWorkitem"
|
||||||
|
select="/data/document[normalize-space(item[@name = '$workflowgroup']/value) = 'SEPA-Export']" />
|
||||||
|
|
||||||
|
<GrpHdr>
|
||||||
|
<MsgId>
|
||||||
|
<xsl:value-of
|
||||||
|
select="replace($exportWorkitem/item[@name='$uniqueid']/value, '-', '')" />
|
||||||
|
</MsgId>
|
||||||
|
<CreDtTm>
|
||||||
|
<xsl:value-of
|
||||||
|
select="format-dateTime($now, '[Y0001]-[M01]-[D01]T[H01]:[m01]:[s01]')" />
|
||||||
|
</CreDtTm>
|
||||||
|
<NbOfTxs>
|
||||||
|
<xsl:value-of select="$count" />
|
||||||
|
</NbOfTxs>
|
||||||
|
<CtrlSum>
|
||||||
|
<!-- round to 2 digits -->
|
||||||
|
<xsl:value-of select="$total" />
|
||||||
|
</CtrlSum>
|
||||||
|
<InitgPty>
|
||||||
|
<Nm>
|
||||||
|
<xsl:value-of
|
||||||
|
select="$exportWorkitem/item[@name='dbtr.name']/value" />
|
||||||
|
</Nm>
|
||||||
|
</InitgPty>
|
||||||
|
</GrpHdr>
|
||||||
|
|
||||||
|
<PmtInf>
|
||||||
|
<PmtInfId>
|
||||||
|
<xsl:value-of
|
||||||
|
select="replace($exportWorkitem/item[@name='$uniqueid']/value, '-', '')" />
|
||||||
|
<xsl:text>-1</xsl:text>
|
||||||
|
</PmtInfId>
|
||||||
|
<PmtMtd>TRF</PmtMtd>
|
||||||
|
<NbOfTxs>
|
||||||
|
<xsl:value-of select="$count" />
|
||||||
|
</NbOfTxs>
|
||||||
|
<CtrlSum>
|
||||||
|
<!-- round to 2 digits -->
|
||||||
|
<xsl:value-of select="$total" />
|
||||||
|
</CtrlSum>
|
||||||
|
<PmtTpInf>
|
||||||
|
<SvcLvl>
|
||||||
|
<Cd>SEPA</Cd>
|
||||||
|
</SvcLvl>
|
||||||
|
</PmtTpInf>
|
||||||
|
<ReqdExctnDt>
|
||||||
|
<xsl:value-of
|
||||||
|
select="format-dateTime($now, '[Y0001]-[M01]-[D01]')" />
|
||||||
|
</ReqdExctnDt>
|
||||||
|
<Dbtr>
|
||||||
|
<Nm>
|
||||||
|
<xsl:value-of
|
||||||
|
select="$exportWorkitem/item[@name='dbtr.name']/value" />
|
||||||
|
</Nm>
|
||||||
|
</Dbtr>
|
||||||
|
<DbtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>
|
||||||
|
<xsl:value-of
|
||||||
|
select="replace($exportWorkitem/item[@name='dbtr.iban']/value, ' ', '')" />
|
||||||
|
</IBAN>
|
||||||
|
</Id>
|
||||||
|
</DbtrAcct>
|
||||||
|
<DbtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>
|
||||||
|
<xsl:value-of
|
||||||
|
select="replace($exportWorkitem/item[@name='dbtr.bic']/value, ' ', '')" />
|
||||||
|
</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</DbtrAgt>
|
||||||
|
<!--
|
||||||
|
SHAR – Charges are shared between debtor and creditor
|
||||||
|
SLEV – Charges are handled according to service level
|
||||||
|
-->
|
||||||
|
<ChrgBr>SHAR</ChrgBr>
|
||||||
|
<!-- generate CdtTrfTxInf for each invoice -->
|
||||||
|
<xsl:apply-templates
|
||||||
|
select="/data/document[starts-with(normalize-space(item[@name = '$modelversion']/value),'rechnungseingang')]" />
|
||||||
|
</PmtInf>
|
||||||
|
</CstmrCdtTrfInitn>
|
||||||
|
</Document>
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- This template builds sepa header info -->
|
||||||
|
<xsl:template
|
||||||
|
match="/data/document[normalize-space(item[@name = '$workflowgroup']/value) = 'SEPA-Export']">
|
||||||
|
<!-- not in use -->
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- This template builds sepa payment info for each invoice -->
|
||||||
|
<xsl:template
|
||||||
|
match="/data/document[starts-with(normalize-space(item[@name = '$modelversion']/value),'rechnungseingang')]">
|
||||||
|
|
||||||
|
<!-- round to 2 digits - geht nur mit sum funktion -->
|
||||||
|
<xsl:variable
|
||||||
|
name="wert2"
|
||||||
|
select="format-number(xs:decimal(round-half-to-even(item[@name='invoice.total']/value, 2)), '0.00')" />
|
||||||
|
|
||||||
|
<CdtTrfTxInf
|
||||||
|
xmlns="urn:iso:std:iso:20022:tech:xsd:pain.001.001.03">
|
||||||
|
<PmtId>
|
||||||
|
<EndToEndId>NOTPROVIDED</EndToEndId>
|
||||||
|
</PmtId>
|
||||||
|
<Amt>
|
||||||
|
<InstdAmt>
|
||||||
|
<xsl:attribute name="Ccy"><xsl:value-of
|
||||||
|
select="item[@name='invoice.currency']/value" /></xsl:attribute>
|
||||||
|
<!-- round to 2 digits -->
|
||||||
|
<xsl:value-of select="$wert2" />
|
||||||
|
</InstdAmt>
|
||||||
|
</Amt>
|
||||||
|
<CdtrAgt>
|
||||||
|
<FinInstnId>
|
||||||
|
<BIC>
|
||||||
|
<xsl:value-of select="replace(item[@name='cdtr.bic']/value, ' ', '')" />
|
||||||
|
</BIC>
|
||||||
|
</FinInstnId>
|
||||||
|
</CdtrAgt>
|
||||||
|
<Cdtr>
|
||||||
|
<!-- MAX70 -->
|
||||||
|
<Nm>
|
||||||
|
<!-- <xsl:value-of select="substring(item[@name='cdtr.name']/value, 1, 70)" /> -->
|
||||||
|
<!-- entfernen der non ascii zeichen
|
||||||
|
<xsl:value-of
|
||||||
|
select="substring(replace(item[@name='cdtr.name']/value, '\P{IsBasicLatin}', ''), 1, 70)" />
|
||||||
|
-->
|
||||||
|
|
||||||
|
<xsl:value-of
|
||||||
|
select="substring(translate(
|
||||||
|
normalize-space(item[@name='cdtr.name']/value),
|
||||||
|
translate(item[@name='cdtr.name']/value, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 /-?:().,''+''{}.', ''),''), 1, 70)" />
|
||||||
|
</Nm>
|
||||||
|
</Cdtr>
|
||||||
|
<CdtrAcct>
|
||||||
|
<Id>
|
||||||
|
<IBAN>
|
||||||
|
<xsl:value-of select="replace(item[@name='cdtr.iban']/value, ' ', '')" />
|
||||||
|
</IBAN>
|
||||||
|
</Id>
|
||||||
|
</CdtrAcct>
|
||||||
|
<RmtInf>
|
||||||
|
<!-- Max140Text -->
|
||||||
|
<Ustrd>
|
||||||
|
<xsl:variable name="sequenceNumber" select="item[@name='sequencenumber']/value" />
|
||||||
|
<xsl:variable name="invoiceNumber" select="item[@name='invoice.number']/value" />
|
||||||
|
<xsl:variable name="combinedInfo">
|
||||||
|
<xsl:value-of select="$sequenceNumber" />
|
||||||
|
<xsl:if
|
||||||
|
test="$sequenceNumber != '' and $invoiceNumber != ''">/</xsl:if>
|
||||||
|
<xsl:value-of
|
||||||
|
select="$invoiceNumber" />
|
||||||
|
</xsl:variable>
|
||||||
|
<xsl:value-of
|
||||||
|
select="substring(translate(
|
||||||
|
normalize-space($combinedInfo),
|
||||||
|
translate($combinedInfo, 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 /-?:().,''+''{}.', ''),''), 1, 140)" />
|
||||||
|
</Ustrd>
|
||||||
|
</RmtInf>
|
||||||
|
</CdtTrfTxInf>
|
||||||
|
|
||||||
|
</xsl:template>
|
||||||
|
|
||||||
|
</xsl:stylesheet>
|
||||||
Loading…
Reference in a new issue