<%= form_for(@edit_payment_summary_form) do |f| %>
+ <%= render("waste_carriers_engine/shared/payment_errors") %>
+
<%= render("waste_carriers_engine/shared/errors", object: @edit_payment_summary_form) %>
diff --git a/app/views/waste_carriers_engine/payment_summary_forms/new.html.erb b/app/views/waste_carriers_engine/payment_summary_forms/new.html.erb
index 8ff057109..d44b152ab 100644
--- a/app/views/waste_carriers_engine/payment_summary_forms/new.html.erb
+++ b/app/views/waste_carriers_engine/payment_summary_forms/new.html.erb
@@ -2,15 +2,7 @@
<%= form_for(@payment_summary_form) do |f| %>
- <% if flash[:error].present? %>
-
-
<%= t(".payment_error_heading") %>
-
-
-
- <% end %>
+ <%= render("waste_carriers_engine/shared/payment_errors") %>
<%= render("waste_carriers_engine/shared/errors", object: @payment_summary_form) %>
diff --git a/app/views/waste_carriers_engine/shared/_payment_errors.html.erb b/app/views/waste_carriers_engine/shared/_payment_errors.html.erb
new file mode 100644
index 000000000..e9aa1367a
--- /dev/null
+++ b/app/views/waste_carriers_engine/shared/_payment_errors.html.erb
@@ -0,0 +1,10 @@
+
+<% if flash[:error].present? %>
+
+
<%= t(".payment_error_heading") %>
+
+
+
+<% end %>
diff --git a/config/locales/en.yml b/config/locales/en.yml
index a1d15edc0..fcf3446cb 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -16,6 +16,8 @@ en:
dob_year: Year
dob_month: Month
dob_day: Day
+ payment_errors:
+ payment_error_heading: A problem with your payment
errors:
heading: A problem to fix
manual_address:
diff --git a/config/locales/forms/payment_summary_forms/en.yml b/config/locales/forms/payment_summary_forms/en.yml
index 2163330db..59b45b622 100644
--- a/config/locales/forms/payment_summary_forms/en.yml
+++ b/config/locales/forms/payment_summary_forms/en.yml
@@ -3,7 +3,6 @@ en:
payment_summary_forms:
new:
title: Payment summary
- payment_error_heading: A problem with your payment
heading: Payment summary
renewal_fee: Renewal of registration
registration_fee: Initial registration
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/edit_payment_summary_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/edit_payment_summary_form_spec.rb
index a1d5f06ab..75ae157b0 100644
--- a/spec/models/waste_carriers_engine/edit_registration_workflow/edit_payment_summary_form_spec.rb
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/edit_payment_summary_form_spec.rb
@@ -9,6 +9,12 @@ module WasteCarriersEngine
describe "#workflow_state" do
context ":payment_summary_form state transitions" do
context "on next" do
+ context "when the payment type is :card" do
+ subject { build(:edit_registration, workflow_state: "edit_payment_summary_form", temp_payment_method: "card") }
+
+ include_examples "has next transition", next_state: "worldpay_form"
+ end
+
include_examples "has next transition", next_state: "edit_bank_transfer_form"
end
diff --git a/spec/models/waste_carriers_engine/edit_registration_workflow/worldpay_form_spec.rb b/spec/models/waste_carriers_engine/edit_registration_workflow/worldpay_form_spec.rb
new file mode 100644
index 000000000..15249f63a
--- /dev/null
+++ b/spec/models/waste_carriers_engine/edit_registration_workflow/worldpay_form_spec.rb
@@ -0,0 +1,21 @@
+# frozen_string_literal: true
+
+require "rails_helper"
+
+module WasteCarriersEngine
+ RSpec.describe EditRegistration do
+ subject { build(:edit_registration, workflow_state: "worldpay_form") }
+
+ describe "#workflow_state" do
+ context ":worldpay_form state transitions" do
+ context "on next" do
+ include_examples "has next transition", next_state: "edit_complete_form"
+ end
+
+ context "on back" do
+ include_examples "has back transition", previous_state: "edit_payment_summary_form"
+ end
+ end
+ end
+ end
+end