commit 384e8ced15432bcb78f829516d917ba1c67250c6
parent b31146320cffaaaa5781d165ef025a8e70388ec2
Author: Florian Dold <florian@dold.me>
Date: Tue, 9 Dec 2025 12:31:56 +0100
configure turnstile
Diffstat:
1 file changed, 32 insertions(+), 0 deletions(-)
diff --git a/scripts/demo/setup-sandcastle.sh b/scripts/demo/setup-sandcastle.sh
@@ -1127,6 +1127,38 @@ cd /talerdata/sandcastle-drupal
composer exec -- drush en taler_turnstile
composer exec -- drush config:set taler_turnstile.settings access_token "$UMAMI_TOK" --yes
composer exec -- drush config:set taler_turnstile.settings payment_backend_url "$PROTO://$MERCHANT_DOMAIN$PORT_SUFFIX/instances/umami/" --yes
+composer exec -- drush config:set --input-format=yaml taler_turnstile.settings enabled_content_types '["article", "recipe"]' --yes
+
+snip=$(cat <<'EOF'
+$storage = \Drupal::entityTypeManager()->getStorage('taler_turnstile_price_category');
+$e = $storage->create(['id'=>"normal", 'label'=>'Normal', 'description' => "Normal Article Price", 'prices' => ['%none%' => ['KUDOS' => '0.3']]]);
+try {
+ $e->save();
+} catch (Exception $ex) {
+ echo $ex->getMessage();
+ echo "\n";
+}
+EOF
+)
+composer exec -- drush php:eval "$snip"
+
+snip=$(cat <<'EOF'
+$prcat_storage = \Drupal::entityTypeManager()->getStorage('taler_turnstile_price_category');
+$node_storage = \Drupal::entityTypeManager()->getStorage('node');
+$prcat = $prcat_storage->load('normal');
+$nodes = $node_storage->loadByProperties(['type'=> ['article', 'recipe']]);
+foreach ($nodes as $k => $node) {
+ echo 'updating node ' . $k . "\n";
+ if (!$node->hasField('field_taler_turnstile_prcat')) {
+ echo 'prcat missing' . "\n";
+ continue;
+ }
+ $node->set('field_taler_turnstile_prcat', $prcat);
+ $node->save();
+}
+EOF
+)
+composer exec -- drush php:eval "$snip"
cd /