diff options
author | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-12-15 22:35:55 +0100 |
---|---|---|
committer | Marcello Stanisci <marcello.stanisci@inria.fr> | 2016-12-15 22:35:55 +0100 |
commit | 814c7c5d6aaffd25b6fd54c34d1fd10fd23a1ab4 (patch) | |
tree | 3a177188a9d12247203dfa488d6c8c71c2a0fccf | |
parent | a54d7e20309042ddd7c247cb4c2f0255bb1b3baa (diff) | |
download | docs-814c7c5d6aaffd25b6fd54c34d1fd10fd23a1ab4.tar.gz docs-814c7c5d6aaffd25b6fd54c34d1fd10fd23a1ab4.tar.bz2 docs-814c7c5d6aaffd25b6fd54c34d1fd10fd23a1ab4.zip |
10% blog example fulfillment
-rw-r--r-- | example-essay-store.rst | 32 |
1 files 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: |