Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ESFA payment response flow #1276

Merged
merged 1 commit into from
Jan 6, 2025
Merged

Conversation

Nitemaeric
Copy link
Contributor

@Nitemaeric Nitemaeric commented Dec 31, 2024

Context

Once we've sent out the claims to ESFA to be paid, we want to update their status when ESFA sends a response CSV file.

We need to store a record of these to show a claims activity record of action "payment_response_uploaded".

Changes proposed in this pull request

  • Add "Upload ESFA response" flow.
  • Add Claims::PaymentResponse model to store the response CSV file onto a Claims::ClaimActivity record.
  • Add a Claims::PaymentResponse::Process service to process the uploaded CSV file.
  • Add Claims::Claim#unpaid_reason field.
  • Show the unpaid reason in the payments claims show page.

Guidance to review

  • I have tried the following approaches and both run into issues:

    1. Don't add/use a processed attribute and cleanup cron job on payment responses.

      The issue with this approach is the passing of the csv_file from the new page to the check page. We need to show how many rows are present in the CSV, therefore we need to store it.

      The read value of the #csv_file attachment is of type ActiveStorage::Attached::One, therefore we can't pass it through via memory. There is also the possibility of the first and second request hitting different pods.

    2. Use a form object.

      Using a form object without the processed attribute runs us into a very similar issue as above, the difference is that the csv_file field is serialized to a string via an implicit #to_s call. Once the csv_file field value is read on the create (prior to the implementation of check going to update), it is read as a string, not a file, and raises an error when attempted to be saved to Active Storage.

Note

Individual payment actions on their show pages will be added in an upcoming PR.

  • Create some submitted claims.
  • Send submitted claims to ESFA.
  • Go to the activity log.
  • Download the CSV of claims sent to ESFA.
  • Update the status and optionally add a claim_unpaid_reason in the CSV.
  • Upload that CSV.

Screenshots

Action button

CleanShot 2024-12-31 at 17 07 12@2x

Upload form

CleanShot 2024-12-31 at 17 06 35@2x

Check page

CleanShot 2024-12-31 at 17 07 43@2x

Success notification

CleanShot 2024-12-31 at 17 08 01@2x

Activity log

CleanShot 2024-12-31 at 17 13 08@2x

Claim details

CleanShot 2025-01-02 at 11 03 44@2x

@Nitemaeric Nitemaeric added the deploy A Review App will be created for PRs with this label label Dec 31, 2024
@Nitemaeric Nitemaeric self-assigned this Dec 31, 2024
Copy link

github-actions bot commented Dec 31, 2024

Review app track and pay deployed to https://track-and-pay-1276.test.teacherservices.cloud was deleted
Review app school placements deployed to https://manage-school-placements-1276.test.teacherservices.cloud was deleted

@Nitemaeric Nitemaeric merged commit b858518 into main Jan 6, 2025
8 checks passed
@Nitemaeric Nitemaeric deleted the dd/add-esfa-response-flow branch January 6, 2025 09:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy A Review App will be created for PRs with this label
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants