Hello Zenners
I have a custom payment module, which i did not program.
The problem is, i feel there should be a change to the module.

-Problem-
The module makes zen-cart send out the order confirmation mail
right after clicking confirm, before sending the customer to a payment server.

-Consequence-
When the payment fails, the customer is sent back to the confirm page,
but the order number increments (because the processing script deletes the order in case of a failure)
and the customer can click confirm again, where again the mail is again sent.
This quickly gets messy, because one customer might make two tries or even doesn't convert,
but we remain with confirmation emails that are not valid anymore. (as well as the customer)
This doesn't seem to happen when i use the paypal IPN, where there's no mail
being sent, at least NOT RIGHT AFTER the customer clicks confirm.


How is the module designed:
The module uses a table to associate "order id" to "transaction id".
The module redirects to a payment server, passing along variables formated in the module's runtime.
During the interaction between server and payment server,
processing happens through external files (not in the module) which
verify the infos,
exchange response (and update order status, delete orders that failed) and
redirect to checkout pages.
success (with session_cart reset, _sess_destroy variables) or
failure )


My actions so far :
--I've read through the wiki subject about payment modules,
http://www.zen-cart.com/wiki/index.p...ayment_Classes
--Compared the module code to these payment modules , COD, CC.
--Took a close look onto the processing scripts / functions.

My Questions:
  • Which Method should the module use to launch payment procedure decribed ontop.
  • Is it necessary to remove an order when the payment fails or can the order id be used again ? So that when the user clicks confirm again no new order is created.
  • I cannot find out where the heck the email confirmation is triggered,
    possibly using one of the methods.


I would really appreciate getting help on this one,
it's way over my capabilities.