The parent issue adds an additional field to the commerce_order entity to store the card id that was used to pay for the order.

As stated in the parent issue because the card on file creation has been moved to the payment modules, adding the update of the commerce_cardonfile_card_id field should be fine to do so after a card is created.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Steven Brown’s picture

Status: Active » Needs review
FileSize
1.11 KB
mglaman’s picture

Status: Needs review » Closed (won't fix)

This is now handled within CoF's commerce_cardonfile_order_charge_card()

    // load a fresh order in case it was modified during method callback
    $order = commerce_order_load($order->order_id);
    $order_wrapper = entity_metadata_wrapper('commerce_order', $order);

    // Store the last processed card on the order card reference field
    if (isset($order_wrapper->commerce_cardonfile)) {
      $order_ref_card_id = $order_wrapper->commerce_cardonfile->value();
      if (empty($order_ref_card_id) || $order_ref_card_id != $card->card_id) {
        $order_wrapper->commerce_cardonfile = array('card_id' => $card->card_id);
        $order_wrapper->save();
      }
    }