-
Notifications
You must be signed in to change notification settings - Fork 37
fix: prevent EBICS batch imports from being skipped when camt.054 download is disabled #422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Copilot
wants to merge
7
commits into
version-16-hotfix
Choose a base branch
from
copilot/fix-import-skipped-forever
base: version-16-hotfix
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 3 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
90fedcf
Initial plan
Copilot 447d547
fix(ebics): prevent batch import retry loop
Copilot a63185f
fix(ebics): import unresolved batch transactions
Copilot f794195
test(ebics): clarify batch retry settings
Copilot 65142f1
test: inherit from UnitTestCase
barredterra 1c76c59
test(ebics): discover tests without fintech registration
barredterra 0dd3222
style: format with ruff
barredterra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| # Copyright (c) 2026, ALYF GmbH and Contributors | ||
| # See license.txt | ||
|
|
||
| from types import SimpleNamespace | ||
| from unittest.mock import patch | ||
|
|
||
| from frappe.tests.utils import FrappeTestCase | ||
|
|
||
| from banking.ebics.utils import UnresolvedBatchTransactionError, import_ebics_json, process_camt_document | ||
|
|
||
|
|
||
| class TestEBICSUtils(FrappeTestCase): | ||
| class EmptyBatchTransaction: | ||
| batch = True | ||
| status = None | ||
|
|
||
| def __len__(self): | ||
| return 0 | ||
|
|
||
| @patch("banking.ebics.utils.get_bank_account", return_value="Test Bank Account") | ||
| @patch("banking.ebics.utils.process_camt_document") | ||
| @patch("fintech.sepa.CAMTDocument") | ||
| def test_import_batch_without_download_does_not_skip( | ||
| self, camt_document_class, process_camt_document, _get_bank_account | ||
| ): | ||
| camt_document = camt_document_class.return_value | ||
| camt_document.iban = "DE89370400440532013000" | ||
| user = SimpleNamespace( | ||
| bank="Test Bank", | ||
| company="Test Company", | ||
| start_date=None, | ||
| split_batch_transactions=True, | ||
| download_batch_transactions=False, | ||
| ) | ||
|
|
||
| import_ebics_json(user, {"camt053.xml": b"<Document />"}) | ||
|
|
||
| process_camt_document.assert_called_once_with( | ||
| camt_document, | ||
| "Test Bank Account", | ||
| "Test Company", | ||
| None, | ||
| True, | ||
| False, | ||
| ) | ||
|
|
||
| @patch("banking.ebics.utils.create_sepa_bank_transaction") | ||
| @patch("banking.ebics.utils.get_transaction_id", return_value="batch-id") | ||
| def test_process_unresolved_batch_without_download_as_single_transaction( | ||
| self, _get_transaction_id, create_sepa_bank_transaction | ||
| ): | ||
| transaction = self.EmptyBatchTransaction() | ||
|
|
||
| process_camt_document( | ||
| [transaction], | ||
| "Test Bank Account", | ||
| "Test Company", | ||
| split_batch_transactions=True, | ||
| skip_unresolved_batch_transactions=False, | ||
| ) | ||
|
|
||
| create_sepa_bank_transaction.assert_called_once_with( | ||
| "Test Bank Account", | ||
| "Test Company", | ||
| transaction, | ||
| transaction_id="batch-id", | ||
| start_date=None, | ||
| ) | ||
|
|
||
| @patch("banking.ebics.utils.get_transaction_id", return_value="batch-id") | ||
| def test_process_unresolved_batch_with_download_is_skipped(self, _get_transaction_id): | ||
| with self.assertRaises(UnresolvedBatchTransactionError): | ||
| process_camt_document( | ||
| [self.EmptyBatchTransaction()], | ||
| "Test Bank Account", | ||
| "Test Company", | ||
| split_batch_transactions=True, | ||
| skip_unresolved_batch_transactions=True, | ||
| ) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.