From 9cbe7a498dfe35962bc76bcde8434c2d29eb14f1 Mon Sep 17 00:00:00 2001
From: Florian Dold <florian.dold@gmail.com>
Date: Fri, 26 Aug 2016 16:10:28 +0200
Subject: js payment execution

---
 articles/ui/ui.tex | 19 +++++++++++++++++--
 1 file changed, 17 insertions(+), 2 deletions(-)

(limited to 'articles/ui/ui.tex')

diff --git a/articles/ui/ui.tex b/articles/ui/ui.tex
index 63f7ddb0f..bac62d80b 100644
--- a/articles/ui/ui.tex
+++ b/articles/ui/ui.tex
@@ -855,14 +855,29 @@ the {\em fulfillment} URL provided by the merchant in the contract
 
 \subsubsection{Fulfillment}
 
+\begin{figure*}[t!]
+  \lstset{language=HTML5}
+\begin{lstlisting}
+  taler.executePayment("2BAH2AT4GSG5JRM2W4YWTSYGY66EK4X8CX2V69D5VF7XV703AJMG",
+    "https://shop/pay",
+    "https://shop/article/42",
+    (err) => {
+      alert("Sending payment failed");
+    });
+\end{lstlisting}
+\caption{Sample JavaScript code to trigger (re-)sending a payment to the merchant.}
+  \label{listing:javascript-execute}
+\end{figure*}
+
+
 \begin{figure*}[t!]
   \lstset{language={}}
 \begin{lstlisting}
 HTTP/1.1 402 Payment Required
 Content-Type: text/html; charset=UTF-8
 X-Taler-Contract-Hash: 2BAH2AT4GSG5JRM2W4YWTSYGY66EK4X8CX2V69D5VF7XV703AJMG
-X-Taler-Offer-Url: https://shop/article/42
 X-Taler-Pay-Url: https://shop/pay
+X-Taler-Offer-Url: https://shop/article/42
 ...
 
 <!DOCTYPE html>
@@ -910,7 +925,7 @@ lost,\footnote{This can happen when when privacy conscious users
   browser) do not support persistent (non-session) cookies.} the Web
 store responds by (again) triggering a payment process (either via
 JavaScript or using {\tt 402 Payment Required}, see
-Figure~\ref{listing:http-execute}).  However, unlike the response from
+Figures~\ref{listing:javascript-execute} and~\ref{listing:http-execute}).  However, unlike the response from
 the offer URL, the 402 response from the fulfillment page includes the
 headers {\tt X-Taler-Contract-Hash}, {\tt X-Taler-Pay-Url} and {\tt
   X-Taler-Offer-Url}.
-- 
cgit v1.2.3

