Cannot manually expire a coupon redemption on an account
Closed this issue · 1 comments
priitlatt commented
Documentation suggests that it is possible to expire single coupon redemption at a time. However, this raises a NotFoundError
, with the following stack trace:
File "/usr/local/lib/python2.7/dist-packages/recurly/resource.py", line 673, in delete
self.raise_http_error(response)
File "/usr/local/lib/python2.7/dist-packages/recurly/resource.py", line 685, in raise_http_error
raise exc_class(response_xml)
NotFoundError: No route matches [DELETE] "/v2/accounts/{{replaced account code}}/redemptions/{{replaced redemption uuid}}s/{{replaced redemption uuid}}"
Correct url for expiring the coupon redemption seems to be
https://:subdomain.recurly.com/v2/accounts/:account_code/redemptions/:uuid
This is according to above mentioned documentation and by trying it out by monkey patching the delete_url
method on Redemption
class.
Current implementation of delete_url()
is as follows:
def delete_url(self):
return self._url + "s/" + self.uuid
But the redemption._url
(returned by api) is already in the form
https://your-subdomain.recurly.com/v2/accounts/:account_id/redemptions/:redemption_uuid
and thus concatenating the "s/"
and uuid
once more breaks it.