refunds code sample

This commit is contained in:
Florian Dold 2016-08-23 15:53:28 +02:00
parent 3ef07c6c9f
commit fff1f61f49

View File

@ -860,25 +860,6 @@ URL in a browser will show the resource associated with the purchase.
This resource can be a digital good such as a news article, or simply This resource can be a digital good such as a news article, or simply
a confirmation for products that are delivered by other means. a confirmation for products that are delivered by other means.
\begin{figure*}[h!]
\lstset{language={}}
\begin{lstlisting}
HTTP/1.1 402 Payment Required
Content-Type: text/html; charset=UTF-8
X-Taler-Contract-Url: https://myshop/generate-contract?product=42
...
<html>
...
You don't seem to have Taler installed, here are
other payment options:
...
</html>
\end{lstlisting}
\caption{Sample HTTP response for a web resource that requires a payment.}
\label{listing:http-contract}
\end{figure*}
In order to ensure that only the paying customer has access to the Web In order to ensure that only the paying customer has access to the Web
resources behind the fulfillment URL, the Web store's server must resources behind the fulfillment URL, the Web store's server must
check the browser's session state. If the merchant can confirm that check the browser's session state. If the merchant can confirm that
@ -968,6 +949,20 @@ it has the following key advantages:
\subsection{Giving change and refunds} \subsection{Giving change and refunds}
\begin{figure*}[h!]
\lstset{language={HTML5}}
\begin{lstlisting}
<script src="taler-wallet-lib.js"></script>
<script>
taler.offerRefundFrom("https://myshop/purchase/42/refund", (err) => {
alert("An error occured while attempting a refund");
});
</script>
\end{lstlisting}
\caption{Sample JavaScript code to trigger a refund}
\label{listing:refund}
\end{figure*}
An important cryptographic difference between Taler and previous An important cryptographic difference between Taler and previous
transaction systems based on blind signing is that Taler is able to transaction systems based on blind signing is that Taler is able to
provide unlinkable change and refunds. From the user's point of view, provide unlinkable change and refunds. From the user's point of view,
@ -984,9 +979,9 @@ coins. Consequently, the major cryptographic advances of Taler are
invisible to the user. invisible to the user.
Taler's refresh protocol~\cite{talercrypto} also allows merchants to Taler's refresh protocol~\cite{talercrypto} also allows merchants to
give refunds to customers. For this, the merchant merely has to send a give refunds to customers. For this, the merchant signs a message
signed message to the exchange confirming the refund, and notify the that the customer's wallet processes (Figure~\ref{listing:refund}) and sends to the exchange in order
customer's wallet that the respective transaction was refunded. This to obtain new coins as a refund. This
can even be done with anonymous customers, as refunds are given as can even be done with anonymous customers, as refunds are given as
additional change to the owner of the coins that were originally spent additional change to the owner of the coins that were originally spent
to pay for the refunded transaction. to pay for the refunded transaction.