Groupon-like Vouchers

Permalink Browser Info Environment
Hello. I'm using this package to create something like Groupon, so I am making some minor modifications (as overrides). I am mostly modifying the emails (receipt and voucher) and the process that creates them, however there is one change I need some advice on.

My site is WayToMail.com

The purchaser can use the coupon code to come back to the website any buy something else, which is the default behavior of the gift card concept, however there is one capabilities I need to add, and I want to make sure I don't break anything in the process.

** External process to invalidate the coupon. **

When the purchaser brings the gift card to the merchant, the merchant phones it in for confirmation or uses a mobile app to scan it (that's all done, I have the data inserted into a separate table). At this point, I need to erase or disable the gift card.

(If I had more time, or perhaps later I can hire you to make this change, in a perfect world, the merchant would redeem the coupon by purchasing cash within the same e-commerce system, but in the short term, I just want to null out the value of the gift card so it can't be used twice)

I suppose I could simply erase the record from the table, right? Or can I change the Status to "2" or something, so it isn't considered "disabled" (-1) or "enabled" (1). Can I permanently disable the gift card by changing the status to 2 or should I just erase it? (I won't need it anymore).

Like I said, for customer service purposes, and I have all of that information saved in an external table by this time.

Type: Discussion
Status: New
ErikLeeOlson
View Replies:
Mainio replied on at Permalink Reply
Mainio
If you just want to disable the gift card for further usage, you can set the status to STATUS_USED_FINAL, which is number 3. However, you should always refer to the status with:
CoreCommercePaymentCoupon::STATUS_USED_FINAL;


so that if the number changes because of some further development, your external module will not be affected by that.

Did this answer your question or did I miss something?
Mainio replied on at Permalink Reply
Mainio
By the way just looking at the code, you should probably use this function:
$coupon = CoreCommercePaymentCoupon::getByID(123);
$coupon->setUsedFinal();


Because that also makes sure the verification hash is invalid for further usage (makes it more secure).
ErikLeeOlson replied on at Permalink Reply
ErikLeeOlson
Awesome, thank you! C5 rocks!

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.