Skip to content

Commit e7ad0e2

Browse files
committed
TaxRegistration,TaxRegistrationSchemeID,...
1 parent bcbb482 commit e7ad0e2

7 files changed

+946
-2
lines changed

Test/DUnitXZUGFeRDTest.dpr

+3-2
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ uses
6565
intf.ZUGFeRDCountryCodes.UnitTests,
6666
intf.ZUGFeRDCurrencyCodes.UnitTests,
6767
intf.ZUGFeRDInvoiceTypes.UnitTests,
68-
intf.ZUGFeRDMimeTypeMapper.UnitTests
68+
intf.ZUGFeRDMimeTypeMapper.UnitTests,
69+
intf.ZUGFeRDTaxRegistrationSchemeID.UnitTests,
70+
intf.ZUGFeRDTaxTypes.UnitTests
6971
;
7072

7173
//Übersetze folgenden C#-Code nach Delphi. Wenn ein Klassenname übersetzt wird, setze ihm den Präfix TZUGFeRD vorran. Stelle alles als Codeblock dar.
7274
//Translate the following C# code to Delphi. When translating a class name, prefix it with TZUGFeRD.
7375

74-
7576
var
7677
runner : ITestRunner;
7778
results : IRunResults;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
{* Licensed to the Apache Software Foundation (ASF) under one
2+
* or more contributor license agreements. See the NOTICE file
3+
* distributed with this work for additional information
4+
* regarding copyright ownership. The ASF licenses this file
5+
* to you under the Apache License, Version 2.0 (the
6+
* "License"); you may not use this file except in compliance
7+
* with the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.}
17+
18+
unit intf.ZUGFeRDTaxRegistrationSchemeID.UnitTests;
19+
20+
interface
21+
22+
uses
23+
DUnitX.TestFramework, intf.ZUGFeRDTaxRegistrationSchemeID;
24+
25+
type
26+
[TestFixture]
27+
TZUGFeRDTaxRegistrationSchemeIDTest = class
28+
public
29+
[Test]
30+
procedure TestFromString;
31+
[Test]
32+
procedure TestEnumToString;
33+
end;
34+
35+
implementation
36+
37+
procedure TZUGFeRDTaxRegistrationSchemeIDTest.TestFromString;
38+
begin
39+
Assert.AreEqual(TZUGFeRDTaxRegistrationSchemeID.FC, TZUGFeRDTaxRegistrationSchemeIDExtensions.FromString('FC'));
40+
Assert.AreEqual(TZUGFeRDTaxRegistrationSchemeID.VA, TZUGFeRDTaxRegistrationSchemeIDExtensions.FromString('VA'));
41+
Assert.AreEqual(TZUGFeRDTaxRegistrationSchemeID.Unknown, TZUGFeRDTaxRegistrationSchemeIDExtensions.FromString('Unknown'));
42+
Assert.AreEqual(TZUGFeRDTaxRegistrationSchemeID.Unknown, TZUGFeRDTaxRegistrationSchemeIDExtensions.FromString('Invalid'));
43+
end;
44+
45+
procedure TZUGFeRDTaxRegistrationSchemeIDTest.TestEnumToString;
46+
begin
47+
Assert.AreEqual('FC', TZUGFeRDTaxRegistrationSchemeIDExtensions.EnumToString(TZUGFeRDTaxRegistrationSchemeID.FC));
48+
Assert.AreEqual('VA', TZUGFeRDTaxRegistrationSchemeIDExtensions.EnumToString(TZUGFeRDTaxRegistrationSchemeID.VA));
49+
Assert.AreEqual('Unknown', TZUGFeRDTaxRegistrationSchemeIDExtensions.EnumToString(TZUGFeRDTaxRegistrationSchemeID.Unknown));
50+
end;
51+
52+
initialization
53+
54+
//I was hoping to use RTTI to discover the TestFixture classes, however unlike .NET
55+
//if we don't touch the class somehow then the linker will remove
56+
//the class from the resulting exe.
57+
//We could just do this:
58+
//TMyExampleTests.ClassName;
59+
//TExampleFixture2.ClassName;
60+
//which is enough to make the compiler link the classes into the exe, but that seems a
61+
//bit redundent so I guess we'll just use manual registration. If you use the
62+
//{$STRONGLINKTYPES ON} compiler directive then it will link the TestFixtures in and you
63+
//can use RTTI. The downside to that is the resulting exe will potentially much larger.
64+
//Not sure which version {$STRONGLINKTYPES ON} was introduced so we'll allow RTTI and
65+
//manual registration for now.
66+
67+
// TDUnitX.RegisterTestFixture(TZUGFeRDTaxRegistrationSchemeIDTest);
68+
69+
end.
+173
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
{* Licensed to the Apache Software Foundation (ASF) under one
2+
* or more contributor license agreements. See the NOTICE file
3+
* distributed with this work for additional information
4+
* regarding copyright ownership. The ASF licenses this file
5+
* to you under the Apache License, Version 2.0 (the
6+
* "License"); you may not use this file except in compliance
7+
* with the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.}
17+
18+
unit intf.ZUGFeRDTaxTypes.UnitTests;
19+
20+
interface
21+
22+
uses
23+
DUnitX.TestFramework, intf.ZUGFeRDTaxTypes;
24+
25+
type
26+
[TestFixture]
27+
TZUGFeRDTaxTypesTest = class
28+
public
29+
[Test]
30+
procedure TestFromString;
31+
[Test]
32+
procedure TestEnumToString;
33+
end;
34+
35+
implementation
36+
37+
procedure TZUGFeRDTaxTypesTest.TestFromString;
38+
begin
39+
Assert.AreEqual(TZUGFeRDTaxTypes.AAA, TZUGFeRDTaxTypesExtensions.FromString('AAA'));
40+
Assert.AreEqual(TZUGFeRDTaxTypes.AAB, TZUGFeRDTaxTypesExtensions.FromString('AAB'));
41+
Assert.AreEqual(TZUGFeRDTaxTypes.AAC, TZUGFeRDTaxTypesExtensions.FromString('AAC'));
42+
Assert.AreEqual(TZUGFeRDTaxTypes.AAD, TZUGFeRDTaxTypesExtensions.FromString('AAD'));
43+
Assert.AreEqual(TZUGFeRDTaxTypes.AAE, TZUGFeRDTaxTypesExtensions.FromString('AAE'));
44+
Assert.AreEqual(TZUGFeRDTaxTypes.AAF, TZUGFeRDTaxTypesExtensions.FromString('AAF'));
45+
Assert.AreEqual(TZUGFeRDTaxTypes.AAG, TZUGFeRDTaxTypesExtensions.FromString('AAG'));
46+
Assert.AreEqual(TZUGFeRDTaxTypes.AAH, TZUGFeRDTaxTypesExtensions.FromString('AAH'));
47+
Assert.AreEqual(TZUGFeRDTaxTypes.AAI, TZUGFeRDTaxTypesExtensions.FromString('AAI'));
48+
Assert.AreEqual(TZUGFeRDTaxTypes.AAJ, TZUGFeRDTaxTypesExtensions.FromString('AAJ'));
49+
Assert.AreEqual(TZUGFeRDTaxTypes.AAK, TZUGFeRDTaxTypesExtensions.FromString('AAK'));
50+
Assert.AreEqual(TZUGFeRDTaxTypes.AAL, TZUGFeRDTaxTypesExtensions.FromString('AAL'));
51+
Assert.AreEqual(TZUGFeRDTaxTypes.AAM, TZUGFeRDTaxTypesExtensions.FromString('AAM'));
52+
Assert.AreEqual(TZUGFeRDTaxTypes.ADD, TZUGFeRDTaxTypesExtensions.FromString('ADD'));
53+
Assert.AreEqual(TZUGFeRDTaxTypes.BOL, TZUGFeRDTaxTypesExtensions.FromString('BOL'));
54+
Assert.AreEqual(TZUGFeRDTaxTypes.CAP, TZUGFeRDTaxTypesExtensions.FromString('CAP'));
55+
Assert.AreEqual(TZUGFeRDTaxTypes.CAR, TZUGFeRDTaxTypesExtensions.FromString('CAR'));
56+
Assert.AreEqual(TZUGFeRDTaxTypes.COC, TZUGFeRDTaxTypesExtensions.FromString('COC'));
57+
Assert.AreEqual(TZUGFeRDTaxTypes.CST, TZUGFeRDTaxTypesExtensions.FromString('CST'));
58+
Assert.AreEqual(TZUGFeRDTaxTypes.CUD, TZUGFeRDTaxTypesExtensions.FromString('CUD'));
59+
Assert.AreEqual(TZUGFeRDTaxTypes.CVD, TZUGFeRDTaxTypesExtensions.FromString('CVD'));
60+
Assert.AreEqual(TZUGFeRDTaxTypes.ENV, TZUGFeRDTaxTypesExtensions.FromString('ENV'));
61+
Assert.AreEqual(TZUGFeRDTaxTypes.EXC, TZUGFeRDTaxTypesExtensions.FromString('EXC'));
62+
Assert.AreEqual(TZUGFeRDTaxTypes.EXP, TZUGFeRDTaxTypesExtensions.FromString('EXP'));
63+
Assert.AreEqual(TZUGFeRDTaxTypes.FET, TZUGFeRDTaxTypesExtensions.FromString('FET'));
64+
Assert.AreEqual(TZUGFeRDTaxTypes.FRE, TZUGFeRDTaxTypesExtensions.FromString('FRE'));
65+
Assert.AreEqual(TZUGFeRDTaxTypes.GCN, TZUGFeRDTaxTypesExtensions.FromString('GCN'));
66+
Assert.AreEqual(TZUGFeRDTaxTypes.GST, TZUGFeRDTaxTypesExtensions.FromString('GST'));
67+
Assert.AreEqual(TZUGFeRDTaxTypes.ILL, TZUGFeRDTaxTypesExtensions.FromString('ILL'));
68+
Assert.AreEqual(TZUGFeRDTaxTypes.IMP, TZUGFeRDTaxTypesExtensions.FromString('IMP'));
69+
Assert.AreEqual(TZUGFeRDTaxTypes.IND, TZUGFeRDTaxTypesExtensions.FromString('IND'));
70+
Assert.AreEqual(TZUGFeRDTaxTypes.LAC, TZUGFeRDTaxTypesExtensions.FromString('LAC'));
71+
Assert.AreEqual(TZUGFeRDTaxTypes.LCN, TZUGFeRDTaxTypesExtensions.FromString('LCN'));
72+
Assert.AreEqual(TZUGFeRDTaxTypes.LDP, TZUGFeRDTaxTypesExtensions.FromString('LDP'));
73+
Assert.AreEqual(TZUGFeRDTaxTypes.LOC, TZUGFeRDTaxTypesExtensions.FromString('LOC'));
74+
Assert.AreEqual(TZUGFeRDTaxTypes.LST, TZUGFeRDTaxTypesExtensions.FromString('LST'));
75+
Assert.AreEqual(TZUGFeRDTaxTypes.MCA, TZUGFeRDTaxTypesExtensions.FromString('MCA'));
76+
Assert.AreEqual(TZUGFeRDTaxTypes.MCD, TZUGFeRDTaxTypesExtensions.FromString('MCD'));
77+
Assert.AreEqual(TZUGFeRDTaxTypes.OTH, TZUGFeRDTaxTypesExtensions.FromString('OTH'));
78+
Assert.AreEqual(TZUGFeRDTaxTypes.PDB, TZUGFeRDTaxTypesExtensions.FromString('PDB'));
79+
Assert.AreEqual(TZUGFeRDTaxTypes.PDC, TZUGFeRDTaxTypesExtensions.FromString('PDC'));
80+
Assert.AreEqual(TZUGFeRDTaxTypes.PRF, TZUGFeRDTaxTypesExtensions.FromString('PRF'));
81+
Assert.AreEqual(TZUGFeRDTaxTypes.SCN, TZUGFeRDTaxTypesExtensions.FromString('SCN'));
82+
Assert.AreEqual(TZUGFeRDTaxTypes.SSS, TZUGFeRDTaxTypesExtensions.FromString('SSS'));
83+
Assert.AreEqual(TZUGFeRDTaxTypes.SIT, TZUGFeRDTaxTypesExtensions.FromString('SIT'));
84+
Assert.AreEqual(TZUGFeRDTaxTypes.SUP, TZUGFeRDTaxTypesExtensions.FromString('SUP'));
85+
Assert.AreEqual(TZUGFeRDTaxTypes.SUR, TZUGFeRDTaxTypesExtensions.FromString('SUR'));
86+
Assert.AreEqual(TZUGFeRDTaxTypes.SWT, TZUGFeRDTaxTypesExtensions.FromString('SWT'));
87+
Assert.AreEqual(TZUGFeRDTaxTypes.TAC, TZUGFeRDTaxTypesExtensions.FromString('TAC'));
88+
Assert.AreEqual(TZUGFeRDTaxTypes.TOT, TZUGFeRDTaxTypesExtensions.FromString('TOT'));
89+
Assert.AreEqual(TZUGFeRDTaxTypes.TOX, TZUGFeRDTaxTypesExtensions.FromString('TOX'));
90+
Assert.AreEqual(TZUGFeRDTaxTypes.TTA, TZUGFeRDTaxTypesExtensions.FromString('TTA'));
91+
Assert.AreEqual(TZUGFeRDTaxTypes.VAD, TZUGFeRDTaxTypesExtensions.FromString('VAD'));
92+
Assert.AreEqual(TZUGFeRDTaxTypes.VAT, TZUGFeRDTaxTypesExtensions.FromString('VAT'));
93+
Assert.AreEqual(TZUGFeRDTaxTypes.Unknown, TZUGFeRDTaxTypesExtensions.FromString('Unknown'));
94+
Assert.AreEqual(TZUGFeRDTaxTypes.Unknown, TZUGFeRDTaxTypesExtensions.FromString('Invalid'));
95+
end;
96+
97+
procedure TZUGFeRDTaxTypesTest.TestEnumToString;
98+
begin
99+
Assert.AreEqual('AAA', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAA));
100+
Assert.AreEqual('AAB', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAB));
101+
Assert.AreEqual('AAC', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAC));
102+
Assert.AreEqual('AAD', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAD));
103+
Assert.AreEqual('AAE', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAE));
104+
Assert.AreEqual('AAF', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAF));
105+
Assert.AreEqual('AAG', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAG));
106+
Assert.AreEqual('AAH', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAH));
107+
Assert.AreEqual('AAI', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAI));
108+
Assert.AreEqual('AAJ', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAJ));
109+
Assert.AreEqual('AAK', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAK));
110+
Assert.AreEqual('AAL', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAL));
111+
Assert.AreEqual('AAM', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.AAM));
112+
Assert.AreEqual('ADD', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.ADD));
113+
Assert.AreEqual('BOL', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.BOL));
114+
Assert.AreEqual('CAP', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.CAP));
115+
Assert.AreEqual('CAR', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.CAR));
116+
Assert.AreEqual('COC', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.COC));
117+
Assert.AreEqual('CST', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.CST));
118+
Assert.AreEqual('CUD', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.CUD));
119+
Assert.AreEqual('CVD', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.CVD));
120+
Assert.AreEqual('ENV', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.ENV));
121+
Assert.AreEqual('EXC', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.EXC));
122+
Assert.AreEqual('EXP', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.EXP));
123+
Assert.AreEqual('FET', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.FET));
124+
Assert.AreEqual('FRE', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.FRE));
125+
Assert.AreEqual('GCN', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.GCN));
126+
Assert.AreEqual('GST', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.GST));
127+
Assert.AreEqual('ILL', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.ILL));
128+
Assert.AreEqual('IMP', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.IMP));
129+
Assert.AreEqual('IND', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.IND));
130+
Assert.AreEqual('LAC', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.LAC));
131+
Assert.AreEqual('LCN', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.LCN));
132+
Assert.AreEqual('LDP', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.LDP));
133+
Assert.AreEqual('LOC', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.LOC));
134+
Assert.AreEqual('LST', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.LST));
135+
Assert.AreEqual('MCA', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.MCA));
136+
Assert.AreEqual('MCD', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.MCD));
137+
Assert.AreEqual('OTH', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.OTH));
138+
Assert.AreEqual('PDB', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.PDB));
139+
Assert.AreEqual('PDC', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.PDC));
140+
Assert.AreEqual('PRF', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.PRF));
141+
Assert.AreEqual('SCN', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.SCN));
142+
Assert.AreEqual('SSS', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.SSS));
143+
Assert.AreEqual('SIT', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.SIT));
144+
Assert.AreEqual('SUP', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.SUP));
145+
Assert.AreEqual('SUR', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.SUR));
146+
Assert.AreEqual('SWT', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.SWT));
147+
Assert.AreEqual('TAC', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.TAC));
148+
Assert.AreEqual('TOT', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.TOT));
149+
Assert.AreEqual('TOX', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.TOX));
150+
Assert.AreEqual('TTA', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.TTA));
151+
Assert.AreEqual('VAD', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.VAD));
152+
Assert.AreEqual('VAT', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.VAT));
153+
Assert.AreEqual('Unknown', TZUGFeRDTaxTypesExtensions.EnumToString(TZUGFeRDTaxTypes.Unknown));
154+
end;
155+
156+
initialization
157+
158+
//I was hoping to use RTTI to discover the TestFixture classes, however unlike .NET
159+
//if we don't touch the class somehow then the linker will remove
160+
//the class from the resulting exe.
161+
//We could just do this:
162+
//TMyExampleTests.ClassName;
163+
//TExampleFixture2.ClassName;
164+
//which is enough to make the compiler link the classes into the exe, but that seems a
165+
//bit redundent so I guess we'll just use manual registration. If you use the
166+
//{$STRONGLINKTYPES ON} compiler directive then it will link the TestFixtures in and you
167+
//can use RTTI. The downside to that is the resulting exe will potentially much larger.
168+
//Not sure which version {$STRONGLINKTYPES ON} was introduced so we'll allow RTTI and
169+
//manual registration for now.
170+
171+
// TDUnitX.RegisterTestFixture(TZUGFeRDTaxTypesTest);
172+
173+
end.

intf.ZUGFeRDTaxRegistration.pas

+39
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{* Licensed to the Apache Software Foundation (ASF) under one
2+
* or more contributor license agreements. See the NOTICE file
3+
* distributed with this work for additional information
4+
* regarding copyright ownership. The ASF licenses this file
5+
* to you under the Apache License, Version 2.0 (the
6+
* "License"); you may not use this file except in compliance
7+
* with the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.}
17+
18+
unit intf.ZUGFeRDTaxRegistration;
19+
20+
interface
21+
22+
uses intf.ZUGFeRDTaxRegistrationSchemeID;
23+
24+
type
25+
/// <summary>
26+
/// Structure for holding detailed information on tax information for sender, businss partner and recipient
27+
/// </summary>
28+
TZUGFeRDTaxRegistration = class
29+
private
30+
FNo: string;
31+
FSchemeID: TZUGFeRDTaxRegistrationSchemeID;
32+
public
33+
property No: string read FNo write FNo;
34+
property SchemeID: TZUGFeRDTaxRegistrationSchemeID read FSchemeID write FSchemeID;
35+
end;
36+
37+
implementation
38+
39+
end.
+85
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
{* Licensed to the Apache Software Foundation (ASF) under one
2+
* or more contributor license agreements. See the NOTICE file
3+
* distributed with this work for additional information
4+
* regarding copyright ownership. The ASF licenses this file
5+
* to you under the Apache License, Version 2.0 (the
6+
* "License"); you may not use this file except in compliance
7+
* with the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing,
12+
* software distributed under the License is distributed on an
13+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
* KIND, either express or implied. See the License for the
15+
* specific language governing permissions and limitations
16+
* under the License.}
17+
18+
unit intf.ZUGFeRDTaxRegistrationSchemeID;
19+
20+
interface
21+
22+
uses
23+
System.SysUtils,System.TypInfo
24+
;
25+
26+
type
27+
/// <summary>
28+
/// For a reference see:
29+
/// http://www.unece.org/trade/untdid/d00a/tred/tred1153.htm
30+
/// </summary>
31+
TZUGFeRDTaxRegistrationSchemeID = (
32+
/// <summary>
33+
/// Fiscal number
34+
///
35+
/// Tax payer's number. Number assigned to individual
36+
/// persons as well as to corporates by a public
37+
/// institution; this number is different from the VAT
38+
/// registration number.
39+
/// </summary>
40+
FC, // Fiscal number
41+
42+
/// <summary>
43+
/// VAT registration number
44+
///
45+
/// Unique number assigned by the relevant tax authority to
46+
/// identify a party for use in relation to Value Added Tax
47+
/// (VAT).
48+
/// </summary>
49+
VA, // VAT registration number
50+
51+
/// <summary>
52+
/// Unknown/ invalid value
53+
/// </summary>
54+
Unknown // Unknown/ invalid value
55+
);
56+
57+
TZUGFeRDTaxRegistrationSchemeIDExtensions = class
58+
public
59+
class function FromString(const s: string): TZUGFeRDTaxRegistrationSchemeID;
60+
class function EnumToString(codes: TZUGFeRDTaxRegistrationSchemeID): string;
61+
end;
62+
63+
implementation
64+
65+
{ TZUGFeRDTaxRegistrationSchemeIDExtensions }
66+
67+
class function TZUGFeRDTaxRegistrationSchemeIDExtensions.EnumToString(
68+
codes: TZUGFeRDTaxRegistrationSchemeID): string;
69+
begin
70+
Result := GetEnumName(TypeInfo(TZUGFeRDTaxRegistrationSchemeID), Integer(codes));
71+
end;
72+
73+
class function TZUGFeRDTaxRegistrationSchemeIDExtensions.FromString(
74+
const s: string): TZUGFeRDTaxRegistrationSchemeID;
75+
var
76+
enumValue : Integer;
77+
begin
78+
enumValue := GetEnumValue(TypeInfo(TZUGFeRDTaxRegistrationSchemeID), s);
79+
if enumValue >= 0 then
80+
Result := TZUGFeRDTaxRegistrationSchemeID(enumValue)
81+
else
82+
Result := TZUGFeRDTaxRegistrationSchemeID.Unknown;
83+
end;
84+
85+
end.

0 commit comments

Comments
 (0)