Product Key's / Voucher Codes.

Right, it's been 5 years of passive evolvement in drupal for me now, where I've been using it. Not its about time to get dirty.

There is a project im working on that has been implemented in D6 with UberCart and hey I want to move it to D7 and that road map has now opened. There are some missing pieces to the puzzle, getting it there and they are here is DC.

So what we need are the following features that to my knowledge are missing. Product keys / Voucher code assignment after a product has been purchased. Stock tracing, still scratching my head as to why this is not a core thing but I see there is an attempt at getting something out the door right now. But looks like its not going to be the 'supported approach by the community' . Paypal module is lacking some love right now as a payment option at the bare minimum.

So looking at that I have the following options, its a given that I will need to write a product key / voucher issuing module. The Ubercart module has no plans to move that to DC. Next the stock management issue, it is an option to manage the stock levels via the amount of voucher codes / product keys.... or do I wait for something to start as an official project here and leave that for later.. right now my thinking is that I use the amount of vouchers available simply enabling / disabling the check out button or out of stock message and at a later stage remove that and merge with the community supported stock module.

Then the payment via paypal at very least is a requirement, depending on the state of that once ive completed the above, I may need to write another module here and pick one of our local payment gatways... I'm x-ing fingers that the paypal module will be ready by then.

So now where to from here, I've got my git account going, I need to go over the drupal code standards docs and I know we have some here now.. don't know if / where its document though.

I would how ever like some feedback on the 'road map' I have out lined for my self here. I'm sure the module I would be able to put together would not be a best of class. But if guided a little it would at least boot strap the real deal down the line.

So my question to the community here is what do I need to start looking at when undertaking such a task that can give a little back. I am assuming the following for a voucher code / product key module.

1. Would use rules to manage the action of assigning / removing keys from users after payment completed or specified status.
2. How would I include the voucher code as part of the invoice? Assume this sort of scenario has been tough of and there are ideas / best practices to follow?
3. I can get some help on IRC im sure but would like a little 'document' road map of sorts here just to help guide me.
4. I'm not sure what the full process of modules and how they get approved are on drupal... with the new git move. I think keeping it off an official project page is best until it has reached some maturity.. and others are interested in it.. Is there a place for keeping 'sandbox' modules? Dose drupals new git repo's provide a listing for maybe projects or is it best to put it on github and mange it here... not to sure so would like some feed back here as well.

KK, enough questions for now I have some reading to do and im sure what responses come from this will guide me.


Posted: Mar 22, 2011


Ryan Ryan Szrama on March 23, 2011

Glad you're getting ready to dive in and contribute back. We'll try to be helpful, though I fear the current state of the documentation may be a little frustrating. As I mentioned in IRC, we definitely need to get the API module running on here...

Focusing on your license key integration is going to be the best starting point, as other folks are working on Stock issues at the same time. However, as you pointed out, your stock isn't necessarily tied to a random inventory number but to an actual list of available license keys. In that regard, providing your own integration to disable the add to cart button when a product is "sold out" might make the most sense.

I'm curious to know what you need out of PayPal. Right now I have it performing WPS transactions, and I'm working on IPN support this evening. It's always a bit of a pain b/c my normal development workflow is all local, but I'm testing w/ PayPal on the demo site for now. Perhaps we can simply combine our efforts if there's some specific support you need beyond WPS (i.e. WPP, EC, or something else).

jucallme on March 23, 2011

With regards to paypal,
We would defiantly need more mature module than what's there.. Once ive got a better hand on the API and better understanding of the cupeling going I'll at least get testing and helping with bugs there.. The module is in a very early dev so I have not moved that into my environment yet.. Heck that sandbox nightmare they got going on, at paypal. I need a few days fresh air before I hit that mess again. My comments we from the point of view on issues, number of releases etc around it. Know you probaly know it backwards for ubercart.. So fleshing it out should not take yonks.

So I spent yesterday evening fleshing out a basic starting point for me right now. Just kind if confused right now what is the correct entity to be attaching my product key to. You have not got that basic entity diagram you had at drupalcon-chic?

I was thinking along these lines.
- I need to have a product key list in db.
- I need to have the ability to add/remove/update items
- I need bulk upload / remove on them
- I need to attach I am thinking an order entity to my product key.
- that would mean a selector on the product entities or flag easy enough
- then I need to allow when that key is attached to the order when rules would fire it's actions more some setting for the module. Not sure what the standards are here is it programaticlly creating a default rule or better to go setting in the module?
- then it's a rule event I need to add to fire additional actions say an email with key if that's needed.
- also some sort of revoke I assume would be good we don't need it but other may.

That I think is covering most cases and ours.

But there are some bigger questions I have from an architecture side.

Should I be creating an entity? What dose that allow, or what corner dose it put me in.. It's fieldable and all that goodness like a node so my thinking is it's the better route to go.. Could do some neet stuff with all that extra goodness.. Or is it just too much? Im not the right person to make that sorta call right now I have a few years of java skills and get the whole omg entities blurb.. But I don't know what kind of underlying implications it has or might not have in drupal.. So I'm looking to yeah for some guidance.

Thanks for the comment it's just that that made ubercart.. And why so many people are just jumping two feet in with DC. You all have done some really good work around abstracting this behemoth and the possibilities I see are just making me smile!