I you have give certificates in your account, and you choose not to use them but pay using another method (I tested with paypal and uc_free_order) the balance from your gift_certificates is still deducted. So end up paying twice.

The problem is in both branched 6.x-1.1 and 6.x-1.x-dev
The culprit it this piece of code in uc_gift_certificate.module :

function uc_gift_certificate_order($op, &$arg1, $arg2) {
  switch ($op) {
   ....

There in no check for order type. I fixed it by making the following change

function uc_gift_certificate_order($op, &$arg1, $arg2) {
  if ($arg1->payment_method ==  zero_total) switch ($op) {
  ...

Comments

torgosPizza’s picture

Here's the rub: by default the gift certificates act as a "discount" so that you can reduce your order total if you have gift certificates in your account. However lately we've been getting confused customers whose order totals become zero, and Ubercart (not having the Free Payment method enabled by default) have gotten errors when trying to process a $0.00 credit card order. So I need to fix this - what do you think the best way to go is? Should we have a configuration option to allow store admins to decide if they want to use the certificates as a discount or not? (I think that is the best way.)

And then I need to adjust the discount handling so that it's smart enough to change the payment method to certificates when the total is $0. That might be something I'll look into fixing with possible integration with the Free Order module. Thoughts?

aniskhwaja’s picture

I am not sure if there is any any need for for an admin option, i think we should fix the processing of $0.00 order and have them go through this module, in effect I would supersede the free module. If this functionality is in this module there is no need for the free module.

There is a also a real need for admins for testing and pushing things through the carts without bring down their sites etc and the free module allows you add a discount, but there is a bug in free module in the way it does process that it goes in a loop if you actually have an item that has a price attached to it, also there is a hole in the free module that its form hook doesn't validate if you are really an admin and I have a feeling its would be pretty easy to inject a discount in free module.

So if we processed the $0.00 orders cleanly here, and tell the users that they don't need the free module. So I wouldn't worry too much about integration more about making the free module unnecessary .

One thing though I don't think we should be hiding other payment options, I think hiding and showing payment options is the root of all even in the free_module as well, just make our the default, and because of the radio buttons it would clear to the user how the order will processed.

aniskhwaja’s picture

One clarification on this issue. Acting as a discount is fine, but what is happening with paypal is that it looks at the order total and ignores the discount I wonder if its an issue with the paypal module.

torgosPizza’s picture

Oh, that's interesting. Make sure in your Ubercart PayPal settings you are selecting to "send the order as a single line item." Ubercart requires this be checked in order to submit the discounts correctly.

torgosPizza’s picture

The one side effect of this change proposed in the Original Post is that other functions such as assigning certificates to users is being blown away.

I'm thinking of moving some of this functionality to a Conditional Action, although I'd like to keep as much of it within the module as I can, to prevent anyone's site from breaking due to that particular change. I suppose I could warn people about it, but I'd like to refactor and rewrite as much of it to keep working as-is but make way for a better module going forward. Thoughts?