diff options
-rw-r--r-- | plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php | 27 | ||||
-rwxr-xr-x | server-build/QEMU-autobuild/buildWebstore.sh | 18 | ||||
-rw-r--r-- | snippets/kudos-currency.php (renamed from server-build/QEMU-autobuild/KUDOS-WooCommerce-Support.php.txt) | 0 | ||||
-rw-r--r-- | snippets/oidc-reclaim.php | 23 |
4 files changed, 41 insertions, 27 deletions
diff --git a/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php b/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php index 9662477..011e209 100644 --- a/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php +++ b/plugin/GNU-Taler-Payment-Gateway/class-wc-gnutaler-gateway.php @@ -42,13 +42,10 @@ define("MERCHANT_PROTOCOL_AGE", 0); /* -TODO (with FIXME in code): -- figure out where OIDC logic should go - -TODO (without FIXME in code): +TODO: - refund needs to be tested more (with wallet!) -FEATURES: +OPEN FEATURES: - MAYBE: multi-currency support (i.e. use https://$CURRENCY.$backend_url/?) */ @@ -220,26 +217,6 @@ function gnutaler_init_gateway_class() 20, 4 ); - // Modify OIDC connect button text for Reclaim:ID - // (FIXME: this probably doesn't belong here!) - add_filter('openid-connect-generic-login-button-text', function( $text ) { - $text = __('Login with Re:ClaimID', 'gnutaler' ); - return $text; - }); - - // make sure OIDC 'login' goes to WooCommerce - // (FIXME: this probably doesn't belong here, but maybe into the - // OIDC button hook for WC!?) - add_action('openid-connect-generic-redirect-user-back', - function( $redirect_url, $user ) { - // Take over the redirection complete. Send users somewhere special based on their capabilities. - global $woocommerce; - $checkout_url = $woocommerce->cart->wc_get_checkout_url (); - wp_redirect( $checkout_url); // or admin_url( $checkout_url) )?; - exit(); - }, - 10, - 2); } /** diff --git a/server-build/QEMU-autobuild/buildWebstore.sh b/server-build/QEMU-autobuild/buildWebstore.sh index a28fba5..e47884e 100755 --- a/server-build/QEMU-autobuild/buildWebstore.sh +++ b/server-build/QEMU-autobuild/buildWebstore.sh @@ -167,12 +167,26 @@ sudo -u www-data wp media import https://live.staticflickr.com/7199/6929220523_1 # Add Snippet to enable KUDOS currency in WooCommerce # Note: this will break the shop badly if run twice, # recovery by deleting the duplicate entries! -SNIPPET=`cat ${ORIGIN}/woocommerce-taler/server-build/QEMU-autobuild/KUDOS-WooCommerce-Support.php.txt` +SNIPPET=`cat ${ORIGIN}/woocommerce-taler/snippets/kudos-currency.php` cat | mysql wordpress <<EOF PREPARE stmt FROM 'INSERT INTO wp_snippets (name, description, code, scope, priority, active, modified) VALUES (?,?,?,?,?,?,?)'; SET @name='KUDOS currency support'; -SET @description='This snippets adds support for the KUDOS currency of the Taler demo to WooCommerce'; +SET @description='This snippet adds support for the KUDOS currency of the Taler demo to WooCommerce'; +SET @code="$SNIPPET"; +EXECUTE stmt USING @name, @description, @code, "global", 10, 1, NOW(); +EOF + + +# Add Snippet to integrate OIDC with WooCommerce. +# Note: this will break the shop badly if run twice, +# recovery by deleting the duplicate entries! +SNIPPET=`cat ${ORIGIN}/woocommerce-taler/snippets/oidc-reclaim.php` + +cat | mysql wordpress <<EOF +PREPARE stmt FROM 'INSERT INTO wp_snippets (name, description, code, scope, priority, active, modified) VALUES (?,?,?,?,?,?,?)'; +SET @name='Re:ClaimID integration with WooCommerce'; +SET @description='This snippet adds the integration between Re:ClaimID and WooCommerce, allowing users to import their shipping details from Re:ClaimID into WooCommerce during checkout'; SET @code="$SNIPPET"; EXECUTE stmt USING @name, @description, @code, "global", 10, 1, NOW(); EOF diff --git a/server-build/QEMU-autobuild/KUDOS-WooCommerce-Support.php.txt b/snippets/kudos-currency.php index 0ddcb3f..0ddcb3f 100644 --- a/server-build/QEMU-autobuild/KUDOS-WooCommerce-Support.php.txt +++ b/snippets/kudos-currency.php diff --git a/snippets/oidc-reclaim.php b/snippets/oidc-reclaim.php new file mode 100644 index 0000000..cbb2f8c --- /dev/null +++ b/snippets/oidc-reclaim.php @@ -0,0 +1,23 @@ +/** + * This snipped integrates the OIDC connect button with WooCommerce + * to allow importing the customer's shopping details via OIDC / Re:ClaimID + */ + +// Modify OIDC connect button text for Reclaim:ID +add_filter('openid-connect-generic-login-button-text', function( $text ) { + $text = __('Login with Re:ClaimID', 'gnutaler' ); + return $text; +}); + +// make sure OIDC 'login' goes to WooCommerce checkout URL. +add_action('openid-connect-generic-redirect-user-back', + function( $redirect_url, $user ) { + // Take over the redirection complete. + // Send users somewhere special based on their capabilities. + global $woocommerce; + $checkout_url = $woocommerce->cart->wc_get_checkout_url (); + wp_redirect( $checkout_url); // or admin_url( $checkout_url) )?; + exit(); + }, + 10, + 2); |