From 0de353ffc774cba2ba22b71d92aaab90dcaa3672 Mon Sep 17 00:00:00 2001 From: Marcello Stanisci Date: Tue, 28 Mar 2017 17:11:49 +0200 Subject: Commenting out JS-based payments chapter as taler-wallet-lib doesn't contain anymore the functions needed to get a proposal and trigger a payment.. --- php/doc/tutorial.texi | 147 +++++++++++++++++++++++++------------------------- php/inline.php | 2 +- 2 files changed, 74 insertions(+), 75 deletions(-) (limited to 'php') diff --git a/php/doc/tutorial.texi b/php/doc/tutorial.texi index a53eefb..d394130 100644 --- a/php/doc/tutorial.texi +++ b/php/doc/tutorial.texi @@ -561,8 +561,7 @@ See below both parts: @menu * Presence detection:: Reacting to the presence of a Taler wallet * Taler contracts:: Building Taler contracts -* Inline contracts:: Snding contracts with the HTTP header -* Payments using JavaScript:: Triggering payments using JavaScript +* Inline proposals:: Snding proposals with the HTTP header * The Fulfillment page:: The rationale behind the fulfillment page design @end menu @@ -841,16 +840,16 @@ that they do not understand as a key-value list. @end table -@node Inline contracts -@section Inlining contracts in HTTP headers +@node Inline proposals +@section Inlining proposals in HTTP headers @cindex optimization @cindex contract 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. +from where it should fetch the proposal. Instead of specifying the proposal +via an URL, it is also possible to inline short proposals directly. -That may be accomplished by the frontend including the @code{X-Taler-Contract} +That may be accomplished by the frontend including the @code{X-Taler-Proposal} 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. @@ -860,76 +859,76 @@ which implements inline contracts. @verbatiminclude ../inline.php @end smallexample -The wallet will then look for the @code{X-Taler-Contract} header, and fetch the +The wallet will then look for the @code{X-Taler-Proposal} header, and fetch the inlined contract if this header is found. Please note that this feature is not yet implemented in the wallet. -@node Payments using JavaScript -@section Triggering payments using JavaScript - -Please note that the following examples are purely instructional and NOT TESTED -along with the tutorial code. - -@cindex JavaScript - -@subsection Offering contracts - -Offering contracts the JavaScript way doesn't require us to set HTTP -headers, and so -- in a minimalistic implementation -- the donation button -should just hit a HTML page that invokes the @code{offerContractFrom} function, -from the @code{taler-wallet-lib.js} library. - -Thus our homepage can now look as follows - -@smallexample -// ../index-js.html -@verbatiminclude ../index-js.html -@end smallexample - -@code{donate-js.html} is now in charge of calling @code{offerContractFrom} -passing the contract URL to it, which is @code{"/generate-order.php"} in -our example. See below. - -@smallexample -// ../donate-js.html -@verbatiminclude ../donate-js.html -@end smallexample - -Please make sure that @code{taler-wallet-lib.js} location is valid. - -@subsection Receiving payments -@cindex payment - -In the example in section @ref{Initiating the payment process}, the fulfillment -handler @code{/fulfillment.php} triggers the payment in the wallet by returing -the three needed values (contract hashcode, pay URL, offer URL) via HTTP headers. - -The same action can be accomplished @emph{with} JavaScript, thanks to -@code{taler-wallet-lib.js} of @emph{web-common} repository. -The fulfillment handler needs just to call the function @code{executePayment}, feeding it -with the three needed parameters. The wallet will then get triggered and proceed with the -payment. See below a full example: - -@smallexample -// ../fulfillment-js.php -@verbatiminclude ../fulfillment-js.php -@end smallexample - -Note that, in order to use this fulfillment handler for the tutorial, you need to -specify it in the contract's ``fulfillment_url'' field: - -@smallexample -@{ -... contract fields .. - -"fulfillment_url": "/fulfillment-js.php?transaction_id=& \ - timestamp=" -... -@} -@end smallexample - -Additionally, you should also make sure that @code{taler-wallet-lib.js} location -is valid. +@c @node Payments using JavaScript +@c @section Triggering payments using JavaScript +@c +@c Please note that the following examples are purely instructional and NOT TESTED +@c along with the tutorial code. +@c +@c @cindex JavaScript +@c +@c @subsection Offering contracts +@c +@c Offering contracts the JavaScript way doesn't require us to set HTTP +@c headers, and so -- in a minimalistic implementation -- the donation button +@c should just hit a HTML page that invokes the @code{offerContractFrom} function, +@c from the @code{taler-wallet-lib.js} library. +@c +@c Thus our homepage can now look as follows +@c +@c @smallexample +@c // ../index-js.html +@c @verbatiminclude ../index-js.html +@c @end smallexample +@c +@c @code{donate-js.html} is now in charge of calling @code{offerContractFrom} +@c passing the contract URL to it, which is @code{"/generate-order.php"} in +@c our example. See below. +@c +@c @smallexample +@c // ../donate-js.html +@c @verbatiminclude ../donate-js.html +@c @end smallexample +@c +@c Please make sure that @code{taler-wallet-lib.js} location is valid. +@c +@c @subsection Receiving payments +@c @cindex payment +@c +@c In the example in section @ref{Initiating the payment process}, the fulfillment +@c handler @code{/fulfillment.php} triggers the payment in the wallet by returing +@c the three needed values (contract hashcode, pay URL, offer URL) via HTTP headers. +@c +@c The same action can be accomplished @emph{with} JavaScript, thanks to +@c @code{taler-wallet-lib.js} of @emph{web-common} repository. +@c The fulfillment handler needs just to call the function @code{executePayment}, feeding it +@c with the three needed parameters. The wallet will then get triggered and proceed with the +@c payment. See below a full example: +@c +@c @smallexample +@c // ../fulfillment-js.php +@c @verbatiminclude ../fulfillment-js.php +@c @end smallexample +@c +@c Note that, in order to use this fulfillment handler for the tutorial, you need to +@c specify it in the contract's ``fulfillment_url'' field: +@c +@c @smallexample +@c @{ +@c ... contract fields .. +@c +@c "fulfillment_url": "/fulfillment-js.php?transaction_id=& \ +@c timestamp=" +@c ... +@c @} +@c @end smallexample +@c +@c Additionally, you should also make sure that @code{taler-wallet-lib.js} location +@c is valid. @node The fulfillment page @section Design considerations for the fulfillment page diff --git a/php/inline.php b/php/inline.php index ce73982..a6cf510 100644 --- a/php/inline.php +++ b/php/inline.php @@ -16,7 +16,7 @@ } http_response_code(402); // Payment required - header ("X-Taler-Contract: $ret"); // Inline contract + header ("X-Taler-Proposal: $ret"); // Inline proposal ?> -- cgit v1.2.3