Merge pull request #13777 from rioug/13481-webhook-payment

Payment status change webhook
This commit is contained in:
Filipe
2026-01-08 11:26:41 +00:00
committed by GitHub
26 changed files with 597 additions and 54 deletions

View File

@@ -58,10 +58,15 @@ module Openfoodnetwork
Spree::Core::Engine.routes.default_url_options[:host] = ENV["SITE_URL"] if Rails.env == 'test'
end
# We reload the routes here
# so that the appended/prepended routes are available to the application.
config.after_initialize do
# We reload the routes here
# so that the appended/prepended routes are available to the application.
Rails.application.routes_reloader.reload!
# Subscribe to payment transition events
ActiveSupport::Notifications.subscribe(
"ofn.payment_transition", Payments::StatusChangedListenerService.new
)
end
initializer "spree.environment", before: :load_config_initializers do |app|

View File

@@ -93,7 +93,7 @@
# serializer. Therefore, this setting should only be enabled after all replicas
# have been successfully upgraded to Rails 7.1.
#++
# Rails.application.config.active_job.use_big_decimal_serializer = true
Rails.application.config.active_job.use_big_decimal_serializer = true
###
# Specify if an `ArgumentError` should be raised if `Rails.cache` `fetch` or

View File

@@ -4088,6 +4088,8 @@ en:
destroy:
success: Webhook endpoint successfully deleted
error: Webhook endpoint failed to delete
test:
success: Some test data will be sent to the webhook url
spree:
order_updated: "Order Updated"
@@ -4940,13 +4942,10 @@ en:
webhook_endpoints:
title: Webhook Endpoints
description: Events in the system may trigger webhooks to external systems.
event_types:
order_cycle_opened: Order Cycle Opened
event_type:
header: Event type
url:
header: Endpoint URL
create_placeholder: Enter the URL of the remote webhook endpoint
developer_settings:
title: Developer Settings
form:
@@ -5095,7 +5094,13 @@ en:
add_tag_rule_modal:
select_rule_type: "Select a rule type:"
add_rule: "Add Rule"
webhook_endpoint_form:
url:
create_placeholder: Enter the URL of the remote webhook endpoint
event_types:
order_cycle_opened: Order Cycle Opened
payment_status_changed: Post webhook on Payment status change
test_endpoint: Test webhook endpoint
# Gem to prevent bot form submissions
invisible_captcha:

View File

@@ -34,6 +34,7 @@ Spree::Core::Engine.routes.draw do
resource :account, :controller => 'users' do
resources :webhook_endpoints, only: [:create, :destroy], controller: '/webhook_endpoints'
post '/webhook_endpoints/:id/test', to: "/webhook_endpoints#test", as: "webhook_endpoint_test"
end
match '/admin/orders/bulk_management' => 'admin/orders#bulk_management', :as => "admin_bulk_order_management", via: :get