Feat/add partner endpoint to check sponsor
CHANGELOG:
### Added
- [#791](https://gitlab.com/coopdevs/odoo-somconnexio/-/merge_requests/791) Add endpoint to check if partner can sponsor new partners.
Related card: https://trello.com/c/TEINDO5H/1236-api-apadrinamiento-ver-si-socio-puede-apadrinar
This MR adds an endpoint to check if a member can sponsor new partners. Only can sponsor if it is member and has less sponsored partners than the max defined in the company (5 as default).
Curl example to check the endpoint:
- Not allowed to sponsor new partners:
➜ curl -X GET \
➜ -H "accept: application/json" \
➜ -H "api-key: $APIKEY" \
➜ "$URL/api/partner/check_sponsor?vat=$VAT&sponsor_code=$SPONSOR_CODE" | jq
{
"result": "not_allowed",
"message": "maximum number of sponsees exceeded"
}
- Allowed to sponsor new partners:
➜ curl -X GET \
➜ -H "accept: application/json" \
➜ -H "api-key: $APIKEY" \
➜ "$URL/api/partner/check_sponsor?vat=$VAT&sponsor_code=$SPONSOR_CODE" | jq
{
"result": "allowed",
"message": "ok"
}
Edited by Pelayo García