Page MenuHomePhabricator

Implement recurring donation monthly-to-annual conversion
Closed, ResolvedPublic

Description

Needs to take contact ID, checksum, contribution recur id, amount, and currency on the URL

Three choices

  • suggested yearly amount based on new config array in the style of the monthly convert suggestions
  • yearly donation with the same amount as the current monthly
  • other amount with a field

Confirmation box with amount and next donation date

Button to confirm sends a message to the recurring-modify queue with new frequency_unit, then shows a confirmation page with two buttons - one back to main portal page and one to donatewiki.

Update RecurringModify queue consumer to handle the change, updating frequency_unit and next_sched_contribution_date

Cancel button returns to donor portal main page

Create new activity type (recurring conversion ?) and make the 'Activity Tracking' custom table extend it.

Activity's details field should have similar information to the details field of the Recurring upgrade / downgrade activities. We should also store whether the activity came from the 'save flow', i.e. whether the donor clicked directly on the modification button from the donor portal main page, or whether they initially clicked on 'cancel' then chose the modification option.

Event Timeline

AKanji-WMF changed Risk Rating from N/A to Informational.Apr 16 2025, 6:18 PM

Hi @Ejegg - quick question, for the annual recurring conversion functionality in the donor portal, can we dynamically calculate what the array amounts should be with a formula that @MSuijkerbuijk_WMF s provides? Or can we only add increments (e.g. +5)

Another question @Ejegg - do you have a sense of the logic for a conversion to annual recurring? specifically what will the date be - will the supporter get to select that? cc: @krobinson

context in copy doc:
https://docs.google.com/document/d/1Sk5C74ayvH-0eUo9pmMtSxpQ4yTC-ieu3zkjfP9R-Z8/edit?hl=en&tab=t.0#heading=h.1qqstyb83qk6

@Ejegg since this also allow input for what amount, need the same as modify monthly new amount range validation, do you feel we can add the amount:validate as external api to be called in vuejs?

We could, but it would require us to instantiate a new gateway object for each call. Unfortunately the gateway constructor does a lot of stuff we don't really want in this case, like requesting a new contribution tracking ID. I think we might have to use the default minimums for now and just load the full list of values in JS like we do for the payments forms.

Change #1203585 had a related patch set uploaded (by Ejegg; author: Ejegg):

[wikimedia/fundraising/crm@master] Add payment processor name to summary output

https://gerrit.wikimedia.org/r/1203585

Change #1203587 had a related patch set uploaded (by Ejegg; author: Ejegg):

[mediawiki/extensions/DonationInterface@master] Add properties for DonorPortal amount validation

https://gerrit.wikimedia.org/r/1203587

Change #1203585 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Add payment processor & country to summary output

https://gerrit.wikimedia.org/r/1203585

Change #1203587 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Add properties for DonorPortal amount validation

https://gerrit.wikimedia.org/r/1203587

Change #1204943 had a related patch set uploaded (by Wfan; author: Wfan):

[wikimedia/fundraising/crm@master] Add annual conversion activity type

https://gerrit.wikimedia.org/r/1204943

Change #1204998 had a related patch set uploaded (by Wfan; author: Wfan):

[mediawiki/extensions/DonationInterface@master] Donor Portal: Convert to annual recurring

https://gerrit.wikimedia.org/r/1204998

Change #1204943 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Add annual conversion and activity type

https://gerrit.wikimedia.org/r/1204943

Change #1204998 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Donor Portal: Convert to annual recurring

https://gerrit.wikimedia.org/r/1204998

XenoRyet set Final Story Points to 8.

Noting I tested this right now as part of QA - I was successfully able to convert to annual recurring in the "Save" flow - i.e. when I attempted to cancel my monthly gift. However I don't see desired details in the activity - are these being written somewhere else where analytics can parse them?

Added by kanji, anil
With Contact
Assigned to
Subject Convert to annual recurring with amount 2.75 CAD
Campaign
Engagement Index
Location
Date December 9th, 2025 3:49 PM
Duration
Activity Status Completed
Details {"next_sched_contribution_date":"2026-12-09 12:12:00","new_annual_amount":"2.75","new_annual_amount_in_usd":"1.99","native_currency":"CAD","native_original_amount":"2.75","usd_original_amount":"1.99","native_amount_removed":30.25,"usd_amount_removed":21.89}
Priority Normal

@AKanji-WMF that JSON blob in the 'Details' is what we thought was needed. Is there something missing?

Details {"next_sched_contribution_date":"2026-12-09 12:12:00","new_annual_amount":"2.75","new_annual_amount_in_usd":"1.99","native_currency":"CAD","native_original_amount":"2.75","usd_original_amount":"1.99","native_amount_removed":30.25,"usd_amount_removed":21.89}

Ejegg added a subscriber: AnnWF.

@AKanji-WMF you re-opened this and moved it into sprint complaining that the activity was missing details, but I think the details are actually there. Can you please clarify what additional details are needed?

Thanks @Ejegg I think I was not seeing in the activity that this change was initiated from the donor portal. But @CHudson-WMF do you have what you need?

Yes, I think so! Quick question, though, how should I interpret the values for:

...native_amount_removed":30.25,"usd_amount_removed":21.89}

Is this just the amount of the monthly contribution X 12 - the new annual recurring amount?

Yep, that appears to be the calculation! I also just noticed one thing from the ticket that we could add to those details - is_from_save_flow.

The 'is_from_donor_portal' flag is in a custom field that unfortunately doesn't show in the UI yet ( T407782: Donor Portal/Civi visibility for Donor Relations and T412251: Replace Activities tab in CiviCRM with SearchKit )

MariaDB [civicrm]> select * from civicrm_activity_tracking where entity_id=263334772;

identity_idcampaignmediumsourceis_from_donor_portal
35962263334772NULLNULLNULL1

Thanks, I'm already using is_from_donor_portal for the other activities, so I can use that for this activity as well.

It'd definitely be handy to have there if the donor was in the save flow. Would we be able to update other actions the donor could take in the save flow, as well?

Starting work to add is_from_save_flow to the message and the details JSON blob

Change #1224985 had a related patch set uploaded (by Ejegg; author: Ejegg):

[mediawiki/extensions/DonationInterface@master] Add is_from_save_flow to recurring messages

https://gerrit.wikimedia.org/r/1224985

Change #1224987 had a related patch set uploaded (by Ejegg; author: Ejegg):

[wikimedia/fundraising/crm@master] Handle 'is_from_save_flow' for recurring modify queue

https://gerrit.wikimedia.org/r/1224987

Change #1224985 merged by jenkins-bot:

[mediawiki/extensions/DonationInterface@master] Add is_from_save_flow to recurring messages

https://gerrit.wikimedia.org/r/1224985

The front end change to add is_from_save_flow to these messages has been deployed - just waiting for review on the backend change: https://gerrit.wikimedia.org/r/1224987

Change #1224987 merged by jenkins-bot:

[wikimedia/fundraising/crm@master] Handle 'is_from_save_flow' for recurring modify queue

https://gerrit.wikimedia.org/r/1224987