Skip to content

Commit

Permalink
Test fix
Browse files Browse the repository at this point in the history
  • Loading branch information
phax committed Dec 23, 2024
1 parent 3d23bc4 commit 2e8be62
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_21.MonetaryTotalType;
import oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_21.PaymentTermsType;
import oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_21.TaxCategoryType;
import oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_21.TaxSubtotalType;
import oasis.names.specification.ubl.schema.xsd.commonaggregatecomponents_21.TaxTotalType;
import oasis.names.specification.ubl.schema.xsd.commonbasiccomponents_21.NoteType;
import oasis.names.specification.ubl.schema.xsd.invoice_21.InvoiceType;
Expand Down Expand Up @@ -231,7 +232,8 @@ private static List <SupplyChainTradeLineItemType> _convertInvoiceLine (final Li
final TradeTaxType aTTT = new TradeTaxType ();
aTTT.setTypeCode (aTCT.getTaxScheme ().getIDValue ());
aTTT.setCategoryCode (aTCT.getIDValue ());
aTTT.setRateApplicablePercent (aTCT.getPercentValue ());
if (aTCT.getPercent () != null)
aTTT.setRateApplicablePercent (aTCT.getPercentValue ());
aLstTTT.add (aTTT);
}
aLTST.setApplicableTradeTax (aLstTTT);
Expand Down Expand Up @@ -783,37 +785,36 @@ private static List <TradeTaxType> _convertApplicableTradeTax (final InvoiceType
{
final List <TradeTaxType> aLstTTTST = new ArrayList <> ();
for (final TaxTotalType aTTT : aUBLInvoice.getTaxTotal ())
{
if (!aTTT.getTaxSubtotal ().isEmpty ())
{
final TaxSubtotalType aFirst = aTTT.getTaxSubtotal ().get (0);
final TradeTaxType aTTTST = new TradeTaxType ();
if (aTTT.getTaxSubtotal ().get (0).getTaxAmount () != null)
if (aFirst.getTaxAmount () != null)
{
aTTTST.setCalculatedAmount (_convertAmountType (aTTT.getTaxSubtotal ().get (0).getTaxAmount ()));
aTTTST.setCalculatedAmount (_convertAmountType (aFirst.getTaxAmount ()));
}
if (aTTT.getTaxSubtotal ().get (0).getTaxCategory () != null)
if (aFirst.getTaxCategory () != null)
{
aTTTST.setTypeCode (aTTT.getTaxSubtotal ().get (0).getTaxCategory ().getIDValue ());
aTTTST.setTypeCode (aFirst.getTaxCategory ().getIDValue ());
}
if (aTTT.getTaxSubtotal ().get (0).getTaxableAmount () != null)
if (aFirst.getTaxableAmount () != null)
{
aTTTST.setBasisAmount (_convertAmountType (aTTT.getTaxSubtotal ().get (0).getTaxableAmount ()));
aTTTST.setBasisAmount (_convertAmountType (aFirst.getTaxableAmount ()));
}

if (aTTT.getTaxSubtotal ().get (0).getTaxCategory () != null)
if (aFirst.getTaxCategory () != null)
{
if (!aTTT.getTaxSubtotal ().get (0).getTaxCategory ().getTaxExemptionReason ().isEmpty ())
if (!aFirst.getTaxCategory ().getTaxExemptionReason ().isEmpty ())
{
aTTTST.setExemptionReason (aTTT.getTaxSubtotal ().get (0).getTaxCategory ().getTaxExemptionReason ().get (0).getValue ());
aTTTST.setExemptionReason (aFirst.getTaxCategory ().getTaxExemptionReason ().get (0).getValue ());
}
if (aTTT.getTaxSubtotal ().get (0).getTaxCategory ().getTaxExemptionReasonCode () != null)
if (aFirst.getTaxCategory ().getTaxExemptionReasonCode () != null)
{
aTTTST.setExemptionReasonCode (aTTT.getTaxSubtotal ().get (0).getTaxCategory ().getTaxExemptionReasonCode ().getValue ());
aTTTST.setExemptionReasonCode (aFirst.getTaxCategory ().getTaxExemptionReasonCode ().getValue ());
}
}
aLstTTTST.add (aTTTST);
}
}
return aLstTTTST;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ public void testConvertAndValidateAll ()
final ESuccess eSuccess = new CIID16BCrossIndustryInvoiceTypeMarshaller ().setFormattedOutput (true)
.setCollectErrors (aErrorList)
.write (aCrossIndustryInvoice, aDestFile);
if (aErrorList.containsAtLeastOneError ())
LOGGER.error (new CIID16BCrossIndustryInvoiceTypeMarshaller ().setFormattedOutput (true)
.setUseSchema (false)
.setCollectErrors (aErrorList)
.getAsString (aCrossIndustryInvoice));
assertTrue ("Errors: " + aErrorList.toString (), aErrorList.containsNoError ());
assertTrue (eSuccess.isSuccess ());

Expand Down

0 comments on commit 2e8be62

Please # to comment.