shotvibe / shotvibe-web

ShotVibe REST API webservice
1 stars 0 forks source link

Complete integration of event link with app registration process #106

Open benny-shotvibe opened 10 years ago

benny-shotvibe commented 10 years ago

The way the app_init was modified in https://github.com/shotvibe/shotvibe-web/commit/d6db4d494cbb2f104494f004ec2fa47866bc51a4 is the right way to do things, but in order to save some work in the apps it needs to be slightly modified.

The apps have already been modified to process a "custom_payload" query parameter in the custom shotvibe scheme url. The app will pass the value of this parameter to ConfirmSMSCode (when the user completes registration).

You can see the complete flow of how it works here: https://github.com/shotvibe/shotvibe-web/commit/29f21c0dcec7df9f54ca7b7da8e895d94c8ddb7f

So inside the ConfirmSMSCode view, when a "custom_payload" value comes in that matches an active event then the webapp should:

  1. Credit the affiliate with a new install and update other relevant statistics
  2. Add the new user to the relevant album.

What should the format of the "custom_payload" value be? I can think of 2 possibilities:

  1. Similar to the way you currently do it, and similar to the way I did it in the example above: Simply the ID of the event (maybe prefixed with "event:", such as "event:1234", so that in the future we can use the system for more than just events if necessary)
  2. Use a unique random identifier for each user (the webapp will need to generate a new identifier each time the event link is clicked, and create an association for it in the DB with the event).

Option 2 is a bit more complicated but has some advantages:

You should also be able to make a unit test that tests the complete cycle.

benny-shotvibe commented 10 years ago

For the unit test you need to simulate the app install process:

  1. Use a django test client to visit the event link, making sure it is configured to save cookies.
  2. Visit the "app_init" url with some test values identifying as a phone
  3. Parse the returned location header and extract the "custom_payload" value
  4. Create a new django test client to be used to simulate the app (to make sure that ni cookies carry over)
  5. Call the API urls to simulate a registration (Use a test number such as +1212718xxxx with code 6666)
  6. Verify that the newly created user is a member of the event album
sirpengi commented 10 years ago

I have this done in branch affiliates-appregistration-integration. It was a separate branch because I wanted to also have the changes from the dolev-event-2014-01-24 branch (thus, this branch is this new feature built on top of the affiliates branch with dolev-event-2014-01-24 merged in).