When uc_credit.module alters the "uc_payment_gateways_form", there is some code which should be working on the $gateway_types, but there is a misspelling so the code never gets accessed ($types).

Looking more closely, it appears to be old code for choosing a default transaction type for gateways which have no transaction types defined. This functionality is already achieved through the uc_credit_gateway_txn_types() function. I am submitting a patch which removes this unused and inaccessible code.

CommentFileSizeAuthor
#1 ubercart.patch1.18 KBjoelstein
ubercart.patch743 bytesjoelstein
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joelstein’s picture

Title: Some inaccessible code in uc_credit.module » Available transaction types aren't exposed to payment gateways
FileSize
1.18 KB

I changed the title, and this may look unrelated, but it just so happens that I found another bug two lines after the one mentioned in this ticket.

When building the transaction type field for each payment gateway, uc_credit.module should loop through all the available transaction types found in uc_credit_transaction_types(), and then check those against the payment gateway's available transaction types. However, hard-coded are the options of "authorization only" and "authorization and capture immediately".

I've updated the patch to use uc_credit_transaction_types() to retrieve all the available transaction types.

joelstein’s picture

Title: Available transaction types aren't exposed to payment gateways » Some inaccessible code in uc_credit.module
Category: bug » task

Nevermind my comment in #1. I was a little confused about how the transaction types should be handled. To make things much easier, just ignore my comment and patch in #1, and just take a look at my original issue, which just removes some unused code. Thanks!

TR’s picture

Version: 6.x-2.0-rc3 » 6.x-2.x-dev
Status: Needs review » Fixed

Confirmed that the block of code removed by the patch in the original post really *should* be removed. Specifically, all it does is set the $types array, which is never used.

According to the comment in the code, the purpose of the code block is to set a default transaction type if the gateway fails to define available transaction types. Since the existing code is not actually doing that, I think it's wise to check to make sure that a default really *is* being set under those conditions, as intended. And it is - the call to uc_credit_gateway_txn_types() obtains the available transactions types for the gateway and defaults to returning authorize + capture if none are defined.

Committed this fix to the 6.x-2.2-dev branch.

Status: Fixed » Closed (fixed)

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