Repository navigation
Conversation
A public sponsorship matched an existing partner on the name and email or postcode the visitor typed (also in the fast checkout, by adding the name to the posted form). The contract then joined that donor's collection group, so the charge cron took its invoices on the donor's saved card, and the browser owning the new signup saw the donor's name and could write their preferences. A visitor now always gets a new partner with an unverified email, as the public fund donation already does. A known donor is only reused when they are logged in. When the email is the one of a known partner, a note on the new partner links to them and the reviewer set on the website gets a to-do, so staff check and merge the contacts. The visitor is told nothing.
[High impact] The changes affect public sponsorship identity and billing across MyCompassion sites. Update the Swiss opt-in test fixtures before merging this session-format change. Findings
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Start sponsorship] --> B{Logged in?}
B -->|No| C[Create separate unverified contact]
B -->|Yes| D[Use signed-in contact]
C --> E[Find or create that contact's collection group]
D --> E
E --> F[Create sponsorship]
F --> G[Store contract and partner IDs in session]
F --> H[Signup confirmed and real name known]
H --> I[Send portal invitation]
H --> J{Known contact uses this email?}
J -->|Yes| K[Leave internal note and optional reviewer task]
Reviews (2) · Last reviewed commit: "Merge remote-tracking branch 'origin/18...." · Reviewed by Greptile |
NoeBerdoz
left a comment
There was a problem hiding this comment.
Levels: Must fix (money or security) · Before go-live (before real donors use it) · Should fix · Suggestion
Pair review (Claude and Codex), then tested locally:
- the new tests and the related suites, on 18.0 and then on this branch;
- the upgrade (
-u my_compassion,my_compassion_switzerland): clean, no errors; - an end-to-end run in a browser, on a copy of the migrated database, with Odoo's demo payment provider and test contacts only.
What works, and was checked. A visitor who is not logged in always gets a new contact and a new collection group. That holds when the visitor types only the donor's email, and also when they add the donor's name and postcode to the posted form. With the demo provider, the charge cron created four transactions. Each invoice was paid with the card of its own group, and no visitor invoice was charged to the donor's card. A logged-in donor still lands in their own group and is offered their saved card. Five tests fail on 18.0 and pass here, and no test that passes on 18.0 fails here. The fix is small and it sits in the right place. Thank you.
What is left is mostly about what happens after the to-do: the merge, and when the to-do is created. Inline comments below. Three more points concern lines outside the diff:
-
Should fix: two comments now give a reason that is no longer true.
controllers/my2_sponsorships.py:873and:946justify the saved-card guard with "the public wizard matches partners by email". The guard is still right, but for another reason now: a visitor's contact is always new, and the guard keeps stored cards behind a login even if that ever changes. The docstring oftest_transaction_route_refuses_a_saved_card_to_the_public(tests/test_fast_checkout_routes.py:326) says the same thing. A comment with an old reason invites the next person to delete the guard, "since we don't match any more". -
Should fix: translations. The PR adds four strings (the field label and its help, the note, the to-do summary) without
.poentries. In the test, a reviewer whose language is fr_CH got the note in English. The recent PRs on this module ship fr_CH, de_DE and it_IT entries with the code. -
Suggestion: the new setting is only explained in the PR description.
readme/CONFIGURE.mdis where the next person will look for "who gets these to-dos?".
Assisted-by: claude-opus-5-5, xhigh, claude-code
Assisted-by: gpt-6.1-sol, high, codex
…p to the donor A merge keeps the kept partner's own unverified-email, placeholder-name and duplicate flags. The session keeps the contract and its partner for each signup it owns, so moving a visitor's contract onto a donor ends this browser's access to it. The saved-card guard comments give the current reason.
…onfirmed The note and to-do wait for the signup to be confirmed with a real name, like the portal invitation, and are posted once per partner, as the superuser, inside a savepoint so a failure never breaks the payment or the validation. The reviewer comes from the company's websites. The note tells staff to move the sponsorship onto the donor instead of merging.
…sorship-isolation
| owns_signup = own_signup_session_entry(sponsorship) in ( | ||
| request.session.get(OWN_SIGNUPS_SESSION_KEY) or [] |
There was a problem hiding this comment.
The Swiss _own_signup_session() helper still stores [self.signup.id]. This check now expects [[signup_id, partner_id]], so that helper no longer grants ownership. The thank-you test receives 404, and the opt-in tests receive {"success": False} instead of saving the choice.
Update the companion tests to use own_signup_session_entry() before merging. Accepting bare contract IDs again would weaken the new ownership check.
|
Thanks for the thorough review. All points are addressed in e63d453, 9d27e72, 065e611 and 174ba5f, and the latest 18.0 is merged in. Replies are under each inline comment. The three points outside the diff:
|
[T3574] my_compassion: separate unverified sponsorships from existing donors and billing
Related PR
CompassionCH/compassion-switzerland#1867
Problem
A public sponsorship (visitor not logged in) went through
res.partner.matchwhenever a name was posted: name + email, or name + postcode. The fast checkout normally asks for no name before payment, but addingfirstname/lastnameto the posted form was enough. The matched donor was then used as the sponsor:Fix
finish_sponsorship(): a public visitor always gets a new partner with an unverified email (my2_email_unverified), with whatever they typed. This is the same rule as the public fund donation ([IMP] my_compassion: give to a fund without an account #420). Its collection group is therefore new too, with no saved card. A saved card can only belong to the group's own partner (existing constraint_check_payment_token).Consequence
A returning donor who sponsors without logging in becomes a second contact with their own collection group, to be merged by staff. This is what the ticket asks for: reuse only with authenticated ownership. An automatic merge after the donor confirms through their own mailbox (a link sent to the known email) could be a follow-up.
Deploy
-u my_compassion(new field onwebsite). Then set "Possible Duplicates Reviewer" on each MyCompassion website: any internal user can be chosen per website. The to-dos are handled by the SDS team.