diff --git a/docs/source/interface.rst b/docs/source/interface.rst index e48f900634ab6bb7d78bf6c48794aab4d4b020fc..74881dc4933192477b16e4a471603b69d27312db 100644 --- a/docs/source/interface.rst +++ b/docs/source/interface.rst @@ -10,41 +10,41 @@ SecureAccessTokenAuthorizer publishes an HTTP-based interface inside the main Ta ``PUT /storage-plugins/privatestorageio-satauthz-v1/payment-reference-number`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This endpoint allows an external agent which has submitted a payment to cause the plugin to redeem the payment reference for tokens. +This endpoint allows an external agent which has submitted a payment to cause the plugin to redeem the voucher for tokens. The request body for this endpoint must have the ``application/json`` content-type. -The request body contains a simple json object containing the payment reference number:: +The request body contains a simple json object containing the voucher:: - {"payment-reference-number": "<payment reference number>"} + {"payment-reference-number": "<voucher>"} -The endpoint responds to such a request with an **OK** HTTP response code if the payment reference number is accepted for processing. -If the payment reference number cannot be accepted at the time of the request then the response code will be anything other than **OK**. +The endpoint responds to such a request with an **OK** HTTP response code if the voucher is accepted for processing. +If the voucher cannot be accepted at the time of the request then the response code will be anything other than **OK**. If the response is **OK** then a repeated request with the same body will have no effect. If the response is not **OK** then a repeated request with the same body will try to accept the number again. -``GET /storage-plugins/privatestorageio-satauthz-v1/payment-reference-number/<payment reference number>`` +``GET /storage-plugins/privatestorageio-satauthz-v1/payment-reference-number/<voucher>`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This endpoint allows an external agent to monitor the status of the redemption of a payment reference number. +This endpoint allows an external agent to monitor the status of the redemption of a voucher. This endpoint accepts no request body. -If the payment reference number is not known then the response is **NOT FOUND**. -For any payment reference number which has previously been submitted, +If the voucher is not known then the response is **NOT FOUND**. +For any voucher which has previously been submitted, the response is **OK** with an ``application/json`` content-type response body like:: {"value": <string>} -The ``value`` property merely indicates the payment reference number which was requested. +The ``value`` property merely indicates the voucher which was requested. Further properties will be added to this response in the near future. ``GET /storage-plugins/privatestorageio-satauthz-v1/payment-reference-number`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -This endpoint allows an external agent to retrieve the status of all payment reference numbers. +This endpoint allows an external agent to retrieve the status of all vouchers. This endpoint accepts no request body. The response is **OK** with ``application/json`` content-type response body like:: - {"payment-reference-numbers": [<payment reference status object>, ...]} + {"payment-reference-numbers": [<voucher status object>, ...]} The elements of the list are objects like the one returned by issuing a **GET** to a child of this collection resource. diff --git a/src/_secureaccesstokenauthorizer/resource.py b/src/_secureaccesstokenauthorizer/resource.py index f1e59d8e9f4752ccb7b31c8653570dc50d18d347..8a9c2154fe6212e3963b8a085010ce7268f1f058 100644 --- a/src/_secureaccesstokenauthorizer/resource.py +++ b/src/_secureaccesstokenauthorizer/resource.py @@ -79,11 +79,10 @@ def from_configuration(node_config, store=None): class _PaymentReferenceNumberCollection(Resource): """ - This class implements redemption of payment reference numbers. Users - **PUT** such numbers to this resource which delegates redemption - responsibilities to the redemption controller. Child resources of this - resource can also be retrieved to monitor the status of previously - submitted vouchers. + This class implements redemption of vouchers. Users **PUT** such numbers + to this resource which delegates redemption responsibilities to the + redemption controller. Child resources of this resource can also be + retrieved to monitor the status of previously submitted vouchers. """ def __init__(self, store, controller): self._store = store @@ -136,7 +135,7 @@ def is_syntactic_prn(prn): :param prn: A candidate object to inspect. :return bool: ``True`` if and only if ``prn`` is a unicode string - containing a syntactically valid payment reference number. This says + containing a syntactically valid voucher. This says **nothing** about the validity of the represented voucher itself. A ``True`` result only means the unicode string can be **interpreted** as a voucher. diff --git a/src/_secureaccesstokenauthorizer/tests/strategies.py b/src/_secureaccesstokenauthorizer/tests/strategies.py index 4af061defb0f2d34a3912078e55dfd76e580d205..ad9b2a47d905d32d682e3300f2268819485b18d3 100644 --- a/src/_secureaccesstokenauthorizer/tests/strategies.py +++ b/src/_secureaccesstokenauthorizer/tests/strategies.py @@ -163,7 +163,7 @@ def client_configurations(): def payment_reference_numbers(): """ - Build unicode strings in the format of payment reference numbers. + Build unicode strings in the format of vouchers. """ return binary( min_size=32, diff --git a/src/_secureaccesstokenauthorizer/tests/test_client_resource.py b/src/_secureaccesstokenauthorizer/tests/test_client_resource.py index 176d6ce0a09625d06dcfa46ce1db37a9d1d92041..6eb2f7227b2bac8bf3654e41533e584788d24127 100644 --- a/src/_secureaccesstokenauthorizer/tests/test_client_resource.py +++ b/src/_secureaccesstokenauthorizer/tests/test_client_resource.py @@ -138,7 +138,7 @@ def is_not_json(bytestring): def not_payment_reference_numbers(): """ - Builds unicode strings which are not legal payment reference numbers. + Builds unicode strings which are not legal vouchers. """ return one_of( text().filter( @@ -210,7 +210,7 @@ class PaymentReferenceNumberTests(TestCase): """ Tests relating to ``/payment-reference-number`` as implemented by the ``_secureaccesstokenauthorizer.resource`` module and its handling of - payment reference numbers. + vouchers. """ def setUp(self): super(PaymentReferenceNumberTests, self).setUp() @@ -406,7 +406,7 @@ class PaymentReferenceNumberTests(TestCase): def test_list_prns(self, get_config, prns): """ A ``GET`` to the ``PaymentReferenceNumberCollection`` itself returns a - list of existing payment reference numbers. + list of existing vouchers. """ # Hypothesis causes our test case instances to be re-used many times # between setUp and tearDown. Avoid re-using the same temporary diff --git a/src/_secureaccesstokenauthorizer/tests/test_model.py b/src/_secureaccesstokenauthorizer/tests/test_model.py index 3ef54d46d16e960fc2728f2abf46309bf1c49fc9..052f5e6fd5f0e2341ba6a28d2eefcbe9d3747b44 100644 --- a/src/_secureaccesstokenauthorizer/tests/test_model.py +++ b/src/_secureaccesstokenauthorizer/tests/test_model.py @@ -91,7 +91,7 @@ class PaymentReferenceStoreTests(TestCase): def test_get_missing(self, get_config, prn): """ ``PaymentReferenceStore.get`` raises ``KeyError`` when called with a - payment reference number not previously added to the store. + voucher not previously added to the store. """ tempdir = self.useFixture(TempDir()) config = get_config(tempdir.join(b"node"), b"tub.port") @@ -153,8 +153,7 @@ class PaymentReferenceStoreTests(TestCase): def test_list(self, get_config, prns): """ ``PaymentReferenceStore.list`` returns a ``list`` containing a - ``PaymentReference`` object for each payment reference number - previously added. + ``PaymentReference`` object for each voucher previously added. """ tempdir = self.useFixture(TempDir()) nodedir = tempdir.join(b"node")