README.md (8093B)
1 # Taler merchant demos 2 3 This repository contains the GNU Taler landing page, essay shop, and donation 4 demo. It is implemented as one self-contained Go executable with no 5 third-party Go dependencies. Templates, translations, styles, and essay 6 content are embedded in the executable. 7 8 ## Build and test 9 10 Go 1.22 or newer is required. 11 12 GNU gettext is also required for the translation maintenance and validation 13 targets. 14 15 Select an installation prefix with the GNU-style configuration entry point: 16 17 ```console 18 $ ./configure --prefix=/usr/local 19 ``` 20 21 The default prefix is `/usr/local`. 22 23 ```console 24 $ make 25 $ make check 26 ``` 27 28 ## Translation maintenance 29 30 Language URLs are canonicalized across all three demos. Regional locales use 31 an exact supported match first, then a supported parent: `/de_CH/` and 32 `/de-CH/` currently redirect to `/de/`. Matching ignores case and treats 33 underscores and hyphens equally. Unknown locale codes redirect to English. 34 Locale redirects preserve the remaining path, query parameters, and forwarded 35 prefix, and use HTTP 307 to preserve form submissions. Missing pages still return 404. 36 The root URL chooses a supported language from `Accept-Language`. 37 38 Bank links use the same language paths as the other demos, for example 39 `https://bank.demo.taler.net/de/`. Sandcastle's Caddy configuration redirects 40 these entry points to the bank UI with the selected language. 41 42 The user interface is available in English, German, French, Italian, 43 Portuguese, Spanish, Russian, Turkish, and Ukrainian. Run the extractor after 44 changing user-facing strings in the Go handlers or templates: 45 46 ```console 47 $ make update-i18n 48 ``` 49 50 This regenerates `messages.pot`, merges it into each retained PO file, and 51 removes obsolete entries. `make check` verifies that the POT is current, that 52 all PO files pass gettext validation, and that placeholders and HTML tags are 53 preserved by every translation. 54 55 The executable is written to `build/taler-merchant-demos`. Install it below 56 the configured prefix with: 57 58 ```console 59 $ make install 60 ``` 61 62 `DESTDIR` is honored for staged installations. The prefix can also be 63 overridden directly with `make prefix=...` without running `configure`. 64 65 ## Configuration 66 67 The server reads the same GNUnet-style configuration used by other Taler 68 components. Section and option names are case-insensitive. `@INLINE@` 69 directives and `$VAR`, `${VAR}`, and `${VAR:-fallback}` filename expansions are 70 supported. 71 72 Pass a configuration explicitly with `-c`. Without it, the server uses the 73 first existing file from `$XDG_CONFIG_HOME/taler-merchant-demos.conf` (or 74 `~/.config/taler-merchant-demos.conf` when `XDG_CONFIG_HOME` is unset), 75 `/etc/taler-merchant-demos.conf`, and 76 `/etc/taler-merchant-demos/taler-merchant-demos.conf`. It proceeds with only 77 defaults when none of these files exists. 78 79 Defaults are loaded first, in filename order, from 80 `$TALER_MERCHANT_DEMOS_BASE_CONFIG`. Without that override, the defaults are 81 read from `share/taler-merchant-demos/config.d` below the installation prefix, 82 which can be overridden with `$TALER_MERCHANT_DEMOS_PREFIX`. Inline files are 83 loaded at the point where their `@INLINE@` directive occurs, and the main 84 configuration is loaded last. 85 86 A configuration containing all three demos looks like this: 87 88 ```ini 89 [taler] 90 currency = KUDOS 91 92 [frontend-demo] 93 landing_url = https://demo.taler.net/ 94 bank_url = https://bank.demo.taler.net/ 95 blog_url = https://shop.demo.taler.net/ 96 donations_url = https://donations.demo.taler.net/ 97 98 [frontend-demo-landing] 99 http_serve = tcp 100 http_port = 8080 101 enable_merchant_samples = no 102 # Required only with enable_merchant_samples = yes 103 # backend_url = https://backend.demo.taler.net/instances/landing-samples/ 104 # backend_apikey = secret-token:secret 105 106 [frontend-demo-blog] 107 http_serve = tcp 108 http_port = 8081 109 backend_url = https://backend.demo.taler.net/instances/blog/ 110 backend_apikey = secret-token:secret 111 enable_tokens = no 112 113 [frontend-demo-donations] 114 http_serve = tcp 115 http_port = 8082 116 backend_url_gnunet = https://backend.demo.taler.net/instances/gnunet/ 117 backend_apikey_gnunet = secret-token:secret 118 backend_url_taler = https://backend.demo.taler.net/instances/taler/ 119 backend_apikey_taler = secret-token:secret 120 backend_url_tor = https://backend.demo.taler.net/instances/tor/ 121 backend_apikey_tor = secret-token:secret 122 # A non-empty legacy value enables tax-receipt output. The Merchant backend's 123 # configured donation authorities determine which authority URLs are offered. 124 donau_url = 125 ``` 126 127 ### Merchant samples 128 129 Enable `enable_merchant_samples = yes` in `[frontend-demo-landing]` to link 130 the landing page to `/merchant-samples`. Set that section's `backend_url` and 131 `backend_apikey` for a dedicated **landing samples** merchant instance. Grant 132 the key `orders-read`, `orders-write`, `tokenfamilies-read`, and 133 `tokenfamilies-write` permissions. The default is disabled. 134 135 The landing process creates the `samples-coffee-coupon` discount family and 136 the `samples-day-pass` subscription family at startup. It reuses compatible 137 families on restart so tokens already in wallets can still be redeemed. 138 Coupons use 30-day key validity. The merchant rounds day-pass key validity to a 139 calendar day in its local time zone. Run the merchant backend with `TZ=UTC` 140 for expiry at midnight UTC. 141 While setup is pending, the samples page returns HTTP 503 with `Retry-After`. 142 The main landing page remains available. Provisioning errors in the service 143 log identify the affected family, and the process retries automatically. 144 145 Configure the merchant backend to accept both the demo currency and CHF. 146 Keep the demo exchange enabled and add `https://exchange.stage.taler-ops.ch/` 147 as a trusted CHF exchange with its verified master public key. Configure a 148 settlement account on the instance that **both exchanges can credit**. Each 149 contract uses one payout account for all choices. The staging exchange 150 requires a Swiss IBAN, so the demo-currency exchange must support transfers 151 to that IBAN as well. See the [merchant operator manual](https://docs.taler.net/taler-merchant-manual.html#exchange). 152 153 Each button creates a new order. The receipt and reorder URLs use the public 154 `landing_url` from `[frontend-demo]`, including its path prefix. 155 156 Compare plain v0 and v1 payments, or buy a coffee at full price to earn a 157 coupon. Spend one coupon for half price or two for a free coffee. The exhibition 158 offers single entry or a day pass. A valid pass gives automatic free entry on 159 repeat visits until midnight UTC. 160 161 The café basket includes three products with quantities and line prices. The coffee 162 and croissant PNGs come from the GNU Taler iOS POS screenshot assets 163 (©2022–25 Taler Systems S.A., GPL-3.0-or-later). For the 164 two-currency tests, fund the wallet in the demo currency and in staging CHF. 165 Buy a postcard in each currency, then earn a coupon in one currency and 166 redeem it in the other. The fulfillment page shows the selected price. 167 168 ### Listener settings 169 170 Each section can instead listen on a Unix socket: 171 172 ```ini 173 [frontend-demo-blog] 174 http_serve = unix 175 http_unixpath = /run/taler-merchant-demos/blog.sock 176 http_unixpath_mode = 660 177 ``` 178 179 The command-line `--http-port` option overrides the configured listener and 180 forces TCP mode. 181 182 Inspect the effective configuration, including defaults and inline files. The 183 commented header lists files in load order, and every setting is annotated 184 with its source location: 185 186 ```console 187 $ taler-merchant-demos config dump -c /etc/taler-merchant-demos/taler-merchant-demos.conf 188 ``` 189 190 ## Run 191 192 Choose exactly one demo per process: 193 194 ```console 195 $ taler-merchant-demos -c /etc/taler-merchant-demos/taler-merchant-demos.conf landing 196 $ taler-merchant-demos -c /etc/taler-merchant-demos/taler-merchant-demos.conf blog 197 $ taler-merchant-demos -c /etc/taler-merchant-demos/taler-merchant-demos.conf donations 198 ``` 199 200 Behind a reverse proxy, the demos use `X-Forwarded-Host`, 201 `X-Forwarded-Proto`, and `X-Forwarded-Prefix` for request-based links. 202 Merchant sample receipt and reorder links use the configured `landing_url`. These headers should be removed from untrusted 203 client requests and set by the trusted proxy.