Skip to content

feat: Replace mock Perk data in CiviCRM repository with data from JSON

stephen requested to merge load-perks-from-json into main

This MR serves to, at long last, replace the mock donation perk data used by tordonate.civicrm.repository with a live source.

That source is perks.json, a file which will be updated periodically, by a separate maintainer, who will export up-to-date JSON data from CiviCRM based on current perk inventory. (The methodology by which that maintainer will update this flatfile is beyond the purview of this MR, but maintainers of donate-neo should ensure that perks.json is updated frequently with relevant data based on current inventory.)

This commit:

  • Adds perks.json
  • Refactors perk information out of the CiviCRM DI container instantiation
  • Adds code to tordonate.civicrm.repository.CivicrmRepositoryMock's constructor which loads the aforementioned JSON data and uses it to fill CivicrmRepositoryMock._active_perks with Perk objects.

Merge request reports