What hooks are invoked on "Review Order"

Posts: 95
Joined: 10/29/2007
Bug Finder

It seems the easiest things are the most difficult sometimes. I want to validate that a credit card's expiration date is at least 5 months in the future before I send it to authorize I'm going to do this just for a certain product (which I can do) If I don't want to hack the payment module is there a way to read the exp date and then go back to the cart pane if my cc date check fails. I guess I was looking for the hook_order_review but can't find it.

Thanks
Jim

Posts: 924
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

I think this is what you need: http://www.ubercart.org/docs/developer/245/checkout

--

<tr>.

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Aye, you can also look into hook_form_alter() and add a validate handler for the checkout form. It's a little tricky since the CC details are going to be in $_POST and not the Drupal forms right now. There's a little bit of trouble w/ the way payment details form fields cause errors. I'm working on a solution... read more about it in here somewhere.

Posts: 95
Joined: 10/29/2007
Bug Finder

Hi Ryan,
I have a new programmer doing some work on our site, and he had the task of fixing this. I noticed that he made changes to uc_cart.module. (I try to never hack modules). Anyway, he made a change to uc_cart_checkout_form_validate to look at the credit fields and do set_error by reading $_REQUEST[cc_exp_month] and $_REQUEST[cc_exp_year] to do the work.
Did you say that you can have 2 validation events for a form using hook_form_alter()?

Posts: 95
Joined: 10/29/2007
Bug Finder

I wrote a custom validation...

function shopping_form_alter($form_id, &$form) {
if (strcmp('uc_cart_checkout_form', $form_id) != 0) return;
$form['#validate'] = array('credit_check_expdate' => array());
}

But at the end of my validation, I called
uc_cart_checkout_form_validate($form_id, $form_values)

Is this OK way to do this, could I have changed my form alter so BOTH validations would have been called?
JIm

Posts: 5269
Joined: 08/07/2007
AdministratorHead Code Monkey - I eat bugs.

Yeah, instead of resetting the #validate, you can add a handler to it:

<?php
  $form
['#validate']['credit_check_expdate'] = array();
?>

Let me know if that doesn't work. Smiling