diff --git a/app/controllers/claims/support/claims/payments/claims_controller.rb b/app/controllers/claims/support/claims/payments/claims_controller.rb index d5691554d..38f217629 100644 --- a/app/controllers/claims/support/claims/payments/claims_controller.rb +++ b/app/controllers/claims/support/claims/payments/claims_controller.rb @@ -1,10 +1,33 @@ class Claims::Support::Claims::Payments::ClaimsController < Claims::Support::ApplicationController append_pundit_namespace :claims, :payments - before_action :set_claim, only: %i[show] + before_action :set_claim, only: %i[show confirm_information_sent information_sent confirm_paid paid confirm_reject reject] before_action :authorize_claim def show; end + def confirm_information_sent; end + + def information_sent + @claim.payment_information_sent! + + redirect_to claims_support_claims_payments_claim_path(@claim) + end + + def confirm_paid; end + + def paid + @claim.paid! + + redirect_to claims_support_claims_payments_claim_path(@claim) + end + + def confirm_reject; end + + def reject + @claim.payment_not_approved! + + redirect_to claims_support_claims_payments_claim_path(@claim) + end private diff --git a/app/policies/claims/support/claims/payments/claim_policy.rb b/app/policies/claims/support/claims/payments/claim_policy.rb index 6ebfe3477..84961224d 100644 --- a/app/policies/claims/support/claims/payments/claim_policy.rb +++ b/app/policies/claims/support/claims/payments/claim_policy.rb @@ -2,4 +2,28 @@ class Claims::Support::Claims::Payments::ClaimPolicy < Claims::ApplicationPolicy def update? false end + + def confirm_information_sent? + information_sent? + end + + def information_sent? + record.payment_information_requested? + end + + def confirm_paid? + paid? + end + + def paid? + record.payment_information_sent? + end + + def confirm_reject? + reject? + end + + def reject? + record.payment_information_requested? || record.payment_information_sent? + end end diff --git a/app/views/claims/support/claims/payments/claims/confirm_information_sent.html.erb b/app/views/claims/support/claims/payments/claims/confirm_information_sent.html.erb new file mode 100644 index 000000000..cc7c8c876 --- /dev/null +++ b/app/views/claims/support/claims/payments/claims/confirm_information_sent.html.erb @@ -0,0 +1,21 @@ +<%= render "claims/support/primary_navigation", current: :claims %> +<% content_for(:page_title) { sanitize t(".page_title") } %> + +<% content_for(:before_content) do %> + <%= govuk_back_link href: claims_support_claims_payments_path %> +<% end %> + +
<%= t(".description") %>
+ + <%= govuk_button_to t(".submit"), information_sent_claims_support_claims_payments_claim_path(@claim), method: :put %> + +<%= govuk_link_to t(".cancel"), claims_support_claims_payments_path %>
+<%= t(".description") %>
+ + <%= govuk_button_to t(".submit"), information_sent_claims_support_claims_payments_claim_path(@claim), method: :put %> + +<%= govuk_link_to t(".cancel"), claims_support_claims_payments_path %>
+<%= t(".description") %>
+ + <%= govuk_button_to t(".submit"), information_sent_claims_support_claims_payments_claim_path(@claim), method: :put %> + +<%= govuk_link_to t(".cancel"), claims_support_claims_payments_path %>
+<%= t(".submitted_by", name: @claim.submitted_by.full_name, date: l(@claim.submitted_on, format: :long)) %>
<% end %> diff --git a/config/locales/en/claims/support/claims/payments/claims.yml b/config/locales/en/claims/support/claims/payments/claims.yml index 07cfdce02..ff8108e18 100644 --- a/config/locales/en/claims/support/claims/payments/claims.yml +++ b/config/locales/en/claims/support/claims/payments/claims.yml @@ -12,3 +12,25 @@ en: mentor_with_index: Mentor %{index} mentor: Mentor submitted_by: Submitted by %{name} on %{date}. + buttons: + information_sent: Confirmation information sent + paid: Confirm claim paid + reject: Reject claim + confirm_information_sent: + page_caption: Payments - Claim %{reference} + page_title: Are you sure you want to update the claim? + description: You confirm that you have sent the ESFA the information they requested so they can pay the claim. + submit: Update claim + cancel: Cancel + confirm_paid: + page_caption: Payments - Claim %{reference} + page_title: Are you sure you want to update the claim? + description: This will mark the claim as ‘Paid’. + submit: Update claim + cancel: Cancel + confirm_reject: + page_caption: Payments - Claim %{reference} + page_title: Are you sure you want to reject the claim? + description: This will result in this claim not being paid. + submit: Reject claim + cancel: Cancel diff --git a/config/routes/claims.rb b/config/routes/claims.rb index c027ffbd0..378c744db 100644 --- a/config/routes/claims.rb +++ b/config/routes/claims.rb @@ -85,7 +85,18 @@ namespace :claims do namespace :payments do - resources :claims, only: %i[show] + resources :claims, only: %i[show] do + member do + get :confirm_information_sent, path: "information-sent" + put :information_sent, path: "information-sent" + + get :confirm_paid, path: "paid" + put :paid, path: "paid" + + get :confirm_reject, path: "reject" + put :reject, path: "reject" + end + end end resources :payments, only: %i[index new create]