Description
When we create a WorkPeriodPayment record using POST /work-period-payments
for the payment purpose we are creating a challenge here, which was implemented in this challenge.
Creating challenge payment has next steps:
- create a challenge
- add resource (member) to the challenge
- activate challenge
- close challenge
We have to update the last step "close challenge". Apart from setting { status: 'Completed' }
it also has to set winners
array like this:
{
"status": "Completed",
"winners": [
{
"userId": 88773930,
"handle": "jcori30",
"placement": 1
}
]
}
Where:
placement
is always1
handle
is the same handle which we add as a resource on step 2, it comes from the Work PerioduserHandle
userId
is numeric user from V3. Note, that in TaaS API we usually use UUID V5 user ids which are not compatible with V3 user ids.
To get V3 userId
we can use endpoint GET /v3/members/{handle}
:
So we can implement a new helper method for this like getV3MemberDetailsByHandle
. Please, don't use existent getMemberDetailsByHandles
method, as it has some issues for some users. We are still using it when we have to get multiple users at once, but in this case we need to get only one user, and endpoint GET /v3/members/{handle}
should be more reliable.