Gift Certificate Broken when using Credit as Secondary Payment Method

Issue #983 duplicate
leitjohn created an issue

I've encountered a bug that will cause the order to be cleared out when using a gift certificate and credit payments.

After making a gift cert payment, going directly to make a credit payment the bug is encountered...

These lines in payment/utils.py (27-33): {{{

!python

(get_or_create_order)

try: order = Order.objects.from_request(request) if order.status != '': # This order is being processed. We should not touch it! order = None except Order.DoesNotExist: order = None }}}

sets the update flag to True when later this code is run: {{{

!python

(update_orderitems) if update: new_order.remove_all_items() else: # have to save first, or else we can't add orderitems new_order.site = cart.site new_order.save() }}}

So all of the items are removed, and the resulting order is empty.

I'm not sure what the best way to deal with this is but here is what i thought would work:

make the gift certs change the status if they don't pay the full amount... Temp? Partially Paid? It might work well to have "Partially Paid" as a status for all the methods that might not pay the full amount. Though off the top of my head, i can only think of the one here.

make the update_orderitems function check to make sure that the "cart" isn't an order. This is what i've done for now, but i don't think that this is necessarily the best way.

{{{

!python

if type(cart).name != "OrderCart": if update: new_order.remove_all_items() else: new_order.site = cart.site new_order.save() }}}

Comments (1)

  1. Log in to comment