Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#1 | ubercart.patch | 1.18 KB | joelstein |
ubercart.patch | 743 bytes | joelstein | |
Comments
Comment #1
joelstein CreditAttribution: joelstein commentedI 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.
Comment #2
joelstein CreditAttribution: joelstein commentedNevermind 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!
Comment #3
TR CreditAttribution: TR commentedConfirmed 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.