I noticed that, when adding a payment, there is no validation to ensure that the payment is not greater than the remaining balance. I need to not allow users to create a payment that will reduce the balance below 0 or increase it above the order total. I can use hook_form_alter() to add a custom validation, that's not an issue. However, I want to understand why this is not part of commerce_payment_order_transaction_add_form_payment_terminal_validate() or commerce_payment_order_transaction_add_form_validate().

Comments

rszrama’s picture

Status: Active » Fixed

Primarily because there's nothing technically "wrong" about that. If an administrator takes too much money, that's their decision, but there are reasons to take more than is actually remaining on an order's balance. I don't think Drupal Commerce will introduce some hard and fast rule here, but it should be easy enough to alter on your specific validation handler to the form; might even make for a handy contrib module for others to use. : )

BassistJimmyJam’s picture

Thanks rszrama, that what I figured but what I wanted to make sure I understood correctly. It seems like I'm adding commerce contrib modules left and right these days, I don't see what the harm in adding another one would be.

rszrama’s picture

hehe The more the merrier (as long as they're distinct ; ). That's not to say none of these can be folded into core, but I'm generally more prone to recommend new features go into contribs than core to begin with. : )

BassistJimmyJam’s picture

For anybody that finds this post and is interested http://drupal.org/project/commerce_payment_balance_validation.

Status: Fixed » Closed (fixed)

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