<?xml version="1.0" encoding="UTF-8"?>
<!--

    Licensed under European Union Public Licence (EUPL) version 1.2.

-->
<testSet xmlns="http://difi.no/xsd/vefa/validator/1.0" configuration="tc434-ubl">
	<assert>
		<scope>BR-CO-12</scope>
	</assert>
	<test>
		<assert>
			<description>Verify that sum of charges on document level = Σ Document level charge amount.</description>
			<success>BR-CO-12</success>
		</assert>
		<Invoice
			xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
			xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
			xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">100</cbc:Amount>
			</cac:AllowanceCharge>

			<cac:LegalMonetaryTotal>
				<cbc:ChargeTotalAmount>100</cbc:ChargeTotalAmount>
			</cac:LegalMonetaryTotal>

		</Invoice>
	</test>

	<test>
		<assert>
			<description>Verify that sum of charges on document level = Σ Document level charge amount.</description>
			<success>BR-CO-12</success>
		</assert>
		<Invoice
			xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
			xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
			xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">100</cbc:Amount>
			</cac:AllowanceCharge>

			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">100</cbc:Amount>
			</cac:AllowanceCharge>

			<cac:LegalMonetaryTotal>
				<cbc:ChargeTotalAmount>100</cbc:ChargeTotalAmount>
			</cac:LegalMonetaryTotal>

		</Invoice>
	</test>
	<test>
		<assert>
			<description>Verify that sum of charges on document level = Σ Document level charge amount.</description>
			<success>BR-CO-12</success>
		</assert>
		<Invoice
			xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
			xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
			xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">0</cbc:Amount>
			</cac:AllowanceCharge>

			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">100</cbc:Amount>
			</cac:AllowanceCharge>

			<cac:LegalMonetaryTotal>
				<cbc:ChargeTotalAmount>.00</cbc:ChargeTotalAmount>
			</cac:LegalMonetaryTotal>

		</Invoice>
	</test>

	<test>
		<assert>
			<description>Verify that sum of charges on document level = Σ Document level charge amount.</description>
			<success>BR-CO-12</success>
		</assert>
		<Invoice
			xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
			xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
			xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">100</cbc:Amount>
			</cac:AllowanceCharge>
			
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">1000.0</cbc:Amount>
			</cac:AllowanceCharge>
			
			<cac:LegalMonetaryTotal>
				<cbc:ChargeTotalAmount>1100.00</cbc:ChargeTotalAmount>
			</cac:LegalMonetaryTotal>
			
		</Invoice>
	</test>

	<test>
		<assert>
			<description>Trigger error if sum of charges on document level != Σ Document level charge amount.</description>
			<error>BR-CO-12</error>
		</assert>
		<Invoice
			xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
			xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
			xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">100</cbc:Amount>
			</cac:AllowanceCharge>
			
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">1000.0</cbc:Amount>
			</cac:AllowanceCharge>
			
			<cac:LegalMonetaryTotal>
				<cbc:ChargeTotalAmount>1000.00</cbc:ChargeTotalAmount>
			</cac:LegalMonetaryTotal>

		</Invoice>
	</test>
	<test>
		<assert>
			<description>Trigger error if sum of charges on document level != Σ Document level charge amount.</description>
			<error>BR-CO-12</error>
		</assert>
		<Invoice
			xmlns:cac="urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2"
			xmlns:cbc="urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2"
			xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>false</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">1000</cbc:Amount>
			</cac:AllowanceCharge>
			
			<cac:AllowanceCharge>
				<cbc:ChargeIndicator>true</cbc:ChargeIndicator>
				<cbc:Amount currencyID="NOK">0.0</cbc:Amount>
			</cac:AllowanceCharge>
			
			<cac:LegalMonetaryTotal>
				<cbc:ChargeTotalAmount>1000.00</cbc:ChargeTotalAmount>
			</cac:LegalMonetaryTotal>
			
		</Invoice>
	</test>
</testSet>
