-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🐛 [#3924] Update payment status also if 'wait_for_payment_to_register…
…=True' The problem was: If the registration happens after payment, the status of the payment was never changed from 'completed' to 'registered'. The 'finalise_completion' task filters for payments with 'registered' status to decide whether the retry flag should be turned on. This resulted in the retry flag being True even though the payment has been registered. Backport-of: #3935
- Loading branch information
1 parent
056aeaf
commit f8d406e
Showing
2 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
This file contains 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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
from decimal import Decimal | ||
from unittest.mock import patch | ||
|
||
from django.core import mail | ||
from django.test import TestCase, override_settings | ||
from django.test import TestCase, override_settings, tag | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
from privates.test import temp_private_root | ||
|
@@ -982,6 +983,39 @@ def test_cosign_not_required_but_filled_in_does_not_proceed_with_registration(se | |
self.assertTrue(submission.confirmation_email_sent) | ||
self.assertEqual(submission.auth_info.value, "111222333") | ||
|
||
@tag("gh-3924") | ||
def test_payment_complete_does_not_set_retry_flag(self): | ||
submission = SubmissionFactory.create( | ||
form__payment_backend="demo", | ||
form__product__price=Decimal("11.35"), | ||
form__registration_backend="email", | ||
form__registration_backend_options={"to_emails": ["[email protected]"]}, | ||
form__name="Pretty Form", | ||
with_public_registration_reference=True, | ||
with_completed_payment=True, | ||
) | ||
|
||
with ( | ||
patch( | ||
"openforms.registrations.contrib.email.plugin.EmailRegistration.register_submission" | ||
), | ||
patch( | ||
"openforms.registrations.contrib.email.plugin.EmailRegistration.update_payment_status" | ||
), | ||
patch( | ||
"openforms.registrations.tasks.GlobalConfiguration.get_solo", | ||
return_value=GlobalConfiguration(wait_for_payment_to_register=True), | ||
), | ||
): | ||
with self.captureOnCommitCallbacks(execute=True): | ||
on_post_submission_event( | ||
submission.id, PostSubmissionEvents.on_payment_complete | ||
) | ||
|
||
submission.refresh_from_db() | ||
|
||
self.assertFalse(submission.needs_on_completion_retry) | ||
|
||
|
||
@temp_private_root() | ||
@override_settings(CELERY_TASK_ALWAYS_EAGER=True) | ||
|