-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0f91cf2
commit 1a23b79
Showing
28 changed files
with
193 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.govuk-tag { | ||
max-width: unset; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
app/controllers/claims/support/payments/confirmations_controller.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
class Claims::Support::Payments::ConfirmationsController < Claims::Support::ApplicationController | ||
before_action :authorize_payment | ||
|
||
def create | ||
Claims::Payment::ParseConfirmation.call(file: file_param) | ||
|
||
redirect_to claims_support_payments_path, flash: { success: t(".success") } | ||
end | ||
|
||
private | ||
|
||
def file_param | ||
params.require(:file) | ||
end | ||
|
||
def authorize_payment | ||
authorize [Claims::Payment, :confirmation] | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
class Claims::Payment::ConfirmationPolicy < Claims::ApplicationPolicy | ||
def new? | ||
true | ||
end | ||
|
||
def create? | ||
Claims::Claim.where(status: %i[sent_to_esfa pending_esfa_check request_information]).any? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
class Claims::Payment::ParseConfirmation < ApplicationService | ||
def initialize(file:) | ||
@file = file | ||
end | ||
|
||
def call | ||
CSV.foreach(file, headers: true) do |row| | ||
next unless row["claim_status"].in? %w[paid unpaid] | ||
|
||
claim = Claims::Claim.find_by(reference: row["claim_reference"]) | ||
|
||
next unless claim.status.in? %w[sent_to_esfa pending_esfa_check request_information] | ||
|
||
if row["claim_status"] == "paid" | ||
claim.update!(status: :paid) | ||
elsif row["claim_status"] == "unpaid" | ||
claim.update!(status: :request_information, unpaid_reason: row["claim_unpaid_reason"]) | ||
end | ||
end | ||
end | ||
|
||
private | ||
|
||
attr_reader :file | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 7 additions & 0 deletions
7
app/views/claims/support/payments/confirmations/_new_confirmation.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<span class="govuk-caption-l"><%= t(".caption") %></span> | ||
<h1 class="govuk-heading-l"><%= t(".heading") %></h1> | ||
|
||
<%= form_with url: claims_support_payments_confirmations_path do |f| %> | ||
<%= f.govuk_file_field :file, label: { text: t(".label") }, accept: "text/csv" %> | ||
<%= f.govuk_submit t(".submit") %> | ||
<% end %> |
6 changes: 6 additions & 0 deletions
6
app/views/claims/support/payments/confirmations/_no_claims_sent_to_esfa.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<%= content_for :page_title, t(".heading") %> | ||
|
||
<span class="govuk-caption-l"><%= t(".caption") %></span> | ||
<h1 class="govuk-heading-l"><%= t(".heading") %></h1> | ||
|
||
<p class="govuk-body"><%= t(".description") %></p> |
21 changes: 21 additions & 0 deletions
21
app/views/claims/support/payments/confirmations/new.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<%= render "claims/support/primary_navigation", current: :claims %> | ||
<%= content_for(:before_content) do %> | ||
<%= govuk_back_link(href: claims_support_payments_path) %> | ||
<% end %> | ||
|
||
<div class="govuk-width-container" data-controller="filter"> | ||
<div class="govuk-grid-row"> | ||
<div class="govuk-grid-column-two-thirds"> | ||
<% if policy([Claims::Payment, :confirmation]).create? %> | ||
<%= render "new_confirmation" %> | ||
<% else %> | ||
<%= render "no_claims_sent_to_esfa" %> | ||
<% end %> | ||
|
||
<p class="govuk-body"> | ||
<%= govuk_link_to t(".cancel"), claims_support_payments_path %> | ||
</p> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,6 +86,7 @@ shared: | |
- reviewed | ||
- previous_revision_id | ||
- claim_window_id | ||
- unpaid_reason | ||
:schools: | ||
- id | ||
- urn | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
config/locales/en/claims/support/payments/confirmations.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
en: | ||
claims: | ||
support: | ||
payments: | ||
confirmations: | ||
new: | ||
cancel: Cancel | ||
new_confirmation: | ||
caption: Payments | ||
heading: Upload response from ESFA | ||
label: Upload a file | ||
submit: Continue | ||
no_claims_sent_to_esfa: | ||
caption: Payments | ||
heading: You cannot upload a response from the ESFA | ||
description: You cannot upload a response from the ESFA as there are no claims pending payment. | ||
create: | ||
success: ESFA response uploaded |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
db/migrate/20240918151025_add_paid_and_request_information_to_claim_status.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddPaidAndRequestInformationToClaimStatus < ActiveRecord::Migration[7.2] | ||
def change | ||
add_enum_value :claim_status, "paid" | ||
add_enum_value :claim_status, "request_information" | ||
end | ||
end |
6 changes: 6 additions & 0 deletions
6
db/migrate/20240918154306_add_pending_esfa_check_and_payment_not_approved_claim_statuses.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
class AddPendingESFACheckAndPaymentNotApprovedClaimStatuses < ActiveRecord::Migration[7.2] | ||
def change | ||
add_enum_value :claim_status, "pending_esfa_check" | ||
add_enum_value :claim_status, "payment_not_approved" | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
class AddUnpaidReasonToClaims < ActiveRecord::Migration[7.2] | ||
def change | ||
add_column :claims, :unpaid_reason, :string | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters