Add a new /preregistration/claimbeta/:account?signature=<signature> (PUT) endpoint to enter the beta program.
Validations should be returning using 4xx error and a json document:
{
"error": "<specific error>"
}
Validations:
Account in invalid format (regex): 406
Account not found in the preregistration collection AND in the account collection (it needs to be in both): 404
Signature not sent: 406
Signature not base64: 406
Unencoded signature not json format: 406
Validation fails (using concordium-sdk): 403
Preregistration document has a non-empty share2earn: 406
Preregistration document has a beta field with value true: 406
Important:
After signature verification (using concordium-sdk) the nonce needs to be cleared in the account document to invalidate it (if validation passes or fails).
Procedure:
If all validations pass, update the preregistration document belonging to the account and:
Add a beta field with value true.
Add a share2earn link generating a random 16-byte code (alphanumeric). Making sure that this value does not exist in another preregistration document.
If the preregistration document has a non-empty refShare2Earn field (sent during #2), increase the referred field n the preregistration document of the owner of the refShare2Earn (using the share2earn field for searching) in 1. In other words: the account who referred this account getting to this point, will add 1 referred to its count (if the field does not exist in that account, create it with 1).
I need to clear "Add a new dateShare2Earn when this is completed (with new Date())". new Date() for account who referred or current account or both? @jatitoam
Add a new
/preregistration/claimbeta/:account?signature=<signature>
(PUT) endpoint to enter the beta program.Validations should be returning using 4xx error and a json document:
Validations:
preregistration
collection AND in theaccount
collection (it needs to be in both): 404share2earn
: 406beta
field with valuetrue
: 406Important:
After signature verification (using concordium-sdk) the nonce needs to be cleared in the
account
document to invalidate it (if validation passes or fails).Procedure:
If all validations pass, update the
preregistration
document belonging to theaccount
and:beta
field with valuetrue
.share2earn
link generating a random 16-byte code (alphanumeric). Making sure that this value does not exist in anotherpreregistration
document.preregistration
document has a non-emptyrefShare2Earn
field (sent during #2), increase thereferred
field n thepreregistration
document of the owner of therefShare2Earn
(using theshare2earn
field for searching) in 1. In other words: the account who referred this account getting to this point, will add 1 referred to its count (if the field does not exist in that account, create it with 1).If any of these steps fail, send a 500 http code.
If everything succeeds, return a 201 http code: