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(fee-breakdown): Make Pay component data field a static value #4058

Merged
merged 3 commits into from
Dec 9, 2024

Conversation

DafyddLlyr
Copy link
Contributor

@DafyddLlyr DafyddLlyr commented Dec 9, 2024

What?

Makes the data.fn value of the Pay component a hard-coded variable - application.fee.payable

Why?

This is relied upon when working out the fee breakdown, as well as in the payload mapping. All real services are using this value and this matches the pattern for other variable like addresses where we need a single static passport key.

@DafyddLlyr DafyddLlyr marked this pull request as draft December 9, 2024 13:16
Copy link

github-actions bot commented Dec 9, 2024

Removed vultr server and associated DNS entries

@@ -69,9 +69,9 @@ const Component: React.FC<Props> = (props: Props) => {
<Input
format="data"
name="fn"
value={values.fn}
value={PASSPORT_FN}
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 should mean that any existing services with a value other and application.fee.payable just need the node to be saved to update this.

In reality, these would just be test services so I don't think there's a need for anything more sophisticated here such as a validation check or data migration.

Copy link
Member

Choose a reason for hiding this comment

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

Confirmed that a legacy, un-updated Pay component still knows how to read/display correct amount: https://4058.planx.pizza/testing/pay-test 👍

And modal looks correct for next "Update"/"Save"

Copy link
Member

@jessicamcinchak jessicamcinchak left a comment

Choose a reason for hiding this comment

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

In support of this 🙌

@@ -69,9 +69,9 @@ const Component: React.FC<Props> = (props: Props) => {
<Input
format="data"
name="fn"
value={values.fn}
value={PASSPORT_FN}
placeholder="Data field for calculated amount"
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we also remove this confusing placeholder (eg "calculated" not "payable" language) since will never be seen now?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good catch! Removed 🗑️

@@ -10,12 +10,14 @@ import { array, boolean, object, string } from "yup";

import { type BaseNodeData, parseBaseNodeData } from "../shared";

export const PASSPORT_FN = "application.fee.payable" as const;
Copy link
Member

Choose a reason for hiding this comment

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

nit: can we rename to PAY_FN so more clear if/when exported/imported beyond this component? (Eg tests, etc). Already have a few DEFAULT_FN etc that I notice that we're commonly re-naming when importing elsewhere.

@@ -69,9 +69,9 @@ const Component: React.FC<Props> = (props: Props) => {
<Input
format="data"
name="fn"
value={values.fn}
value={PASSPORT_FN}
Copy link
Member

Choose a reason for hiding this comment

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

Confirmed that a legacy, un-updated Pay component still knows how to read/display correct amount: https://4058.planx.pizza/testing/pay-test 👍

And modal looks correct for next "Update"/"Save"

@DafyddLlyr DafyddLlyr merged commit 66a9fef into main Dec 9, 2024
12 checks passed
@DafyddLlyr DafyddLlyr deleted the dp/static-pay-fn branch December 9, 2024 16:44
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