From 814c7c5d6aaffd25b6fd54c34d1fd10fd23a1ab4 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Thu, 15 Dec 2016 22:35:55 +0100 Subject: 10% blog example fulfillment --- example-essay-store.rst | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/example-essay-store.rst b/example-essay-store.rst index bd3514a7..51cf5c1b 100644 --- a/example-essay-store.rst +++ b/example-essay-store.rst @@ -222,12 +222,40 @@ is required to create the proposition. Both ``make_contract`` and ``sign_contract`` are defined in ``talerfrontends/blog/helpers.py``. +At this point, the user can accept the contract, which triggers the wallet +to visit the fulfillment page. The main logic for a fulfillment page handler +is to (1) return the claimed product, if it has been paid, or (2) instruct the +wallet to send the payment. + +.. + - TODO Document fulfillment URL layout. + - Mention handler function's name. + - Mention filename where the handler is located. + - Say 'somehow' that this handler is the same from + the offer URL. + +The state accounts for a product being paid or not, so the fulfillment handler +will firstly check that: + +.. sourcecode:: python + + +def article(name, data=None): + # Get list of payed articles from the state + payed_articles = session.get("payed_articles", []) + + if name in payed_articles: + ... + return send_file(get_article_file(article)) + + + + + .. Fundamental steps: - - How 402 HTTP headers are set in each step. - - How OTOH JavaScript accomplishes the same. - How the handler detects offer vs fulfillment. To mention: -- cgit v1.2.3