[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Re: [ubl-dev] Test Assertions for UBL Calculation Model?
To UBL-DEV and UBL-comment I've been looking at prototyping some test assertions (TAs) to represent the UBL Calculation Model (for possible conformance testing in future) - albeit what is implied by the semantic definitions in the UBL 2.0 schema set. I'm using the OASIS Test Assertions TC TA model, guidelines and markup. I anticipate needing to feedback to UBL TC any ambiguities and/or corner cases in the definitions that this process turns up. One which has just turned up is the LineExtensionAmount which seems to be ambiguous in that it would appear (from the invoice example in the 2.0 package) to be at document level the total of all LineExtensionAmounts at line level. The ambiguity is that the definition doesn't very well support this apprently safe interpretation in that it could be read to mean that the document level total LineExtensionAmount also includes allowances and charges. These would normally be not in the LineExtensionAmount but in the TaxExclusiveAmount, as shown in the UBL invoice example. Here is a provisional prototype of my TA Set - no liability if it's wrong, etc <?xml version="1.0" encoding="UTF-8"?> <testAssertionSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../TestAssertionMarkup-0-4/testAssertion-0-4.xsd" id="documentengineeringservices:sdg:ubl:2:ta:prototype:0-0-2"> <header> <var name="ubl-invoice-2-0-schema" lg="xpath20">doc("http://docs.oasis-open.org/ubl/os-UBL-2.0/xsd/common/UBL-CommonAggregateComponents-2.0.xsd")</var> <var name="ubl-invoice-sum-line-extensions" lg="xpath20">sum(/Invoice/cac:InvoiceLine/cbc:LineExtensionAmount)</var> <tag name="invoice"/> </header> <testAssertion id="INVTOT001"> <normativeSource> <refSourceItem lg="xpath20">$ubl-invoice-2-0-schema/xsd:schema/xsd:complexType[@name='MonetaryTotalType']/xsd:sequence[1]/xsd:element[@ref='cbc:LineExtensionAmount']/xsd:annotation[1]/xsd:documentation[1]/ccts:Component[1]/ccts:Definition[1]</refSourceItem> </normativeSource> <target lg="xpath20">number(/Invoice/cac:LegalMonetaryTotal[1]/cbc:LineExtensionAmount[1])</target> <prerequisite lg="xpath20">exists(/Invoice/cac:InvoiceLine[1]/cbc:LineExtensionAmount[1])</prerequisite> <predicate lg="xpath20">number(/Invoice/cac:LegalMonetaryTotal[1]/cbc:LineExtensionAmount[1]) eq (sum(/Invoice/cac:InvoiceLine/cbc:LineExtensionAmount) + sum(/Invoice/cac:AllowanceCharge/cbc:Amount))</predicate> <prescriptionLevel>preferred</prescriptionLevel> <tag name="invoice:total"/> </testAssertion> <testAssertion id="INVTAX001"> <normativeSource><comment>general practice but no known normative source</comment></normativeSource> <target lg="xpath20">count(distinct-values(/Invoice/cac:InvoiceLine/cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount/@currencyID))</target> <prerequisite lg="ta">is-tax-invoice-001 = 'pass'</prerequisite> <predicate>count(distinct-values(/Invoice/cac:InvoiceLine/cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount/@currencyID)) gt 0</predicate> <prescriptionLevel>preferred</prescriptionLevel> <tag name="invoice:tax"/> </testAssertion> <testAssertion id="INVTAX002"> <normativeSource><comment>general practice but no known normative source</comment></normativeSource> <target lg="xpath20">count(distinct-values(/Invoice/cac:InvoiceLine/cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount/@currencyID))</target> <prerequisite lg="ta">is-tax-invoice-001 = 'pass' and INVTAX001 = "pass"</prerequisite> <predicate lg="xpath20">count(distinct-values(/Invoice/cac:InvoiceLine/cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount/@currencyID)) lt 2</predicate> <prescriptionLevel>preferred</prescriptionLevel> <tag name="invoice:tax"/> </testAssertion> <testAssertion id="INVTAX003"> <normativeSource> <refSourceItem>$ubl-invoice-2-0-schema/xsd:schema/xsd:complexType[@name='TaxTotalType']/xsd:sequence[1]/xsd:element[@ref='cbc:TaxAmount']/xsd:annotation[1]/xsd:documentation[1]/ccts:Component[1]/ccts:Definition[1]</refSourceItem> <refSourceItem>$ubl-invoice-2-0-schema/xsd:schema/xsd:complexType[@name='TaxSubtotalType']/xsd:sequence[1]/xsd:element[@ref='cbc:TaxAmount']/xsd:annotation[1]/xsd:documentation[1]/ccts:Component[1]/ccts:Definition[1]</refSourceItem> </normativeSource> <target lg="xpath20">sum(/Invoice/cac:TaxTotal/cbc:TaxAmount[1])</target> <prerequisite lg="ta">is-tax-invoice-001 = 'pass' and INVTAX001 = 'pass'</prerequisite> <predicate lg="xpath20">sum(/Invoice/cac:TaxTotal/cbc:TaxAmount[1]) eq sum(/Invoice/cac:TaxTotal/cac:TaxSubtotal/cbc:TaxAmount[1])</predicate> <prescriptionLevel>preferred</prescriptionLevel> <tag name="invoice:tax"/> </testAssertion> <testAssertionSet id="is-tax-invoice-001" definesNormativeProperty="true"> <header> <normativePropertyTag>TaxInvoice</normativePropertyTag> </header> <testAssertion id="TAXINV001"> <normativeSource><comment>general practice but no known normative source</comment></normativeSource> <predicate lg="xpath20">exists(ubl-invoice-2-0-instance//cbc:TaxAmount)</predicate> <prescriptionLevel>mandatory</prescriptionLevel> <tag name="invoice:tax"/> </testAssertion> <testAssertion id="TAXINV002" lg="en-us"> <normativeSource><comment>is a tax invoice according to most relevant tax rules</comment></normativeSource> <predicate lg="en-us">is a tax invoice</predicate> <prescriptionLevel>mandatory</prescriptionLevel> <tag name="invoice:tax"/> </testAssertion> </testAssertionSet> </testAssertionSet> Stephen D Green
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]