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

refactor: update message object to accept array offer param and send offer as string #2392

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

perco12
Copy link

@perco12 perco12 commented May 16, 2024

Description

Ensures that the message object offer input remains an array but output results in message having offer property as a comma-delimited string

Why are we making these changes? Include references to any related Jira tasks or GitHub Issues

Reproduction Steps (if applicable)

Screenshots (if applicable)

Dependent Changes (if applicable)

Groups who should review (if applicable)

❤️ Thank you!

src/ui/buttons/props.js Outdated Show resolved Hide resolved
@perco12 perco12 marked this pull request as ready for review May 28, 2024 15:50
@perco12 perco12 requested a review from a team as a code owner May 28, 2024 15:50
@@ -430,7 +430,7 @@ export type ApplePaySessionConfigRequest = (

export type ButtonMessage = {|
amount?: number,
offer?: $ReadOnlyArray<$Values<typeof MESSAGE_OFFER>>,
offer?: $Values<typeof MESSAGE_OFFER> | string,
Copy link
Member

Choose a reason for hiding this comment

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

if this is going to be a comma separated string, should the type just be string?

Copy link
Author

Choose a reason for hiding this comment

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

that is a good call, as the join statement makes the output a generic string, instead of our strict flow type.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this may be meant to be $ReadOnlyArray<$Values<typeof MESSAGE_OFFER>> | string since we want to accept the input as both and array or comma-delimited string. The merchant input will be ["a", "b"] vs "a,b" for better ergonomics. We convert it internally to a comma-delimited string so that we pass it to the endpoint as a string to get around the zoid dotify encoding issue.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh apologies. I misspoke and got my wires crossed. ButtonMessage is the output of the function and not the input. 😅 My comment above can be disregarded.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants