fix credit card on file indicator and adjust insurance/self-pay toggle#6802
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the EHR patient payments UI to keep the “card on file” indicator in sync after payment-related actions and refines the payer (insurance/self-pay/employer) toggle styling/behavior.
Changes:
- Added a refresh mechanism to re-fetch card-on-file status after closing the payment dialog and after successful payments.
- Adjusted post-payment flow to close the payment dialog once the payment appears, while receipt creation continues asynchronously.
- Updated the payer toggle button group styling and accessibility labeling.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…-screen-credit-card-on-file
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 2 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 1 out of 1 changed files in this pull request and generated 3 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| cancelled = true; | ||
| }; | ||
| }, [oystehrZambda, patient?.id, appointment?.id, cardOnFileRefreshCounter]); | ||
| void refetchCardOnFile(); |
There was a problem hiding this comment.
Don't you want to be doing this when the dialog opens? It could be a long time before it is reopened, and the data you fetch here could go stale before the next open.
There was a problem hiding this comment.
may be i'm not parsing, but usually after dialog closes is because they made some sort of change... i don't think i wanna do it on open?
| isFetched: cardOnFileKnown, | ||
| refetch: refetchCardOnFile, | ||
| } = useQuery({ | ||
| queryKey: ['card-on-file', patient?.id, appointment?.id], |
There was a problem hiding this comment.
The patient.id and the appointment.id are accessed safely in the query key, but then banged in the query fn. Should safely check for no value and just return false rather than hitting the zambda.
There was a problem hiding this comment.
updated to this:
useQuery({
queryKey: ['card-on-file', patient?.id, appointment?.id],
queryFn: async () => {
if (!oystehrZambda || !patient?.id || !appointment?.id) return false;
const result = await oystehrZambda.zambda.execute({
id: 'payment-methods-list',
beneficiaryPatientId: patient.id,
appointmentId: appointment.id,
});
return deriveCardOnFileStatus(result.output);
},
…e visually some