The attached patch adds autocapture support to the core Quickpay module, and to the Übercart module. Orders with no shippable items are automatically set to autocapture.

It also adds a crude test mode, by defining a constant QUICKPAY_ALWAYS_TEST which, if set to true, causes the 'testmode' parameter to be set, and appends a 'T' to the order number. The use case for this is having a git tree with a branch for a test server, that sets the constant to true.

I have not done extensive testing, but it seems to be working. The EC module support is missing, obviously, but I've tried to make the (minimal) changes to the core module compatible with an unchanged EC module.

Comments

tohojo’s picture

StatusFileSize
new5.97 KB

Hmm, it seems something ate my patch. Lets try that again...

xen’s picture

Status: Active » Needs work

Looks good, but need a bit of work:

The QUICKPAY_ALWAYS_TEST needs to be a variable instead, redefining constants is not nice, and variables can be overridden in settings.php.

Autocapture needs to be togglable via a setting, there's no guarantee that non-shippable orders can be autocaptured (one usecase might be paying for access, that needs manual approval).

xen’s picture

Status: Needs work » Fixed

Committed to -dev. Please test and report back on how it works.

Also, I'd like to hear about how UC handles autocaptured payments. There's an outstanding FIXME in uc_quickpay_complete regading whether it should do anything special if the transaction is paid.

tohojo’s picture

StatusFileSize
new915 bytes

The code in CVS HEAD seems to work, with a few small errors fixed in the attached patch.

With regards to UC and autocapture, it seems that UC does the right thing. I.e. that entering the payment of the full amount on the callback sets the order status to "completed" as it's supposed to. The log entries from a completed order (with autocapture enabled) looks like this:

26 February, 2010 - 21:13	-	Credit card payment for 75,00 kr. entered by -.
26 February, 2010 - 21:13	-	Order status changed from In checkout to Payment received.
26 February, 2010 - 21:13	-	Order status changed from Payment received to Pending.
26 February, 2010 - 21:13	1	Order status changed from Pending to Completed.
xen’s picture

Committed. It's included in the beta4 release.

I guess that makes the Übercart module ready for a 1.0 release.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.