Per review, fix test webhook

- only show button for payment status changed webhook
- update translation
This commit is contained in:
Gaetan Craig-Riou
2025-12-05 10:47:19 +11:00
parent d7505bcef4
commit 4073238654
4 changed files with 10 additions and 5 deletions

View File

@@ -9,4 +9,8 @@ class WebhookEndpointFormComponent < ViewComponent::Base
private
attr_reader :webhooks, :webhook_type
def is_webhook_payment_status?
webhook_type == "payment_status_changed"
end
end

View File

@@ -21,6 +21,7 @@
data: { confirm: I18n.t(:are_you_sure) } do
= I18n.t(:delete)
= form_tag helpers.webhook_endpoint_test_account_path(webhook_endpoint), class: "button_to", 'data-turbo': true do
= button_tag type: "submit", class: "tiny alert no-margin", data: { confirm: I18n.t(:are_you_sure) } do
= I18n.t("components.webhook_endpoint_form.test_endpoint")
- if is_webhook_payment_status?
= form_tag helpers.webhook_endpoint_test_account_path(webhook_endpoint), class: "button_to", 'data-turbo': true do
= button_tag type: "submit", class: "tiny alert no-margin", data: { confirm: I18n.t(:are_you_sure) } do
= I18n.t("components.webhook_endpoint_form.test_endpoint")

View File

@@ -4089,7 +4089,7 @@ en:
success: Webhook endpoint successfully deleted
error: Webhook endpoint failed to delete
test:
success: Some test data has been sent to the webhook url
success: Some test data will be sent to the webhook url
spree:
order_updated: "Order Updated"

View File

@@ -84,7 +84,7 @@ RSpec.describe WebhookEndpointsController do
it "shows a success mesage" do
subject
expect(flash[:success]).to eq "Some test data has been sent to the webhook url"
expect(flash[:success]).to eq "Some test data will be sent to the webhook url"
end
end
end