-
Notifications
You must be signed in to change notification settings - Fork 75
/
debit.py
48 lines (42 loc) · 1.32 KB
/
debit.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
from . import FinTS3Segment
from ..models import SEPAAccount
class HKDSE(FinTS3Segment):
"""
HKDSE (Einreichung terminierter SEPA-Einzellastschrift)
Section C.10.2.5.4.1
"""
type = 'HKDSE'
def __init__(self, segno, account: SEPAAccount, pain_msg):
self.version = 1
sepa_descriptor = 'urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.008.003.02'
msg = ':'.join([
account.iban,
account.bic
])
data = [
msg,
sepa_descriptor,
'@{}@{}'.format(len(pain_msg), pain_msg)
]
super().__init__(segno, data)
class HKDME(FinTS3Segment):
"""
HKDME (Einreichung terminierter SEPA-Sammellastschrift)
Section C.10.3.2.2.1
"""
type = 'HKDME'
def __init__(self, segno, account: SEPAAccount, pain_msg, control_sum, currency, book_as_single):
self.version = 1
sepa_descriptor = 'urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.008.003.02'
msg = ':'.join([
account.iban,
account.bic
])
data = [
msg,
str(control_sum).replace('.', ',') + ':' + currency,
'J' if book_as_single else '',
sepa_descriptor,
'@{}@{}'.format(len(pain_msg), pain_msg)
]
super().__init__(segno, data)