Skip to content

Commit d44a6b3

Browse files
committed
Validators and validator stubs
1 parent 7a0a904 commit d44a6b3

24 files changed

+294
-108
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,7 @@ docs/_build/
5454

5555
# Mohanjith
5656
tmp/
57-
moha*.py
57+
moha*.py
58+
59+
# Submlime
60+
*.sublime-*

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
py-finvoice
22
============
33

4-
Python module for generating Finvoice invoices.
4+
Python module for generating and parsing Finvoice invoices.
55

66
Finvoice message can be used for invoicing and for other business messages, such as quotations, orders, order confirmations, price lists, etc. Due to easy adoption, it is suitable for invoicing between companies of all sizes and for consumer invoicing.
77

88
This Python module is based on the XSDs released by the Federation of Financial Services, Finland.
99

1010
# Tested
1111

12-
XML generated have been validated.
12+
XML has been parsed and XML has been generated using data and have been validated.
1313

1414
## Ilmoittamissanomat
1515
- FinvoiceSenderInfo (SI)
@@ -26,7 +26,7 @@ XML generated have been validated.
2626

2727
# Road Tested
2828

29-
XML generated has been used in actual transactions
29+
XML generated has been used in actual transactions. XML from actual transactions have been parsed.
3030

3131
## Ilmoittamissanomat
3232
- FinvoiceSenderInfo (SI)

finvoice/sender/senderinfo.py

Lines changed: 117 additions & 100 deletions
Large diffs are not rendered by default.

finvoice/sender/senderinfosubs.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
# it under the terms of the GNU General Public License as published by
1010
# the Free Software Foundation, either version 3 of the License, or
1111
# (at your option) any later version.
12-
#
12+
#
1313
# py-finvoice is distributed in the hope that it will be useful,
1414
# but WITHOUT ANY WARRANTY; without even the implied warranty of
1515
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -82,7 +82,7 @@ def parsexml_(*args, **kwargs):
8282
# Globals
8383
#
8484

85-
ExternalEncoding = 'ISO-8859-15'
85+
ExternalEncoding = 'iso8859-15'
8686

8787
#
8888
# Data representation classes
@@ -327,8 +327,8 @@ def parseLiteral(inFilename, silence=False):
327327
# Enable Python to collect the space used by the DOM.
328328
doc = None
329329
if not silence:
330-
sys.stdout.write('#from ??? import *\n\n')
331-
sys.stdout.write('import ??? as model_\n\n')
330+
sys.stdout.write('#from finvoice.sender.senderinfo import *\n\n')
331+
sys.stdout.write('import finvoice.sender.senderinfo as model_\n\n')
332332
sys.stdout.write('rootObj = model_.rootClass(\n')
333333
rootObj.exportLiteral(sys.stdout, 0, name_=rootTag)
334334
sys.stdout.write(')\n')

finvoice/tieke/__init__.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
###
2+
# Copyright 2014 Code Master Oy (http://www.codemaster.fi/)
3+
#
4+
# This file is part of py-finvoice.
5+
#
6+
# py-finvoice is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# py-finvoice is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with py-finvoice. If not, see <http://www.gnu.org/licenses/>.
18+
##
19+
20+
__all__ = [ 'members' ]

finvoice/tieke/members.py

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
###
2+
# Copyright 2014 Code Master Oy (http://www.codemaster.fi/)
3+
#
4+
# This file is part of py-finvoice.
5+
#
6+
# py-finvoice is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU General Public License as published by
8+
# the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# py-finvoice is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU General Public License
17+
# along with py-finvoice. If not, see <http://www.gnu.org/licenses/>.
18+
##
19+
20+
class MemberLists:
21+
def get_BanksList():
22+
return [
23+
'OKOYFIHH', # OP-Pohjola-ryhmä
24+
'NDEAFIHH', # Nordea
25+
'DABAFIHH', # Danske Bank
26+
'HELSFIHH', # Säästöpankit, Aktia Säästöpankki Oyj, Paikallisosuuspankit
27+
'TAPIFI22', # Tapiola Bank Oy
28+
'AABAFI22', # Ålandsbanken
29+
'HANDFIHH', # Handelsbanken
30+
'SBANFIHH', # S-Pankki
31+
'DNBAFIHX', # DnB NOR Bank
32+
]
33+
def get_ServicePorvidersList():
34+
return [
35+
'FIYAPSOL', # YAP Solutions Oy
36+
'003723327487', # Apix Messaging Oy
37+
'BAWCFI22', # Basware Oyj
38+
'003714377140', # Enfo Zender Oy
39+
'003710948874', # OpusCapita Group Oy
40+
'003708599126', # Liaison Technologies Oy
41+
'003703575029', # CGI
42+
'003717203971', # Notebeat Oy
43+
'003721291126', # Maventa Oy
44+
'MAVENTA', # Maventa Oy
45+
'PAGERO', # Pagero
46+
'003701150617', # Strålfors Oy
47+
'003714756079', # TeliaSonera Finland Oyj
48+
'003701011385', # Tieto Oyj
49+
'00885060259470028', # Tradeshift
50+
]
51+
def get_MembersList():
52+
return self.get_BanksList() + self.get_MembersList()

validator-stubs/CountryCodeType.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if ( isinstance( value, basestring ) and value.__len__() == 2 ):
2+
pass
3+
else:
4+
raise_value_error( value, 'Expected ISO 3166-1 alpha-2' )
5+
return value
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
if ( isinstance( value, basestring ) and value.__len__() == 2 and value in [ 'FI', 'SV', 'EN' ]):
2+
pass
3+
else:
4+
raise_value_error( value, 'Expected ISO 639-1' )
5+
return value
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
identifiers = [ '00', '02' ]
2+
if ( value in identifiers ):
3+
pass
4+
else:
5+
raise_value_error( value, 'Expected "00" or "02"' + ' or '.join( identifiers ) )
6+
return value
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
actions = [ 'ADD', 'CHANGE', 'DELETE' ]
2+
if ( value in actions ):
3+
pass
4+
else:
5+
raise_value_error( value, 'Expected ' + ' or '.join( actions ) )
6+
return value

0 commit comments

Comments
 (0)