Closed w00kie closed 2 years ago
Calling the pay endpoint with curl:
curl --request POST \
> --url https://saas-django.w00kie.com/pay \
> --header 'Authorization: Bearer 495fcacabf97206183c7ccc1787900fe687521ef' \
> --header 'Content-Type: application/json' \
> --data '{
> "destination" :"MABY3C7LM4NTZJFEMUX374JNFBJC3JI3U7HOATRZRD2AANGYBR7Z2AAAAAAAAAAAAPB4M",
> "amount" : "10.0000001"
> }'
gives this error: curl: (92) HTTP/2 stream 0 was not closed cleanly: PROTOCOL_ERROR (err 1)
Same thing happens with the register endpoint.
Making a request with Java, gives this error: unexpected content length header with 204 response
.
The response seems to go against the Http spec : https://github.com/OasisLMF/OasisPlatform/issues/67
Yeah, I was returning a message when 204s should have no content at all. Fixed now.
I also fixed a race condition when you pay yourself.
Everything seems to work. I think you can mark it as completed unless you want someone else to review.
Though, I am curious how you made it so multiple people can pay at the same time. I didn't see anywhere where that was handled and yet it worked fine.
Yeah, after reading the review on other proposals I realized there was gonna be an issue here. But the beauty of being stingy with memory on my production server is that I set it up the service with just a single gunicorn runner, so nginx makes you wait in line for payment automatically 😁
Now if I had to do it in production, I'd probably decrease the user's balance on the spot, store pending payments in the DB setup a quick celery worker that runs every 10s and grabs up to 100 payments to batch in a single tx.
Works flawlessly for the tests I put it through. Well done. Can you add your Stellar address you want the award sent to as a PR to this file? https://github.com/tyvdh/stellar-quest-bounties/blob/main/ADDRESSES.yml Thanks!
Sorry, forgot to add my address. The PR is open now.
3d5b69601e46683a86a311ae3e715e180f1c7258d8ca0d326d1e8d8e920feab3
Link the bounty file
https://github.com/tyvdh/stellar-quest-bounties/blob/main/bounties/level-2/stellar-accounts-as-a-service.md
Mark your progress
Provide relevant details
Did a python implementation with Django and Django REST Framework.
Repo: https://github.com/w00kie/saas-bounty-django
Live on: https://saas-django.w00kie.com/