merchant-frontend-examples

ZZZ: Inactive/Deprecated
Log | Files | Refs

commit 3b24f495d02dc9a48f5bbf6512752e7bf60e1bbc
parent 313c1c2e3570edc91373f482864137aae7d4859d
Author: Marcello Stanisci <marcello.stanisci@inria.fr>
Date:   Wed, 16 Nov 2016 16:40:47 +0100

track-transaction stubs

Diffstat:
Mphp/config.php | 4++--
Mphp/doc/tutorial.texi | 40+++++++++++++++++++++++++++++++++++-----
Aphp/track-input.php | 20++++++++++++++++++++
3 files changed, 57 insertions(+), 7 deletions(-)

diff --git a/php/config.php b/php/config.php @@ -2,8 +2,8 @@ // This config file is in the public domain. - $BACKEND = "https://backend.test.taler.net/"; + $BACKEND = "http://localshop/"; // The currency must match the one used by the backend. - $CURRENCY = "PUDOS"; + $CURRENCY = "KUDOS"; ?> diff --git a/php/doc/tutorial.texi b/php/doc/tutorial.texi @@ -162,9 +162,7 @@ to the frontend @code{/donate} URL. For this, the HTML would be as follows: @smallexample -<form action="/donate.php"> - <input type="submit" value="Donate!"></input> -</form> +@include ../index.php @end smallexample When the server-side handler for @code{/donate} receives the form submission, @@ -286,11 +284,43 @@ transaction_id=<TRANSACTION_ID>&timestamp=<CONTRACTTIMESTAMP> @include ../fulfillment.php @end smallexample -@bye - @node Back-office-integration @chapter Integration of GNU Taler with the back office +This chapter shows how to implement the back office Web interface. +Namely, we want to verify if we received a wire transfer in +relation to a given Taler transaction. We are also interested in the +opposite direction: which Taler transactions are related to a +given wire transfer. +@c FIXME: does the reader know so far that a Taler transaction +@c is meant to trigger a wire transfer? +To that regard, the frontend's main task are: + +@itemize +@item gather the input from the user and forward it to the backend +@item transform the backend response in HTML and return it to the user +@end itemize + +We implement the first point with a simple HTML form. For simplicity, we +keep one page for gathering input data for both tracking directions. See +in the code sample below: + +@smallexample +// php/track-input.php +@include ../track-input.php +@end smallexample + +The @code{track-transaction.php} script is now responsible for taking the +Taler transaction ID given by the user in the @code{tid} field, and issuing +a @code{/track/transaction} REST call to the backend, see +@code{http://api.taler.net/api-merchant.html#get--track-transaction}. + +@smallexample +// php/track-transaction.php +@include ../track-transaction.php +@end smallexample + +@bye @node Advanced topics @chapter Advanced topics diff --git a/php/track-input.php b/php/track-input.php @@ -0,0 +1,20 @@ +<?php + + include 'copying.php'; + + echo "<html> + <head> + <title>Taler tutorial</title> + </head> + <body> + <form action='/track-transaction.php' method='GET'> + <input type='text' name='input'><> + <input type='submit' value='Track transaction'></input> + </form> + <form action='/track-transfer.php' method='GET'> + <input type='text' name='input'><> + <input type='submit' value='Track transfer'></input> + </form> + </body> + </html>"; +?>