New Payment module.. Anyone want to take a look before i release it?

Posts: 17
Joined: 03/27/2008

Hi i have a new payment module for nochex. This was my first module, so if anyone would like to look at it and make any improvements before i release it that would be great!

Thanks

Andy

AttachmentSize
uc_nochex.zip15.32 KB
Posts: 17
Joined: 03/27/2008

sorry, i dont think that attachment works... heres one that will i hope Laughing out loud

AttachmentSize
uc_nochex.zip15.59 KB
Posts: 4116
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.
Posts: 17
Joined: 03/27/2008

heres the latest:

AttachmentSize
uc_nochex.zip15.69 KB
Posts: 17
Joined: 03/27/2008

heres the function that gets called after payment has been recieved. its not right yet i dont think.. anyone help me out?

function uc_nochex_complete($cart_id = 0) {
$order = uc_order_load($_POST['order_id']);

// change order status to payment revieved
uc_order_update_status($order->order_id, 'payment_received');

// add payment details
uc_payment_enter($order->order_id, 'nochex', $_POST['amount'], 0, NULL, $comment);


uc_cart_complete_sale($order->order_id);

// Empty the cart.
  uc_cart_empty($cart_id);
  exit();
}

Thanks

Andy

Posts: 13
Joined: 01/20/2008

Tracking this thread because I'm trying to finish my own payment module for Moneris Hosted Pay Page. (Yes this is different than the existing Moneris module).

I'm wrestling with how to complete the transaction when redirected back from the the Moneris page. This module seems to have it. Can the latest submission be considered complete?

--

"I've had this birthmark since I was born." --JB