thinkshout / redhen_donation Goto Github PK
View Code? Open in Web Editor NEWMirror of RedHen Donation from http://drupal.org/project/redhen_donation
Mirror of RedHen Donation from http://drupal.org/project/redhen_donation
# RedHen CRM Donation ## About RedHen Donation RedHen Donation allows for a RedHen Donation field to be attached to an entity, which attach a form to that entity for processing donations. It integrates with Drupal Commerce to handle order processing and payment handling. It relies on Commerce Card on File and Commere Recurring to process recurring donations. ## Notes * Donation products should have an amount of 0. * Recurring donations requires the patches found at: * Commerce Recurring * https://drupal.org/node/2273443 * https://drupal.org/node/2263371 * Commerce Card on File * https://drupal.org/node/2275263 ## Required Modules * redhen_contact * commerce_checkout * commerce_product * commerce_recurring * commerce_cardonfile * select_or_other ## Configuration The following are prerequisites to setting up RedHen Donation: * Drupal Commerce installed and functioning. * At least one Payment Processor configured in Drupal Commerce. * At least one RedHen Contact Type setup. 1. Create a Donation Type * Go to Structure -> RedHen CRM -> Donation Types. * Click “Add a Donation Type”. * Complete the settings: * Label - Identifier for this Donation Type. * Contact Type - the type of RedHen Contact to create when processing a donation, if no matching Contact is found based on the provided email address. * Update Contact Fields - If a matching Contact is found, should the Donation Form contact field values (Address, etc) be used to update the Contact. (If checked, this can overwrite the existing values in your RedHen CRM for this Contact.) * One Time Product Type - The Commerce Product Type for non-recurring Donations generated by this Donation Type. * Order Type - The Commerce Order type to create when processing a Donation. (Only appears if multiple options exist.) * Line Item Type - The type of Line Item to create for the Donation. (Only appears if multiple options exist.) * Save your new Donation Type. * Click the “Manage Fields” link next to your new Donation Type to add fields to your Donation form. For example, you might want to provide an “In Honor of” field for certain Donation Types. You can add any type of Drupal Field here. 2. Create a Donation-enabled Entity * Either create a new Content Type, or edit an existing one. * Add a field to your Content Type of type “Donation”. 3. Create a Donation Page * Either create a new Entity of the type from step 2, or edit an existing one. * Select a valid Donation Type for your Donation Field on your Entity. * Save your Entity * View your Entity * Next to the Entity’s “Edit” tab, click the “Manage Donations” tab. * Click the “Settings” sub-tab and configure the Donation Page settings: * Enable - Check to enable the Donation. * Scheduling - Configure dates to automatically enable/disable Donations * Confirmation Page - Enter a page to direct users to after they complete their donations. * Donation Entry - Select the form element for entering a donation amount. * Minimum Donation & Maximum Donation - Restrict the donation amounts. * RedHen Field Selector - This will list all the non-address fields on your RedHen Contact Type. Check the boxes to add those fields to your Donation form in the Contact area, allowing you to gather additional data for the creation & updating of RedHen Contacts. (Note that if a Contact of a different type than the default for this donation is updated this way, these fields may not exist on that Contact type and won’t be updated. Overlapping fields WILL be updated.) * One Time Product” & “Recurring Product - Select the Product Type to create when processing donations. * Billing Profile Syncing Field - The address field on the RedHen Contact to sync with the Billing Address data provided for the Donation. * Payment Methods - Select your Commerce Payment Method, and the appropriate currency for that payment method. If you want to provide multiple-currency ready Donation Forms, you can add multiple Payment Methods to this field, and the users will be allowed to select which payment method to use while making donations. * Save your settings
Donations are fieldable entities. Donation Types are the bundle for Donations.
Donations
should extend ContentEntityBase and have the following properties:
Paths
should follow predictable patterns:
Donations should be listed at
reports -> redhen donations
Donations should also be listed on the content where they were created. So, if a node is able to take donations, it will have a tab next to its "edit" tab called "Donations", which itself has 2 tabs: a listing tab and a settings tab.
Generating notices on FH.
http://cgit.drupalcode.org/redhen_donation/tree/lib/redhen_donation.metadata.inc#n117
Also, the getter callback for transaction_entity has a typo in transaction.
On lines 890 and 922. No clear reason.
fork the redhen_dev repo
base on https://github.com/thinkshout/drupal-project
Include a working version of redhen_donation 8.x-1.x branch created in #14
This is a FieldFormatter that outputs the contents of a Donation Type Field (#17) as a from form creating the appropriate type of Donation. Note that most examples of FieldFormatters will NOT be outputting Forms, this is an unusual usage.
Initialized at src/Plugin/Field/FieldFormatter/DonationForm.php
donation_form
.Declared several times, but never used.
Donation capability is provided via field api. A "Donation Type" field provides a picklist on the edit screen to choose from the Donation Type bundles on the system. If one is selected, then the field itself displays as a donation form.
redhen_donation_type
similar to List String
redhen_donation_type
that displays as a drop-down, listing Donation Record Types, and allow its use on the FieldType created.Note: Creation of a custom field formatter to output this field as a donation form will take place in a separate ticket.
It just returns an empty array.
I'm not sure, but I believe the intent is to issue a break not a continue in the following:
foreach ($payment_methods as $payment_method) {
if ($payment_method['payment_method'] == $form_state['values']['payment_method']) {
$currency = $payment_method['currency'];
continue;
}
}
Donation configuration options should be available on individual Donation-enabled content entities.
These configuration options include suggested amounts, confirmation message, confirmation page, maximum and minimum donation amounts, and the label for the submit button.
And also shows as disabled on the donations page.
Create a rules trigger for a donation being made which triggers on successful donation. Provide the donation entity as a variable (this should also give rules access to current user and the parent entity).
This rules patch may be needed: https://www.drupal.org/project/rules/issues/2724129
Depending on progress on this ticket: https://www.drupal.org/project/rules/issues/2471481
Create a test rule to make sure an email trigger can be generated this way.
Write up instructions for generating email notifications in the Readme, including "rules is required" and a reference to the patch, if needed.
Create the branch for this work (8.x-1.x), scaffold a drupal 8 "redhen_donation" module.
The donation tool should ideally be able to accept payments using whatever payment processor the site owner desires. This will require unique API implementations for each payment processor, and we will start with a small subset of these available.
We are building our own plugin definition because the Drupal 8 payment landscape does not offer us what we need, although it would be nice if it did. More here: https://docs.google.com/document/d/1SXZjeTZlqSR4QOX4woqpq8Dt0jJhW_0WlzHy8vks4n4/edit
Currently, RedHen Donation requires tying the donation form down to a single product, and the product's price is ignored. A more "commercey" workflow would be to allow a site builder to configure a set of products with prices, and attach any number of those products to a donation form. Then when a user makes a donation, any number of products could be selected. (Depends on the configuration - maybe you want a single select, maybe a multi select or checkboxes, maybe you want some of them to be single and some to be multi in the same form.) RedHen Donation would add the prices up to form a donation "total" amount.
The detail about which product(s) were selected would need to be stored with the donation when the donation is processed, for further reporting about which "products" were donated for.
Original planning doc
Datastructure architecture
Redhen Donation for Drupal 7 was successful at some things, and not so successful at some things. Regardless, it will be useful to understand how the D7 version works, but you should note expect to be able to re-use significant amounts of code. The plan for Drupal 8 is to retain what 7 did well, while simplifying and modularizing.
The use of a custom bundle (Donation Type) and Entity (Donation) to define donation styles and then track donations was successful in providing record-keeping and flexibility. These we should keep.
The reliance on Drupal Commerce, especially on Commerce Products, Orders, and Line items, generally created more trouble than seemed valuable. We have different expectations and needs than Commerce, therefore we should remove it as a dependency, while structuring our work well enough to connect to Commerce, if needed, at a later date: commerce compatibility is not a priority for the initial release.
There was also often confusion in RD7 around the borders of a Donation. Was a Recurring donation multiple donations? Or a single Donation with multiple payments? What happened when a person’s name appeared differently on their Donation than they wanted it to appear in Redhen?
Since Donation forms are sensitive from a design perspective, RD7 also struggled with its “3-entity-forms”, where a Payment entity, a Contact Entity, and a Donation Entity were all being constructed at the same time.
Note the drawing here linked above.
Redhen Donation for Drupal 8 will define the following data structures and plugins:
Redhen Donation for Drupal 8 will contain a submodule called “Redhen Donation Contacts” which has Redhen Contact module as a dependency.
Redhen Donation Contacts will add a configuration option to the “configuring donations” route page that allows editors to map fields on the Donation Type to fields on an upserted Redhen Contact, and decide whether to overwrite existing values or not.
Redhen Donation Contacts will hook into incoming donations to upsert Redhen Contact information.
Note that Redhen Donation can operate without Redhen Donation Contacts.
To make the donation form display customizable, we need the basic elements of the donation to be re-arrangeable and re-orderable along with the fields on the donation. When customizing the Form Display for a Donation Type, you should see these elements along with all the fields on the Donation Type:
Make sure that these work, and interact with the DonationForm::buildForm()
code as expected.
Donations are fieldable entities. Donation Types are the bundle for Donations. A "donation page" will be created by connecting a piece of content to a Donation Type, which determines what fields should be presented on the donation creation form.
Donation Types
should extend ConfigEntityBase
Paths
should follow predictable patterns:
Donation types should be administered & created at
admin -> structure -> redhen donation -> donation types
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.