To all the coding ninjas,
Here is a bit of a challenge. I’m having trouble with figuring out how to approach this. This is what I’ve got so far in terms of planning it out.
Ok so Ive got 3 Tables, A, B and C.
Table A:
Contains a newly registered user’s info, like name, email, mobile number and a unique user id.
Table B:
*Contains a range of unique codes, eg GHBDGH
*As well as a merchant ID. eg 1 (So as to make the code only valid when used for that merchant.)
*True/False column for marking the code as being assigned to a user or not.
Table C:
Is the table where info is put together. Here the unique code from table B is ‘linked’ to a registered users’ account from Table A. Table B is then also updated to indicate that the code has been assigned to a user and therefore cannot be assigned again.
*This table also contains a Column that indicates if a coupon is either ‘redeemed’, ‘expired’ or ‘valid’.
So what needs to happen is when a person creates a new account their data is captured to Table A. After which if they complete an order their info in Table A is combined with Table B to create Table C. Their unique assigned code will then be displayed to them onscreen or via sms.
Later a merchant will receive this code from the user and verify it by checking Table C, after which Table C will process the necessary tasks to either show the code as ‘redeemed’, ‘expired’ or ‘valid’ and update the Table accordingly.
I would really appreciate it if someone could help me with this, and my apologise if this is not clear enough. Please feel free to ask me if anything is unclear. I am also open to any suggestions on how this can be accomplished more effectively.
Looking forward to your help. Thanks in advance ;D