Extending Campaign Kit

Campaign Kit uses the Hook Event Dispatcher module to respond to certain events during the lifecycle of a campaign or donation. Campaign Kit and the payment plugins also dispatch their own events. By subscribing to events from any of these sources, you can write custom code in your modules to perform additional functions.

Here is the payment flow:

  1. CK displays form and accepts CC number.

  2. CK calls Payment passing the CC number and user information.

  3. Payment calls Stripe Payment Plugin with CC number and user information using a function or event.

  4. Stripe Payment Plugin calls Stripe PHP library with a function

  5. Stripe Plugin returns a result of API call, “success” or “failure.

  6. Stripe Plugin fires the appropriate event (“ChargeSucceed” or “ChargeFailure”)CK responds with

  7. ChargeSucceed event subscriber updates CK tables and displays message “Your donation succeeded” message.

  8. ChargeFailed event subscriber updates CK tables and displays “Your donation failed” message.

Below are the events to which you can subscribe.

HED: Hook Event Dispatcher CK: Campaign Kit Payment: Payment module SPP: Stripe Payment Plugin

Area

Event Name

Dispatcher

Description

Drupal Entity

EntityAccessEvent

HED

Fires when Campaign Kit entity is accessed.

Drupal Entity

EntityCreateEvent

HED

Fires when Campaign Kit entity is created.

Drupal Entity

EntityPredeleteEvent

HED

Fires before Campaign Kit entity is deleted.

Drupal Entity

EntityDeleteEvent

HED

Fires when Campaign Kit entity is deleted.

Drupal Entity

EntityInsertEvent

HED

Fires when Campaign Kit entity is inserted.

Drupal Entity

EntityLoadEvent

HED

Fires when Campaign Kit entity is loaded.

Drupal Entity

EntityViewEvent

HED

Fires when Campaign Kit entity is viewed.

Drupal Entity

EntityPresaveEvent

HED

Fires before Campaign Kit entity is saved.

Drupal Entity

EntitySaveEvent

HED

Fires when Campaign Kit entity is saved.

Drupal Form

FormAlterEvent

HED

Fires when a form is rednered.

Campaign Kit

CampaignFormAlterEvent

CK

Campaign Kit

CampaignDonationEvent

CK

Fires when a donation occurs.

Campaign Kit

CampaignViewEvent

CK

Fires when campaign is viewed.

Stripe Payment Plugin

StripeWebhookEvent

SPP

Fires when payment occurs.

Stripe Payment Plugin

StripeWebhookChargeFailed

SPP

Stripe Payment Plugin

StripeWebhookChargeSucceeded

SPP

Stripe Payment Plugin

PaymentPreauthorize

SPP

Fires when payment is being preauthorized.

Stripe Payment Plugin

PaymentAuthorize

SPP

Stripe Payment Plugin

PaymentComplete

SPP

Stripe Payment Plugin

ChargeSucceed

SPP

Stripe Payment Plugin

ChargeFailed

SPP

Stripe Payment Plugin

ChangePending

SPP

Stripe Payment Plugin

ChargeRefunded

SPP

Stripe Payment Plugin

ChargeUpdated

SPP

Stripe Payment Plugin

ChargeCaptured

SPP

Creating an Event Subscriber

To add functionality, create an event subscriber for one or more of the events shown above. There is an example of an event subscriber in the Campaign Kit Demo module.

Last updated