commit 1ac3df84a96a7f9ce46b9d8754488e02571afb03
parent 18cb0f93942df6f375c5a1b7418dffcbc208fe0a
Author: Florian Dold <florian@dold.me>
Date: Wed, 9 Jul 2025 02:00:33 +0200
sync DD64
Diffstat:
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/design-documents/064-kyc-operation-algo.rst b/design-documents/064-kyc-operation-algo.rst
@@ -47,16 +47,18 @@ Initialize the following variables:
* ``last_rule_gen := null``
* ``last_aml_review := null``
-* ``last_op_deny := if isZeroLimited(op, amt) then now() else null``
+* ``last_deny := if isZeroLimited(op, amt) then now() else null``
* ``account_keypair := getCurrentAccountKeyPair(op)``
Processing
^^^^^^^^^^
-1. If ``last_op_deny`` is ``null`` or more than ``1h`` ago,
+1. If ``last_deny`` is ``null`` or more than ``1h`` ago,
make a request for ``op`` at the exchange. Let ``resp`` be the response.
* If the request succeeds, *halt*.
+ * If the request fails with ``451``, set ``last_deny := now()``.
+ * Otherwise, finish processing operation with result ``BACKOFF``.
2. Request the ``/kyc-check/...`` endpoint applicable for ``op`` with ``account_keypair`` the following parameters:
@@ -72,9 +74,9 @@ Processing
* Set ``same_resp := resp.status == last_check_status and resp.code == last_check_status and resp.rule_gen == last_rule_gen``.
* Set ``last_check_status := resp.status``, ``last_check_code := resp.code``, ``last_rule_gen := resp.rule_gen``
* If ``same_resp == true``: finish processing operation with result ``BACKOFF``.
- * If ``resp.status == 204 No Content``: Set ``last_op_deny := null``. Finish processing operation with result ``PROGRESS`` (effectively
+ * If ``resp.status == 204 No Content``: Set ``last_deny := null``. Finish processing operation with result ``PROGRESS`` (effectively
re-trying at step 1).
- * If ``resp.status == 200 Ok``: Set ``last_op_deny := null``. Go to step 4.
+ * If ``resp.status == 200 Ok``: Set ``last_deny := null``. Finish with result ``PROGRESS``
* If ``resp.status == 202 Accepted``: Go to step 4.
* If ``resp.status == 403 Forbidden``: Check if the private key for the
indicated public key is available. If, set ``account_keypair`` to that key pair and finish with result ``PROGRESS``.
@@ -84,13 +86,13 @@ Processing
4. Handle exposed limits applicable to the account:
- * If the exposed limits do not deny ``op``, finish processing operation with result ``PROGRESS``.
- * Otherwise (the exposed limits do deny ``op``), transition the transaction
+ * If the exposed limits do not deny ``op``, set ``last_deny := null`` and finish processing operation with result ``PROGRESS``.
+ * If the exposed limits deny ``op`` as ``verboten``, set ``last_deny := now()`` and transition the transaction
to a ``failed`` state (Showing an error message
indicating that the operation is forbidden due to legal
restrictions on the payment service provider). Finish processing operation with result ``PROGRESS``.
- * If merely a threshold over some timeframe is currently
- violated, compute the time ``t`` when the operation may be allowed again.
+ * Otherwise (merely a threshold over some timeframe is currently
+ violated), compute the time ``t`` when the operation may be allowed again.
Finish processing operation with result ``AGAIN_AT(t)``.