Skip to content

Commit

Permalink
Merge branch 'release/4.9.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wolph committed Oct 30, 2017
2 parents d5e7e2e + 2175fdd commit b39d363
Show file tree
Hide file tree
Showing 7 changed files with 248 additions and 3 deletions.
5 changes: 4 additions & 1 deletion mt940/processors.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def mBank_set_tnr(transactions, tag, tag_dict, *args):
'60': 'additional_purpose',
}

# https://www.hettwer-beratung.de/suepa-spezialwissen/sepa-tecshnische-anforderungen/sepa-geschäftsvorfallcodes-gvct-mt-940c/
# https://www.hettwer-beratung.de/sepa-spezialwissen/sepa-technische-anforderungen/sepa-gesch%C3%A4ftsvorfallcodes-gvc-mt-940/
GVC_KEYS = {
'': 'purpose',
'IBAN': 'gvc_applicant_iban',
Expand Down Expand Up @@ -153,6 +153,9 @@ def _parse_mt940_details(detail_str):
elif key.startswith('2'):
key20 = DETAIL_KEYS['20']
result[key20] = (result[key20] or '') + value
elif key in ('61', '62', '63'):
key60 = DETAIL_KEYS['60']
result[key60] = (result[key60] or '') + value

return result

Expand Down
2 changes: 1 addition & 1 deletion mt940/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,7 +331,7 @@ class TransactionDetails(Tag):
id = 86
scope = models.Transaction
pattern = r'''
(?P<transaction_details>(([\s\S]{0,65}\r?\n?){0,5}[\s\S]{0,65}))
(?P<transaction_details>(([\s\S]{0,65}\r?\n?){0,8}[\s\S]{0,65}))
'''


Expand Down
4 changes: 3 additions & 1 deletion tests/betterplace/sepa_mt9401.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2471,7 +2471,9 @@ transactions:
/0001?30SOGEFRPPXXX?31FR1420041010050500013M02606?32Empfaenger 1?
60MTLG:SBI-SEPA-UEB.FR1420041?6101005 Referenz: 1930467117G?62gf.'
60MTLG:SBI-SEPA-UEB.FR1420041?6101005 Referenz: 1930467117G?62gf.
Meldevorschriften beacht?63en'
transactions: *id001
- !!python/object:mt940.models.Transaction
data:
Expand Down
13 changes: 13 additions & 0 deletions tests/self-provided/details_60-63.sta
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
:20:STARTUMS
:25:12345678/1020304050
:28C:0
:60F:C170914EUR12345,12
:61:170914D233,15NMSC
:86:105?00Basislastschrift?10931?20EREF+123/123/12345-----L110
?30BYLADEMM
?31DE99700500000000012345?32Finanzamt Muenchen Abteilun
?33g Erhebung?34992?60000000012345 BIC: BYLADEMM
?61ABWA: Finanzamt Muenchen ?62ABWA+Finanzamt Muenchen
?63Abteilung Erhebung
:62F:C170914EUR12345,98
-
105 changes: 105 additions & 0 deletions tests/self-provided/details_60-63.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
&id001 !!python/object:mt940.models.Transactions
data:
account_identification: 12345678/1020304050
final_closing_balance: !!python/object:mt940.models.Balance
amount: !!python/object:mt940.models.Amount
amount: !!python/object/apply:decimal.Decimal ['12345.98']
currency: EUR
date: !!python/object/apply:mt940.models.Date
- !!binary |
B+EJDg==
status: C
final_opening_balance: !!python/object:mt940.models.Balance
amount: !!python/object:mt940.models.Amount
amount: !!python/object/apply:decimal.Decimal ['12345.12']
currency: EUR
date: !!python/object/apply:mt940.models.Date
- !!binary |
B+EJDg==
status: C
sequence_number: null
statement_number: '0'
transaction_reference: STARTUMS
processors:
post_account_identification: []
post_available_balance: []
post_closing_balance: []
post_date_time_indication: []
post_final_closing_balance: []
post_final_opening_balance: []
post_floor_limit_indicator: []
post_forward_available_balance: []
post_intermediate_closing_balance: []
post_intermediate_opening_balance: []
post_non_swift: []
post_opening_balance: []
post_related_reference: []
post_statement: [!!python/name:mt940.processors.date_cleanup_post_processor '']
post_statement_number: []
post_sum_credit_entries: []
post_sum_debit_entries: []
post_transaction_details: [!!python/name:mt940.processors.transaction_details_post_processor '']
post_transaction_reference_number: []
pre_account_identification: []
pre_available_balance: []
pre_closing_balance: []
pre_date_time_indication: []
pre_final_closing_balance: []
pre_final_opening_balance: []
pre_floor_limit_indicator: []
pre_forward_available_balance: []
pre_intermediate_closing_balance: []
pre_intermediate_opening_balance: []
pre_non_swift: []
pre_opening_balance: []
pre_related_reference: []
pre_statement: [!!python/name:mt940.processors.date_fixup_pre_processor '']
pre_statement_number: []
pre_sum_credit_entries: []
pre_sum_debit_entries: []
pre_transaction_details: []
pre_transaction_reference_number: []
transactions:
- !!python/object:mt940.models.Transaction
data:
FRST_ONE_OFF_RECC: null
additional_position_date: null
additional_position_reference: null
additional_purpose: '000000012345 BIC: BYLADEMMABWA: Finanzamt Muenchen ABWA+Finanzamt
MuenchenAbteilung Erhebung'
amount: !!python/object:mt940.models.Amount
amount: !!python/object/apply:decimal.Decimal ['-233.15']
currency: EUR
applicant_bin: BYLADEMM
applicant_creditor_id: null
applicant_iban: DE99700500000000012345
applicant_name: Finanzamt Muenchen Abteilung Erhebung
bank_reference: null
compensation_amount: null
currency: EUR
customer_reference: null
date: !!python/object/apply:mt940.models.Date
- !!binary |
B+EJDg==
debitor_identifier: null
deviate_applicant: null
deviate_recipient: null
end_to_end_reference: 123/123/12345-----L110
extra_details: ''
funds_code: null
gvc_applicant_bin: null
gvc_applicant_iban: null
id: NMSC
old_SEPA_CI: null
old_SEPA_additional_position_reference: null
original_amount: null
posting_text: Basislastschrift
prima_nota: '931'
purpose: null
purpose_code: null
recipient_name: null
return_debit_notes: '992'
settlement_tag: null
status: D
transaction_code: '105'
transactions: *id001
16 changes: 16 additions & 0 deletions tests/self-provided/overly_long_details.sta
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
:20:STARTUMS
:25:12345678/1020304050
:28C:0
:60F:C170914EUR12345,12
:61:170914D233,15NMSC
:86:105?00Basislastschrift?10931?20EREF+123/123/12345-----L110
?211234567890123 ?22MREF+BYA12345678901
?23CRED+DE99ZZZ00000012345 ?24SVWZ+STEUERNR 123/123/12345
?25 KOERPST 3VJ.17 233,15?26EUR EREF: 123/123/12345----
?27-L1112345678912345 MREF: BY?28A12345678901 CRED: DE99ZZZ0
?290000012345 IBAN: DE00700500?30BYLADEMM
?31DE99700500000000012345?32Finanzamt Muenchen Abteilun
?33g Erhebung?34992?60000000012345 BIC: BYLADEMM
?61ABWA: Finanzamt Muenchen ?62ABWA+Finanzamt Sentinel
:62F:C170914EUR12345,98
-
106 changes: 106 additions & 0 deletions tests/self-provided/overly_long_details.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
&id001 !!python/object:mt940.models.Transactions
data:
account_identification: 12345678/1020304050
final_closing_balance: !!python/object:mt940.models.Balance
amount: !!python/object:mt940.models.Amount
amount: !!python/object/apply:decimal.Decimal ['12345.98']
currency: EUR
date: !!python/object/apply:mt940.models.Date
- !!binary |
B+EJDg==
status: C
final_opening_balance: !!python/object:mt940.models.Balance
amount: !!python/object:mt940.models.Amount
amount: !!python/object/apply:decimal.Decimal ['12345.12']
currency: EUR
date: !!python/object/apply:mt940.models.Date
- !!binary |
B+EJDg==
status: C
sequence_number: null
statement_number: '0'
transaction_reference: STARTUMS
processors:
post_account_identification: []
post_available_balance: []
post_closing_balance: []
post_date_time_indication: []
post_final_closing_balance: []
post_final_opening_balance: []
post_floor_limit_indicator: []
post_forward_available_balance: []
post_intermediate_closing_balance: []
post_intermediate_opening_balance: []
post_non_swift: []
post_opening_balance: []
post_related_reference: []
post_statement: [!!python/name:mt940.processors.date_cleanup_post_processor '']
post_statement_number: []
post_sum_credit_entries: []
post_sum_debit_entries: []
post_transaction_details: [!!python/name:mt940.processors.transaction_details_post_processor '']
post_transaction_reference_number: []
pre_account_identification: []
pre_available_balance: []
pre_closing_balance: []
pre_date_time_indication: []
pre_final_closing_balance: []
pre_final_opening_balance: []
pre_floor_limit_indicator: []
pre_forward_available_balance: []
pre_intermediate_closing_balance: []
pre_intermediate_opening_balance: []
pre_non_swift: []
pre_opening_balance: []
pre_related_reference: []
pre_statement: [!!python/name:mt940.processors.date_fixup_pre_processor '']
pre_statement_number: []
pre_sum_credit_entries: []
pre_sum_debit_entries: []
pre_transaction_details: []
pre_transaction_reference_number: []
transactions:
- !!python/object:mt940.models.Transaction
data:
FRST_ONE_OFF_RECC: null
additional_position_date: null
additional_position_reference: BYA12345678901
additional_purpose: '000000012345 BIC: BYLADEMMABWA: Finanzamt Muenchen ABWA+Finanzamt
Sentinel'
amount: !!python/object:mt940.models.Amount
amount: !!python/object/apply:decimal.Decimal ['-233.15']
currency: EUR
applicant_bin: BYLADEMM
applicant_creditor_id: 'DE99ZZZ00000012345 '
applicant_iban: DE99700500000000012345
applicant_name: Finanzamt Muenchen Abteilung Erhebung
bank_reference: null
compensation_amount: null
currency: EUR
customer_reference: null
date: !!python/object/apply:mt940.models.Date
- !!binary |
B+EJDg==
debitor_identifier: null
deviate_applicant: null
deviate_recipient: null
end_to_end_reference: '123/123/12345-----L1101234567890123 '
extra_details: ''
funds_code: null
gvc_applicant_bin: null
gvc_applicant_iban: null
id: NMSC
old_SEPA_CI: null
old_SEPA_additional_position_reference: null
original_amount: null
posting_text: Basislastschrift
prima_nota: '931'
purpose: 'STEUERNR 123/123/12345 KOERPST 3VJ.17 233,15EUR EREF: 123/123/12345-----L1112345678912345
MREF: BYA12345678901 CRED: DE99ZZZ00000012345 IBAN: DE00700500'
purpose_code: null
recipient_name: null
return_debit_notes: '992'
settlement_tag: null
status: D
transaction_code: '105'
transactions: *id001

0 comments on commit b39d363

Please sign in to comment.