On 17/11/2010, at 8:08 AM, Russell Gray wrote:
> I am also trying to implement support for MUPromo, did these enhancements ever get shared anywhere publicly?
Sorry, that's totally my bad. I keep meaning to clean up my changes to PotionStore and open pull requests, but I never allocate the time to it.
http://cl.ly/1j3h0G1t391p271g2I0e
That's a link to my promo_controller.rb (put it in app/controllers/store) - you'll need to add a randomly generated string (just md5 some private file on your hard disk and use that) into your store.yml under the key 'promo_salt'. Hopefully you know a bit of Rails and this can get you up and running - I don't see myself getting to that cleanup anytime shortly. I used this when Hyperspaces was part of MUPromo's bundle earlier this year - I ran it up on Heroku with 2 dynos on a Shared database plan while the promo was active without any load issues.
Feel free to ask any questions on list – hopefully if anyone else has the same problem in future, they will find this conversation and it can help them get started (at least until someone rolls this into the main app).
thanks,
Tony
----------
Tony Arnold
http://thecocoabots.com/
to be honest, I have no idea where to start....
Ruby/Rails and http POST requests are all foreign to me. (geez, writing apps is the easy part)
What else do I need to do, to get this working?
I'm guessing I need to set up some kind of listener for the POST requests.
Russell
SweetP Productions
www.sweetpproductions.com
> --
> You received this message because you are subscribed to the Google Groups "Potion Store Discussions" group.
> To post to this group, send email to potion...@googlegroups.com.
> To unsubscribe from this group, send email to potion-store...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/potion-store?hl=en.
>
On 17/11/2010, at 20:43 PM, Russell Gray wrote:
> to be honest, I have no idea where to start....
> Ruby/Rails and http POST requests are all foreign to me. (geez, writing apps is the easy part)
>
> What else do I need to do, to get this working?
> I'm guessing I need to set up some kind of listener for the POST requests.
No, it's just a Rails controller so no listener required - if you pop the file into your development potion store install at:
app/controllers/store/
and add a random string to store.yml for the 'promo_salt' key - something like:
promo_salt: "60790980e253aca748e1dc98fea1af7d"
(don't use that exact string - make something else up)
Then restart your development rails environment, you should be set. Here's what I sent to MacUpdate a few months ago about how to interact with this controller:
The URL will be: http://YOURHOST/store/promo/newserial
Form Parameters
===============
You will need to pass the following form parameters. I prefer that MacUpdate POST rather than GET, but it should make no difference. All parameters are required.
* salt: This must be whatever you entered into the 'promo_salt' key (without the quotes). It is the magic key, and without it the controller will not respond. Please do not share this key with anyone - if someone gets it, they can generate as many licenses for your apps as they please;
* source: This should be 'MacUpdate' - (or MacUpdate Bundle, or something that you can use later to identify these users as having come from your promotion;
* transaction_id: This is a unique code that I will store in my database - I'm use it for the PayPal transaction ID, but anything is OK so long as it is unique. I use this so that if the request is fired twice from MacUpdate, the user will get the same serial number/order each time (and I'm not creating duplicates);
* product_id: This should be your product's PotionStore code (without the quotes);
* email: The user's (valid) email address.
* firstname: The user's first name.
* lastname: The user's last name.
So the end result will be something like:
Responses
=========
If the details are accepted, you'll get a license key as a plain text response - the status code will be "201" (created) if it's a brand new order, and "200" (OK) if the order already exists.
If anything goes wrong, or the details are invalid, you will get an empty response and either a HTTP status code of "404" (content not found) or "400" (bad request).
The guys at MacUpdate have worked with this setup before with me, so they should be able to set things up to test from their end pretty easily.
I hope this helps.
thanks for all your help, and time. i'll update my site, and run a couple of tests, to check if it works out.
Russell
SweetP Productions
www.sweetpproductions.com
have I missed something?
Russell
SweetP Productions
www.sweetpproductions.com
On 17/11/2010, at 9:03 PM, Tony Arnold wrote:
On 17/11/2010, at 22:38 PM, Russell Gray wrote:
> Iv'e tried it out, and I get the following message:
> ActionController::RoutingError (No route matches "/promo/newserial" with {:method=>:get}):
>
> have I missed something?
You should use /store/promo/newserial, not /promo/newserial.
I had to use:
http://sweetpproductions.com/store/store/promo/newserial?salt=...........
I am using a modified version of potionStore to run from a directory, rather than a subdomain.
Thanks again for all your help Tony.
Russell
SweetP Productions
www.sweetpproductions.com