You are here

interface CustomerHandlerInterface in Mailchimp E-Commerce 8

Interface for the Customer handler.

Hierarchy

Expanded class hierarchy of CustomerHandlerInterface

All classes that implement CustomerHandlerInterface

File

src/CustomerHandlerInterface.php, line 9

Namespace

Drupal\mailchimp_ecommerce
View source
interface CustomerHandlerInterface {

  /**
   * Read a customer from Mailchimp.
   *
   * @param string $customer_id
   *   Unique id of customer.
   *
   * @return object
   *   Mailchimp customer object.
   */
  public function getCustomer($customer_id);

  /**
   * Add a new customer to Mailchimp.
   *
   * @param array $customer
   *   Array of customer fields.
   *
   * @see http://developer.mailchimp.com/documentation/mailchimp/reference/ecommerce/stores/customers/#create-post_ecommerce_stores_store_id_customers
   */
  public function addOrUpdateCustomer($customer);

  /**
   * Delete a customer from Mailchimp.
   *
   * @param string $customer_id
   *   Unique id of customer.
   */
  public function deleteCustomer($customer_id);

  /**
   * Loads the existing customer id or creates a new one.
   *
   * @param array $customer
   *   The customer.
   *
   * @return int $customer_id
   *  The customer id.
   */
  public function loadCustomerId($customer);

  /**
   * Saves the customer locally and returns customer data formatted for use with Mailchimp.
   *
   * @param array $customer
   *   The customer.
   *
   * @param object $billing_profile
   *   The Drupal Commerce Billing Profile.
   * @return array
   *
   *   Array of customer data.
   */
  public function buildCustomer($customer, $billing_profile);

  /**
   * Increments the order count and total amount spent by a customer.
   *
   * This information is tracked and sent to Mailchimp with every order.
   *
   * @param string $email_address
   *   The email address associated with the customer.
   * @param float $total_spent
   *   The amount to increment total spent for. This is the order total.
   * @param int $orders_count
   *   The number of orders to increment.
   *   Should always be 1, but available here to change if needed.
   *
   * @return bool
   *   TRUE if the customer exists and was updated, FALSE otherwise.
   */
  public function incrementCustomerOrderTotal($email_address, $total_spent, $orders_count = 1);

  /**
   * Returns the total amount spent by a customer.
   *
   * @param string $email_address
   *   The email address associated with the customer.
   *
   * @return float
   *   The total amount spent.
   */
  public function getCustomerTotalSpent($email_address);

  /**
   * Returns the total number of orders made by a customer.
   *
   * @param string $email_address
   *   The email address associated with the customer.
   *
   * @return int
   *   The total number of orders.
   */
  public function getCustomerTotalOrders($email_address);

}

Members

Namesort descending Modifiers Type Description Overrides
CustomerHandlerInterface::addOrUpdateCustomer public function Add a new customer to Mailchimp. 1
CustomerHandlerInterface::buildCustomer public function Saves the customer locally and returns customer data formatted for use with Mailchimp. 1
CustomerHandlerInterface::deleteCustomer public function Delete a customer from Mailchimp. 1
CustomerHandlerInterface::getCustomer public function Read a customer from Mailchimp. 1
CustomerHandlerInterface::getCustomerTotalOrders public function Returns the total number of orders made by a customer. 1
CustomerHandlerInterface::getCustomerTotalSpent public function Returns the total amount spent by a customer. 1
CustomerHandlerInterface::incrementCustomerOrderTotal public function Increments the order count and total amount spent by a customer. 1
CustomerHandlerInterface::loadCustomerId public function Loads the existing customer id or creates a new one. 1