diff --git a/app/components/webhook_endpoint_form_component.rb b/app/components/webhook_endpoint_form_component.rb index 914eb22c61..eff832f707 100644 --- a/app/components/webhook_endpoint_form_component.rb +++ b/app/components/webhook_endpoint_form_component.rb @@ -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 diff --git a/app/components/webhook_endpoint_form_component/webhook_endpoint_form_component.html.haml b/app/components/webhook_endpoint_form_component/webhook_endpoint_form_component.html.haml index 1ad729b18c..80f0147043 100644 --- a/app/components/webhook_endpoint_form_component/webhook_endpoint_form_component.html.haml +++ b/app/components/webhook_endpoint_form_component/webhook_endpoint_form_component.html.haml @@ -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") diff --git a/config/locales/en.yml b/config/locales/en.yml index 3082e4e0bf..aa44a7c2e6 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -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" diff --git a/spec/controllers/webhook_endpoints_controller_spec.rb b/spec/controllers/webhook_endpoints_controller_spec.rb index 9cac19f5d5..d1db36d53b 100644 --- a/spec/controllers/webhook_endpoints_controller_spec.rb +++ b/spec/controllers/webhook_endpoints_controller_spec.rb @@ -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