You are here

public function OrderHandler::updateOrder in Mailchimp E-Commerce 8

@inheritdoc

Overrides OrderHandlerInterface::updateOrder

File

src/OrderHandler.php, line 71

Class

OrderHandler
Order handler.

Namespace

Drupal\mailchimp_ecommerce

Code

public function updateOrder($order_id, array $order) {
  try {
    $store_id = mailchimp_ecommerce_get_store_id();
    if (empty($store_id)) {
      throw new \Exception('Cannot update an order without a store ID.');
    }

    /* @var \Mailchimp\MailchimpEcommerce $mc_ecommerce */
    $mc_ecommerce = mailchimp_get_api_object('MailchimpEcommerce');
    $mc_ecommerce
      ->updateOrder($store_id, $order_id, $order);
  } catch (\Exception $e) {
    mailchimp_ecommerce_log_error_message('Unable to update an order: ' . $e
      ->getMessage());
    drupal_set_message($e
      ->getMessage(), 'error');
  }
}