summaryrefslogtreecommitdiff
path: root/doc/manual.texi
diff options
context:
space:
mode:
authorMarcello Stanisci <marcello.stanisci@inria.fr>2016-10-31 11:16:09 +0100
committerMarcello Stanisci <marcello.stanisci@inria.fr>2016-10-31 11:16:09 +0100
commite779cab9baf04e53a0ed8f75b39cdaec0ca93f9f (patch)
treeb1282985452f00ff7c49e517fa14aa51db2bf7b0 /doc/manual.texi
parent8814b790e7c537665a32492bb5d4e454ee4100f9 (diff)
downloadmerchant-e779cab9baf04e53a0ed8f75b39cdaec0ca93f9f.tar.gz
merchant-e779cab9baf04e53a0ed8f75b39cdaec0ca93f9f.tar.bz2
merchant-e779cab9baf04e53a0ed8f75b39cdaec0ca93f9f.zip
fix docs compile warnings
Diffstat (limited to 'doc/manual.texi')
-rw-r--r--doc/manual.texi253
1 files changed, 130 insertions, 123 deletions
diff --git a/doc/manual.texi b/doc/manual.texi
index 43f880b5..69c1e3ad 100644
--- a/doc/manual.texi
+++ b/doc/manual.texi
@@ -375,9 +375,9 @@ Takes the exchanges base URL, e.g. @url{https://exchange.demo.taler.net/}.
Takes the base32 encoding of the exchange's master public key,
e.g.
-@iftex
-{\small CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00}.
-@end iftex
+@example
+CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00.
+@end example
Note that multiple exchanges can be added to the system by using different
tokens in place of @code{MYEXCHANGE} in the example above.
@@ -439,8 +439,8 @@ For the @code{test} wire format, a sample specification looks as follows:
Those bank details above, are included in the contract in their hashed
form, so the 'salt' field is needed to make harder brute-forcing them.
-In order to get an account number, register at @code{https://bank.demo.taler.net/},
-our demonstration bank.
+In order to get an account number, register at our demonstration bank:
+@url{https://bank.demo.taler.net/}
Note that additional instances can be specified using different tokens
in the section name instead of @code{default}.
@@ -494,15 +494,15 @@ The resulting backend will be listening on port 9898.
The backend's private key will be located at @code{$DATADIR/key.priv}.
You can determine the expaned path using
-@example
+@smallexample
$ taler-config -f -s merchant-instance-wireformat-default -o TEST_RESPONSE_FILE
-@end example
+@end smallexample
The backend will use a database named @code{donations} within
Postgresql.
The backend will deposit the coins it receives to the exchange at
-@url{https://exchange.demo.taler.net/}, which has the master key
+@url{https://exchange.demo.taler.net/}, which has the master key @*
"CQQZ9DY3MZ1ARMN5K1VKDETS04Y2QCKMMCFHZSWJWWVN82BTTH00".
@@ -525,9 +525,9 @@ $ curl http://localhost:9898/
should return the message
-@example
+@smallexample
Hello, I'm a merchant's Taler backend. This HTTP server is not for humans.
-@end example
+@end smallexample
Please note that your backend is right now likely globally
reachable. Production systems should be configured to bind
@@ -607,69 +607,74 @@ backend at @code{/contract}. The main result of POSTing the proposal
to the backend is that it will be cryptographically signed, as by
design the frontend does not perform any cryptographic work.
-A simple @code{/generate-contract} handler could look like this:
+A simple @code{/generate-contract} handler may look like this:
-@display
+@smallexample
function make_contract($transaction_id, $now) @{
- $contract = array ('amount' =>
- array ('value' => 1,
- 'fraction' => 0,
- 'currency' => "KUDOS"),
- 'max_fee' =>
- array ('value' => 3,
- 'fraction' => 50000,
- 'currency' => "KUDOS"),
- 'transaction_id' => $transaction_id,
- 'products' => array (
- array ('description' => "Donation to charity program",
- 'quantity' => 1,
- 'price' =>
- array ('value' => 1,
- 'fraction' => 0,
- 'currency' => "KUDOS"),
- 'product_id' => 0,
- 'taxes' => array(), // No taxes for donations
- 'delivery_date' => "Some Date Format",
- 'delivery_location' => 'LNAME1')),
- 'timestamp' => "/Date(" . $now->getTimestamp() . ")/",
- 'expiry' =>
- "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/",
- 'refund_deadline' =>
- "/Date(" . $now->add(new DateInterval('P3M'))->getTimestamp() . ")/",
- 'repurchase_correlation_id' => '',
- 'fulfillment_url' => "https://charity-shop.example.com/fulfillment?transaction_id=$transaction_id&timestamp=$now",
- 'merchant' =>
- array ('address' => 'LNAME2',
- 'name' => "Charity donations shop",
- 'jurisdiction' => 'LNAME3'),
- 'locations' =>
- array ('LNAME1' =>
- array ('country' => 'Test Country',
- 'city' => 'Test City',
- 'state' => 'Test State',
- 'region' => 'Test Region',
- 'province' => 'Test Province',
- 'ZIP code' => 4908,
- 'street' => 'test street',
- 'street number' => 20),
- 'LNAME2' =>
- array ('country' => 'Test Country',
- 'city' => 'Test City',
- 'state' => 'Test State',
- 'region' => 'Test Region',
- 'province' => 'Test Province',
- 'ZIP code' => 4908,
- 'street' => 'test street',
- 'street number' => 20),
- 'LNAME3' =>
- array ('country' => 'Test Country',
- 'city' => 'Test City',
- 'state' => 'Test State',
- 'region' => 'Test Region',
- 'province' => 'Test Province',
- 'ZIP code' => 4908)));
-
+ $contract =
+ array (
+ 'amount' => array (
+ 'value' => 1,
+ 'fraction' => 0,
+ 'currency' => "KUDOS"),
+ 'max_fee' => array (
+ 'value' => 3,
+ 'fraction' => 50000,
+ 'currency' => "KUDOS"),
+ 'transaction_id' => $transaction_id,
+ 'products' => array (
+ array (
+ 'description' => "Donation to charity program",
+ 'quantity' => 1,
+ 'price' => array (
+ 'value' => 1,
+ 'fraction' => 0,
+ 'currency' => "KUDOS"),
+ 'product_id' => 0,
+ 'taxes' => array(), // No taxes for donations
+ 'delivery_date' => "Some Date Format",
+ 'delivery_location' => 'LNAME1')),
+ 'timestamp' => "/Date(" . $now->getTimestamp() . ")/",
+ 'expiry' =>
+ "/Date(" . $now->add(new DateInterval('P2W'))->getTimestamp() . ")/",
+ 'refund_deadline' =>
+ "/Date(" . $now->add(new DateInterval('P3M'))->getTimestamp() . ")/",
+ 'repurchase_correlation_id' => '',
+ 'fulfillment_url' =>
+ "https://charity-shop.example.com/fulfillment?"
+ . "transaction_id=$transaction_id&timestamp=$now",
+ 'merchant' => array (
+ 'address' => 'LNAME2',
+ 'name' => "Charity donations shop",
+ 'jurisdiction' => 'LNAME3'),
+ 'locations' => array (
+ 'LNAME1' =>
+ array (
+ 'country' => 'Test Country',
+ 'city' => 'Test City',
+ 'state' => 'Test State',
+ 'region' => 'Test Region',
+ 'province' => 'Test Province',
+ 'ZIP code' => 4908,
+ 'street' => 'test street',
+ 'street number' => 20),
+ 'LNAME2' => array (
+ 'country' => 'Test Country',
+ 'city' => 'Test City',
+ 'state' => 'Test State',
+ 'region' => 'Test Region',
+ 'province' => 'Test Province',
+ 'ZIP code' => 4908,
+ 'street' => 'test street',
+ 'street number' => 20),
+ 'LNAME3' => array (
+ 'country' => 'Test Country',
+ 'city' => 'Test City',
+ 'state' => 'Test State',
+ 'region' => 'Test Region',
+ 'province' => 'Test Province',
+ 'ZIP code' => 4908)));
@}
@@ -691,7 +696,7 @@ if (200 != $response->getResponseCode()) @{
return;
@}
echo $response->body;
-@end display
+@end smallexample
After the browser has fetched the contract, the user will
be given the opportunity to affirm the payment.
@@ -699,7 +704,7 @@ be given the opportunity to affirm the payment.
The function @code{post_to_backend} is shown in the figure below, as it's
not strictly part of the handler.
-@display
+@smallexample
function post_to_backend($backend_relative_url, $json)@{
$url = "https://charity-shop-backend.example.com$backend_relative_url";
@@ -714,7 +719,7 @@ function post_to_backend($backend_relative_url, $json)@{
$client->enqueue($req)->send();
return $client->getResponse();
@}
-@end display
+@end smallexample
@section Receiving payments via Taler
@@ -730,7 +735,7 @@ that the payment was successful, the handler needs to update the
session state with the browser to remember that the user paid.
The following code implements this in PHP:
-@example
+@smallexample
# Check if a session exists already
session_start();
if (! isset($_SESSION['paid'])) @{
@@ -750,7 +755,7 @@ if (200 != $response->getResponseCode())@{
@}
$_SESSION['paid'] = true;
return $response->body;
-@end example
+@end smallexample
Do not be confused by the @code{isset} test for the session state. In
our simple example, it will be set to ``false'' by the fulfillment URL
@@ -771,60 +776,62 @@ the wallet.
For our example, we include in the URI of the fulfillment page the data
which is needed to allow the page to determine which contract the user is
trying to access.
-Thus, the fulfillment URL for our example looks like the following:
+Thus, the fulfillment URL for our example looks like the following:@*
-@example
-https://charity-shop.example.com/fulfillment?transaction_id=<TRANSACTION_ID>&timestamp=<CONTRACTTIMESTAMP>
-@end example
+@smallexample
+https://charity-shop.example.com/fulfillment? \
+transaction_id=<TRANSACTION_ID>&timestamp=<CONTRACTTIMESTAMP>
+@end smallexample
-The @code{/fulfillment} handler will then perform the following actions:
+@*The @code{/fulfillment} handler will then perform the following actions:
-@example
+@smallexample
<html>
- <head>
- <title>Donation Fulfillment</titile>
- </head>
- <body>
- <?php
- # At first, check if the user has already paid for the product.
- # If so, deliver the product.
- session_start();
- if (! isset($_SESSION['paid']))@{
- # set as pending
- $_SESSION['paid'] = false;
- @}
- else@{
- if($_SESSION['paid'])@{
- echo "<p>Thanks for your donation!</p>";
- return;
- @}
- else@{
- echo '<form action="/cc-payment">
- First name<br> <input type="text"></input><br>
- Family name<br> <input type="text"></input><br>
- Age<br> <input type="text"></input><br>
- Nationality<br> <input type="text"></input><br>
- CC number<br> <input type="text"></input><br>
- Cvv2 code<br> <input type="text"></input><br>
- <input type="radio" name="gender">Female</input><br>
- <input type="submit"></input>
- </form>';
- return;
- @}
- @}
+ <head>
+ <title>Donation Fulfillment</titile>
+ </head>
+ <body>
+ <?php
+ # At first, check if the user has already paid for the product.
+ # If so, deliver the product.
+ session_start();
+ if (! isset($_SESSION['paid']))@{
+ # set as pending
+ $_SESSION['paid'] = false;
+ @}
+ else@{
+ if($_SESSION['paid'])@{
+ echo "<p>Thanks for your donation!</p>";
+ return;
+ @}
+ else@{
+ echo '<form action="/cc-payment">
+ First name<br> <input type="text"></input><br>
+ Family name<br> <input type="text"></input><br>
+ Age<br> <input type="text"></input><br>
+ Nationality<br> <input type="text"></input><br>
+ CC number<br> <input type="text"></input><br>
+ Cvv2 code<br> <input type="text"></input><br>
+ <input type="radio" name="gender">Female</input><br>
+ <input type="submit"></input>
+ </form>';
+ return;
+ @}
+ @}
+
+ # Reconstruct the contract
+ $rec_proposal = make_contract($_GET['transaction_id'], $_GET['timestamp']);
+ # $response obeys to the specification at:
+ # https://api.taler.net/api-merchant.html#offer
+ $response = post_to_backend("/contract", $rec_proposal);
- # Reconstruct the contract
- $rec_proposal = make_contract($_GET['transaction_id'], $_GET['timestamp']);
- # $response obeys to the specification at: https://api.taler.net/api-merchant.html#offer
- $response = post_to_backend("/contract", $rec_proposal);
-
- http_response_code (402);
- header ('X-Taler-Contract-Hash: json_decode($response)["H_contract"]');
- header ('X-Taler-Offer-Url: /donate');
- header ('X-Taler-Pay-Url: /pay'); ?>
- </body>
+ http_response_code (402);
+ header ('X-Taler-Contract-Hash: json_decode($response)["H_contract"]');
+ header ('X-Taler-Offer-Url: /donate');
+ header ('X-Taler-Pay-Url: /pay'); ?>
+ </body>
</html>
-@end example
+@end smallexample
@chapter Advanced topics