spree_store_credit_payment_method icon indicating copy to clipboard operation
spree_store_credit_payment_method copied to clipboard

Don't create gift cards until the order has been completed

Open plongyear opened this issue 10 years ago • 4 comments

Gift cards are being created after an order transitions to the confirm state, which causes issues if the order bounces back to an earlier state and the line item for the gift card is modified.

For instance, if a user adds 2 gift cards to their cart, reaches the confirm state, then goes back and removes one of the gift cards, they'll still have 2 valid gift cards associated with the line item.

finalize! seems like a much better place for this, as we can be assured that the order has been completed.

I also bumped spree in the gemspec. I had issues bundling and it looks like the master branch of Spree is now up to rc3, which fixed the issue.

plongyear avatar Oct 24 '14 18:10 plongyear

@plongyear if you have issues bundling because of prerelease .beta .rc etc... it probably means you need to update to latest version of bundler. That used to annoy the hell out of me.

Definitely better to not create the cards until order transitions to complete, which fires finalize so that's fine.

JDutil avatar Oct 24 '14 19:10 JDutil

This fixes part of issue #19. I think the addition of the store credit payments could happen before the transition to the payment step, that way you could also get fully covered orders to move beyond the payment phase without requiring an additional zero'd credit card payment.

paultyng avatar Oct 25 '14 03:10 paultyng

@JDutil thanks for the tip. I did update bundler but I believe we still need to bump spree to rc3. It looks like SPREE_VERSION is no longer set to 2.4.0.beta on master in spree.

As for creating the cards on completion, are you suggesting that we do this as a state machine transition rather than overwriting finalize!? I'd be happy to update this if so.

plongyear avatar Oct 29 '14 20:10 plongyear

If you did it as it's own transition you don't need to worry about finalize! ever changing. Granted it's unlikely, but just a way to avoid maintenance.

JDutil avatar Oct 30 '14 01:10 JDutil