Repository navigation
[IMP] my_compassion_payment_payu_gpo: ask the first and last name on the card apart - #442
Conversation
…the card apart PayU asked for two fields to validate the production account. The fast checkout and the donation email step ask the first and last name instead of the name on card, kept apart until the card form, which payment_payu_gpo now prefills itself. Without them, the sponsorship card form is prefilled with the sponsor's first and last name. A placeholder payer gets the names as typed, not split again.
There was a problem hiding this comment.
Review
Thanks David. The flow is well thought through. The names are asked where the donor already types the e-mail, they are kept per sponsorship or order in the session, they prefill the card form where they can still be corrected, and only a placeholder donor is renamed. Old sessions with a single full name are handled too.
What we tested
Browser E2E on a copy of the migrated database, with CompassionCH/compassion-accounting#298, the Polish MyCompassion website and PayU's sandbox:
| Scenario | Result |
|---|---|
| Donation email step, visitor, PayU only | Fields shown and required; the server refuses missing or blank names; card form prefilled; the placeholder donor renamed as typed after payment |
| Sponsorship fast checkout | Same, through a 3-D Secure challenge; the sponsor renamed as typed, contract active |
| Full sponsorship form | Prefilled from a sponsor with a real name, empty for a placeholder sponsor (no "(pending)") |
| Logged-in donor paying with another name | The donor's name is kept |
| Swiss MyCompassion (no PayU) | No name fields, payment works |
| Polish | Labels, hint and server messages translated (the JS message of CompassionCH/compassion-accounting#298 is not; see there) |
Tests: 151 pass with CompassionCH/compassion-accounting#298. TestCardholderName needs an available child in the database (assertTrue(self.child, ...) in setUp), so on a fresh database or in CI its 13 tests fail. Creating the child in setUp would make them self-contained.
Open points
Levels: Must fix (money or security) · Before go-live (before real donors use it) · Should fix · Suggestion
- Before go-live: Deployed without CompassionCH/compassion-accounting#298, this PR upgrades cleanly and then breaks the post-processing of every online payment, on all providers (thread on
payment_transaction.py:116). Merge CompassionCH/compassion-accounting#298 first or together; a pre-migration check makes the wrong order fail loudly. - Should fix: On the fast checkout, blank names (and a page opened before the deploy) end on the generic error page (thread on
new_sponsorship_wizard.py). - Suggestion: Monthly charges and BLIK still split the full name (thread on
payment_transaction.py:111). - Suggestion: A test for the guard that keeps a real donor's name (thread on
test_recurring_card.py).
Small thing: a logged-in donor's donation card form comes empty, while the sponsorship one is prefilled from the sponsor's name. Not wrong, just inconsistent.
Verdict
Requesting changes for point 1 only: the guard is a few lines, and a wrong merge order would stop every payment in the Swiss database. The rest can follow.
Assisted-by: claude-opus-5-5, xhigh, claude-code
Assisted-by: gpt-6-astra, high, codex
Assisted-by: claude-opus-5-5, medium, claude-code
- The upgrade stops when payment_payu_gpo has no first and last names (compassion-accounting#298): without them, the post-processing of every online payment would fail. - The browser refuses names made of spaces; a page opened before the deploy posts the full name, which is split. - Without names typed (monthly charges, BLIK), PayU gets the payer's own first and last name; a signed-in donor's card form is prefilled with them. - Tests: a real name is never replaced by the card's, the child is created. Assisted-by: claude-opus-5-5, medium, claude-code
|
Thanks for the review, addressed in d0e5f5f:
Both PRs together locally: 158 tests, 0 failed. There are 2 errors in |
NoeBerdoz
left a comment
There was a problem hiding this comment.
Second review
Thanks David, most of the first review is fixed in d0e5f5f, with tests: the old full name on the fast checkout, the partner's own names for monthly charges and BLIK, the guard that keeps a real donor's name, TestCardholderName creating its own child, and the signed-in donor's prefill (checked in the browser; it has no test). The pre-migration stops the wrong merge order, as intended.
What we tested
In the browser on PayU's sandbox, on a copy of the migrated database, with CompassionCH/compassion-accounting#298:
| Scenario | Result |
|---|---|
| Donation email step, names made of spaces | Refused by the browser; nothing reaches the server |
| Fast checkout, names made of spaces | Fails: still the error page (thread on the wizard view) |
| Fast checkout posting only the old full name | Split ("Anna Maria" / "Wiśniewska"), prefilled on the card form, paid; PayU's buyer as split |
| Signed-in donor, donation card form | Prefilled with the donor's own names |
| Names for a payment without the card form (shell) | The partner's own first and last name, e.g. "E2E" / "PayU arrears ch", where the old split gave "E2E PayU arrears" / "ch" |
| Donation and sponsorship with Polish names | PayU's buyer names exactly as typed |
Upgrade probes on fresh databases: origin/18.0 accounting with this PR stops with your message; both new heads go through.
Open points
Levels: Must fix (money or security) · Before go-live (before real donors use it) · Should fix · Suggestion
- Before go-live: The pre-migration checks a column, so
-u theme_compassion_2025,my_compassionpasses it without upgradingpayment_payu_gpo, and every PayU card payment is then refused (thread onpre-migration.py). - Should fix: On the fast checkout, names made of spaces still end on the error page: the browser never checks the
patternthere (thread on the wizard view). - Should fix:
TestCardSubmission.test_one_card_reaches_payu_per_ordernow fails with0 != 1. Its_send_cardsends no names, and the card route of CompassionCH/compassion-accounting#298 refuses the request before PayU. In your run,setUpstopped earlier on the missing filestore image, which hid it. Passing names, as the payment form does, makes the two modules' 156 tests pass:return PayuGpoController().payu_gpo_card_payment( tx.reference, payment_utils.generate_access_token(tx.reference), "TOK_CARD", cardholder_firstname="Anna", cardholder_lastname="Nowak", )
On a first install of this module, Odoo runs no migration, so the guard cannot help there: merging both PRs together is still what keeps the code in step.
Verdict
Still requesting changes, for point 1: one more check in the pre-migration. Points 2 and 3 are small.
Assisted-by: claude-opus-5-5, xhigh, claude-code
Assisted-by: gpt-6-astra, high, codex
Assisted-by: claude-opus-5-5, medium, claude-code
…last names - The pre-migration checks the version of payment_payu_gpo, not its column: upgrading my_compassion creates the column without upgrading the card form. - The fast checkout trims the names before its own check: it is submitted by script, so the browser's pattern never applied there. - TestCardSubmission sends the names, as the payment form does, and creates its provider instead of copying it (no image needed). - Test: a website with a terms URL still shows the name message. Assisted-by: claude-opus-5-5, medium, claude-code
|
Thanks, second review addressed in 2f36fd0:
Locally, with #443 and CompassionCH/compassion-accounting#298, after About the English refusal on the card form: on the local PL website, whose default language is Polish, the card route answers in Polish ("Wpisz imię i nazwisko widniejące na karcie.") when the request carries the |
NoeBerdoz
left a comment
There was a problem hiding this comment.
Third review
Thanks David, the three points of the second review are fixed in 2f36fd0: the pre-migration checks the version of payment_payu_gpo, the fast checkout trims the names before its check, and TestCardSubmission sends both names with a provider of its own. The new test_name_message_next_to_a_terms_url is skipped without #443 and runs with it, as you said.
What we tested
On fresh databases, with CompassionCH/compassion-accounting#298, no browser this time:
- Upgrade. Installed from 18.0 (this module at 18.0.1.2.0,
payment_payu_gpoat 18.0.1.0.0).-u theme_compassion_2025,my_compassionstops with your message, with 18.0's accounting and with CompassionCH/compassion-accounting#298. Your command then passes, and so does-u payment_payu_gpo,theme_compassion_2025,my_compassion. Both end with this module at 18.0.1.3.0 andpayment_payu_gpoat 18.0.1.1.0. - Tests. This module's tests pass, alone and merged with #443:
test_one_card_reaches_payu_per_orderpasses, andtest_name_message_next_to_a_terms_urlis skipped alone and passes with #443. Themy_compassionfailures in these runs all come from the fresh database (no child, no active payment method). - Fast checkout. Read, and a script ran your
_onStepClickwith the form's validator on a mocked page: names made of spaces are refused for PayU and still accepted for the other payment modes.
About the language of the card route's refusal, see the thread on CompassionCH/compassion-accounting#298: the browser's language decides there, not the cookie.
Open points
Levels: Must fix (money or security) · Before go-live (before real donors use it) · Should fix · Suggestion
- Suggestion: The message of the pre-migration could ask to run the same upgrade again with
payment_payu_gpoadded (thread onpre-migration.py:27). - Suggestion: A test for names made only of spaces (thread on
test_cardholder_name.py:168).
Verdict
Approved. Merge it together with CompassionCH/compassion-accounting#298.
Assisted-by: claude-opus-5-5, high, claude-code
Assisted-by: claude-opus-5-5, medium, claude-code
Assisted-by: gpt-6-astra, high, codex
Assisted-by: Qwen3.8-Flash-Next-GGUF UD-IQ4_XS, high, pi
…pgrade When the pre-migration stops an upgrade, the modules processed before this one are already committed and those after it are left as they were. The message now asks to add payment_payu_gpo and run the same upgrade again, instead of an upgrade of the two PayU modules that leaves the others behind. Test: names made of spaces posted to the fast checkout count as no name. Assisted-by: claude-opus-5-5, high, claude-code
Requested by PayU to validate our production account: they want two separate fields for the cardholder's first name and last name, instead of a single "Name on card" field (follows #436 and #441).
views/payment_templates.xmlis removed:payment_payu_gponow prefills its card form itself.Depends on CompassionCH/compassion-accounting#298. Merge and deploy both together:
-u payment_payu_gpo,my_compassion_payment_payu_gpo. With only one of the two modules updated, the view inheritance fails.Tests: run locally on both modules, 151 tests, 0 failed. There are 2 errors in
TestCardSubmission; they happen only locally, because an image is missing from the local filestore.🤖 Generated with Claude Code