Add Taler as payment method

It doesn't take payments yet but can be selected during checkout.
This commit is contained in:
Maikel Linke
2026-01-12 17:12:11 +11:00
parent a0011bd2e9
commit b3a1d1269a
5 changed files with 47 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ module Spree
Spree::Gateway::PayPalExpress
Spree::Gateway::StripeSCA
Spree::PaymentMethod::Check
Spree::PaymentMethod::Taler
}.freeze
def create

View File

@@ -0,0 +1,39 @@
# frozen_string_literal: true
module Spree
class PaymentMethod
# GNU Taler is a distributed, open source payment system.
# You need a hosted Taler backend server to process payments.
#
# For testing, you can use the official demo backend:
#
# - Merchant UX: https://backend.demo.taler.net
# - Username: sandbox
# - Password: sandbox
#
# Configure this payment method for testing with:
#
# - backend_url: https://backend.demo.taler.net/instances/sandbox
# - api_key: sandbox
class Taler < PaymentMethod
preference :backend_url, :string
preference :api_key, :password
# Name of the view to display during checkout
def method_type
"check" # empty view
end
def external_gateway?
true
end
# The backend provides this URL. It can look like this:
# https://backend.demo.taler.net/instances/blog/orders/2026..?token=S8Y..&session_id=b0b..
def external_payment_url(options)
# order = options.fetch(:order)
# Taler.create_order(backend_url, api_key, order.total, "OFN Order", "https://ofn.example.net")
end
end
end
end

View File

@@ -11,7 +11,7 @@ module PermittedAttributes
[:name, :description, :type, :active,
:environment, :display_on, :tag_list,
:preferred_enterprise_id, :preferred_server, :preferred_login, :preferred_password,
:calculator_type, :preferred_api_key,
:calculator_type, :preferred_api_key, :preferred_backend_url,
:preferred_signature, :preferred_solution, :preferred_landing_page, :preferred_logourl,
:preferred_test_mode, :calculator_type, { distributor_ids: [] },
{ calculator_attributes: PermittedAttributes::Calculator.attributes }]

View File

@@ -4344,6 +4344,10 @@ en:
thumbnail: "Thumbnail"
back_to_images_list: "Back To Images List"
# Attributes of the Taler payment gateway
backend_url: "Backend URL"
api_key: "API key"
# TODO: remove `email` key once we get to Spree 2.0
email: Email
# TODO: remove 'account_updated' key once we get to Spree 2.0
@@ -4666,6 +4670,7 @@ en:
check: "Cash/EFT/etc. (payments for which automatic validation is not required)"
paypalexpress: "PayPal Express"
stripesca: "Stripe SCA"
taler: "Taler"
payments:
source_forms:
stripe:

View File

@@ -19,6 +19,7 @@ RSpec.describe Spree::Admin::PaymentMethodsController do
expect(providers).to eq %w[
Spree::Gateway::PayPalExpress
Spree::PaymentMethod::Check
Spree::PaymentMethod::Taler
]
end