- Issue created by @jonathanshaw
- 🇬🇧United Kingdom jonathanshaw Stroud, UK
One thing I want to explain here, because it's a bit odd, is how the 'context' for a Gift Aid declaration works.
There's a 'context' dynamic (i.e. can reference any entity type) entity reference (DER) field on the declaration entity type. This is for answering the question "who" is making the declaration.
The reason why this uses DER is that as this is contrib-land we don't know in principle how other sites are choosing to build their database of people. For example, they might be using Drupal's "user" entity type, but maybe they have some (Drupal or external) CRM system and they want to track gift aid declarations against the "contact" entity type from that.
The 'context' reference field allows a declaration to be associated with a particular entity, but allows for further chains of entity reference to be built.
A complex example explains the need more :
- an anonymous customer makes a donation and ticks gift aid at checkout. The context is the commerce order.
- at the end of checkout, they create a user account, which then gets set as the customer on the order.
- the site is using a CRM contact entity type as the actual canonical focus of their Gift Aid system, and the new user is linked up to an existing CRM contact with the same emailThe problem is: how do we link the gift aid declaration with the CRM contact? The solution I've created is to use an event as part of the process of querying for declarations. You use web/modules/ahs/gift_aid/src/GiftAidRelatedContextsManager.php to find contexts that relate to other contexts, so that the order declaration can get added in when you are seeking declarations for the CRM contact.
- 🇬🇧United Kingdom adamps
@jonathanshaw The project page says:
The submodule Gift Aid Commerce has integration with it, and supports gathering Gift Aid declarations as part of checkout.
However I don't see any sub-module. Please can you clarify?
- 🇬🇧United Kingdom jonathanshaw Stroud, UK
I don't see any sub-module.
It's in the latest version in the gift-aid branch, per my comment on 📌 Migrate basic code Active .
- 🇬🇧United Kingdom adamps
I made a start. I feel that I can't really continue until the features are a bit more decided and stable.