Re: Re: New Payment module.. Anyone want to take a look before i

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

Whoops, thought I had posted in this thread yesterday. You've got a great start, so I'll list just a few points for you to review and possibly work into the code:

  1. Your hook_menu() doesn't include a path for the canceled page.
  2. You should consider prefixing those URLs with something other than "content", since that's fairly generic. I'd do something like cart/nochex/cancel or something.
  3. When passing URLs to the processor, use the url() function in the Drupal API to send a full URL. Example:
    <?php
     
    'success_url' => url('content/order-complete', NULL, NULL, TRUE),
    ?>

    (It looks like you did this for the test complete but not the normal URLs.)

  4. Your completion function doesn't actually call uc_cart_complete_sale() right now, so a new user account won't get created on anonymous checkout. I'd either specify this module doesn't work w/ anonymous checkout or change that. New user accounts are created based on data in the order object, so you should be able to just call that function with your order and simply disregard the return value of the function.
  5. Also, in your complete function, instead of simply updating the order status, you should use uc_payment_enter() to log a payment. This will also let folks use their normal Workflow-ng configurations to update orders when payments are received.