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

feat: Add payment exemption status to Slack notifications #2251

Merged
merged 7 commits into from
Oct 2, 2023

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Oct 1, 2023

What does this PR do?

  • Refactors webhooks directory into modular structure
  • Untouched files moved to an _old directory temporarily - I'll pick these up very shortly
  • Appends "[Exempt]" to Slack messages where application.fee.payable === 0

@@ -1,10 +1,10 @@
import supertest from "supertest";
import app from "../server";
import { createScheduledEvent } from "../hasura/metadata";
import app from "../../../server";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If the new API structure leads to a lot of long/messy relative import paths we could look at resolving this with path aliases - https://blog.logrocket.com/using-path-aliases-cleaner-react-typescript-imports/

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ChatGPT generated this for me based on the Zod schema 🤖 It just needed a small tidy up after.

Comment on lines 19 to 21
const sessionId = getSessionIdFromEvent(data, type);
const feePayable = await getFeePayableForSession(sessionId);
if (!feePayable) message += " [Exempt]";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR ended up being more refactor than feature sorry, but this is the core of the new work.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little hesitant about this (!feePayable) logic because our most recent bug around this was actually content incorrectly setting fee payable to 0 regardless of exempt/resubmission answers. I think this change would have actually incorrectly labeled those cases [Exempt] and we perhaps wouldn't have caught that as quick?

My hunch is something like this will be more reliable / robust:

  • Regardless of application.fee.payable & application.fee.calculated...
  • If application.fee.exemption.disability is true then message += " [Exempt]"
  • If application.fee.exemption.resubmission is true then message += " [Resubmission]"
  • ** Exemptions are asked about via a Question node so you'll want to do Boolean({field}[0]) to evaluate

So, the only cases going forward where we'd manually look into a case are:

  • Missing payment notification && submission notification does not have [Exempt] or [Resubmission] suffix

Does this make sense?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a really helpful comment thanks 👍 I'll go ahead and make this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR updated with these changes @jessicamcinchak 👌

@github-actions
Copy link

github-actions bot commented Oct 1, 2023

Removed vultr server and associated DNS entries

@DafyddLlyr DafyddLlyr force-pushed the dp/slack-report-exemptions branch from ef81717 to 2f33404 Compare October 2, 2023 11:39
@DafyddLlyr DafyddLlyr force-pushed the dp/slack-report-exemptions branch from 2f33404 to ad08273 Compare October 2, 2023 11:42
@DafyddLlyr DafyddLlyr marked this pull request as ready for review October 2, 2023 12:22
@DafyddLlyr DafyddLlyr merged commit 8fb8e06 into main Oct 2, 2023
12 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/slack-report-exemptions branch October 2, 2023 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants