Digital Fulfillment Hooks (VitalSource & ELE)

This document details the process for fulfilling digital products, specifically eBooks via VitalSource and coursebooks via ELE.

VitalSource eBook Fulfilment

The fulfilment of VitalSource eBooks is an automated process that occurs after an order is successfully paid for.

Workflow:

  1. Trigger: The order-sync process is initiated for a new, paid order.
  2. eBook Detection: The VitalSourceSync::syncOrder() method is called. It iterates through the order items and uses ZohoHelper::hasEbook() to identify any products that are eBooks.
  3. Role-Based Licensing: The system checks the B2B role settings for the customer to determine the correct license terms (e.g., perpetual, or a specific number of days).
  4. API Call: The VitalSourceConnector::createCodes() method is called. This makes a server-to-server API call to VitalSource to generate the unique redemption code(s) for the eBook.
  5. Save Code: The generated code(s) are saved as metadata against the specific line item in the WooCommerce order. The meta key is _vitalsource_codes.
  6. Email Notification: When the order confirmation email is generated, the hooks/vitalsource-order.php file reads the saved redemption codes from the order meta and inserts them into a special email template (emails/email-ebooks.php), which displays them to the customer.

ELE Coursebook Fulfillment

The process for ELE coursebooks is similar, involving the generation and delivery of access coupons.

(Note: Further investigation of connectors/ele-connector.php and hooks/ele-email.php would be required to fully document this flow with the same level of detail as the VitalSource integration.)