merchant-frontend-examples

ZZZ: Inactive/Deprecated
Log | Files | Refs

commit d2bf2ef05d42bf02422890e6f0a247c2e5303b79
parent 0c1cbb01ac68db5ade56abc73cf6a2a1a643288a
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Mon,  5 Dec 2016 22:59:41 +0100

99% of #4826

Diffstat:
Mphp/doc/tutorial.texi | 43++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)

diff --git a/php/doc/tutorial.texi b/php/doc/tutorial.texi @@ -213,12 +213,13 @@ The given backend code uses a few helper functions from @code{php/helpers.php}, which should be self-explanatory. +@node Prompting for payment @section Prompting for payment @cindex button Our goal is to trigger a Taler payment once the customer has clicked on a donation button. We will use a button that issues an HTTP GET -to the frontend @code{/donate} URL. For this, the HTML would be as +to the frontend @code{/donate.php} URL. For this, the HTML would be as follows: @smallexample @@ -226,7 +227,7 @@ follows: @verbatiminclude ../index.html @end smallexample -When the server-side handler for @code{/donate} receives the form submission, +When the server-side handler for @code{/donate.php} receives the form submission, it will return a HTML page that will take care of: @itemize @@ -310,6 +311,7 @@ see @code{http://api.taler.net/api-common.html#errordetail}: @end smallexample +@node Initiating the payment process @section Initiating the payment process @cindex fulfillment URL @@ -567,7 +569,10 @@ without using JavaScript: <html lang="en" data-taler-nojs="true"> <head> <title>Tutorial</title> - <link rel="stylesheet" type="text/css" href="/web-common/taler-fallback.css" id="taler-presence-stylesheet" /> + <link rel="stylesheet" + type="text/css" + href="/web-common/taler-fallback.css" + id="taler-presence-stylesheet" /> </head> <body> <p class="taler-installed-hide"> @@ -743,7 +748,7 @@ directly via the fulfillment URI, there is no delivery location. @item repurchase_correlation_id @cindex repurchase correlation ID -@c FIXME: explain!!! +FIXME: explain!!! @item merchant @table @var @@ -799,21 +804,33 @@ that they do not understand as a key-value list. @cindex optimization @cindex contract -In the example in section FIXME, we told the wallet the URL from where -it should fetch the contract. Instead of specifying the contract via -an URL, it is also possible to inline short contracts directly. +In the example in @ref{Prompting for payment}, we told the wallet the URL +from where it should fetch the contract. Instead of specifying the contract +via an URL, it is also possible to inline short contracts directly. -FIXME: explain how. +That may be accomplished by the frontend including the @code{X-Taler-Contract} +HTTP header, whenever the requested page is meant to trigger a payment. +The example shown below may be an alternative version of @code{/donate.php}, +which implements inline contracts. + +@smallexample +// ../inline.php +@verbatiminclude ../inline.php +@end smallexample + +The wallet will then look for the @code{X-Taler-Contract} header, and fetch the +inlined contract if this header is found. Please note that this feature is not +yet implemented. @node Payments using JavaScript @section Triggering payments using JavaScript @cindex JavaScript @cindex payment -In the example in section FIXME, we used a GET request to trigger the -payment. This section describes how we could have instead performed -the interaction with the wallet directly from the button via -JavaScript. +In the example in section @ref{Initiating the payment process}, +we used a GET request to trigger the payment. This section describes how we +could have instead performed the interaction with the wallet directly from the +button via JavaScript. The function @code{executePayment} exported by @code{taler-wallet-lib.js} will basically hand its three parameters to the wallet which implements the following semantics:@* @@ -825,7 +842,7 @@ containing the coins to pay for a contract. Its full specification is available @url{https://api.taler.net/api-merchant.html#depositpermission}} to @code{/frontend-pay}. If this operation succeeds, then visit again the fulfillment URL, and finally enjoy the product. -@item if not, redirect the browser to @code{/donate} (which will then reinitiate the +@item if not, redirect the browser to @code{/donate.php} (which will then reinitiate the whole contract negotiation). This happens when the user visits a shared fulfillment URL. The idea is to let that user buy the same products as the user who shared the fulfillment URL. Nonetheless, the shop is not forced to follow this semantics when provides the third