diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-02-17 04:28:38 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-02-17 04:30:23 +0100 |
commit | 632e8a36eec408935e965c528196e28bff1f394a (patch) | |
tree | 4f518468901743246ea40ebd65263b08f8e9ff1e /example-essay-store.rst | |
parent | b909ded00c717c575b8110a689e7b7d2e1d582ac (diff) | |
download | docs-632e8a36eec408935e965c528196e28bff1f394a.tar.gz docs-632e8a36eec408935e965c528196e28bff1f394a.tar.bz2 docs-632e8a36eec408935e965c528196e28bff1f394a.zip |
rough essay store description
Diffstat (limited to 'example-essay-store.rst')
-rw-r--r-- | example-essay-store.rst | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/example-essay-store.rst b/example-essay-store.rst new file mode 100644 index 00000000..4b1eeeae --- /dev/null +++ b/example-essay-store.rst @@ -0,0 +1,40 @@ +================================== +Example: Essay Store +================================== + +The main page of the essay store shows links to essays of the form `/essay?name=:essayname`. + +The `/essay` URL takes the following query parameters: + * `name`: mandatory, name of the essay + * `tid`: optional, transaction ID generated by the merchant for the + contract that was used to purchase an instance of the article + +These are the steps for showing `/essay`. Note that checks for wallet presence are omitted, +it the wallet is not present in steps 2 and 3, the user agent should be redirected +to a mock credit card payment page. + +1. The server checks the status of the the essay with the name `name` in the server-side + session state + + * If the essay is marked as payed for the client, display the essay. + * Otherwise proceed with step 2 + +2. The server checks if the `tid` parameter is present + + * If `tid` is present, restore the contract to pay for the essay and + emit the `taler-execute-contract` DOM event in the user agent. + * Otherwise proceed with step 3 + +3. The server generates a new contract and emits the `taler-confirm-contract` DOM event in the user agent, + with the essay name as repurchase correlation identifier and `/essay?name=:name?tid=:tid` as fulfillment url. + + +In step 2, the `taler-execute-contract` event has the following parameters: + +* `H_contract`: hash of the contract that was restored +* `payment_url`: The internal URL `/pay?H_contract=...` of the essay store, will set the server-side session state + for the article associated with the contract hash on successful coin deposit +* `offer_url`: Link to a teaser page (`/teaser?name=...`), which also contains a link to the article + page, without the `tid` parameter. + + |