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

[MBL-1273] Implement Create Checkout Mutation #1982

Merged
merged 7 commits into from Mar 18, 2024

Conversation

scottkicks
Copy link
Contributor

@scottkicks scottkicks commented Mar 18, 2024

📲 What

When the CTA on Confirm Details is pressed, call CreateCheckout

🤔 Why

The ValidateCheckout Mutation that will be called on the checkout screen needs a checkoutId returned from this mutation. We'll call it here and if successful navigate to the checkout screen, passing along the checkoutId.

🛠 How

The checkout screen isn't complete yet so there's nothing to navigate to, but we can wire this new mutation up in the meantime.

✅ Acceptance criteria

  • Call mutation on CTA Tap
  • If there was an error, show the error message banner
  • If successful, print for now. We'll navigate later

⏰ TODO

  • Navigate to Checkout screen when mbl-1210 is ready

@scottkicks scottkicks marked this pull request as ready for review March 18, 2024 21:42

return CreateCheckoutInput(
projectId: project.graphID,
amount: "\(pledgeTotal)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Presumably pledgeTotal is a double - does it need to be formatted in a specific way for the server? My concern would be that the automatic printer might output "7" or "7.0" or "7.000000001" and the server might expect a specific number of decimal places.

return CreateCheckoutInput(
projectId: project.graphID,
amount: "\(pledgeTotal)",
locationId: "\(project.location.id)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Unconcerned about this one because it's an int.

Copy link
Contributor

@amy-at-kickstarter amy-at-kickstarter left a comment

Choose a reason for hiding this comment

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

This LGTM, but only assuming that the print for pledgeTotal gives you something consistent/sane.

I'd recommend using a more specific print formatter like String.format("%.2d", pledgeTotal) or NumberFormatter so that you're guaranteed consistent results; I'd also be fine with it if there's documentation that proves this doesn't matter (either on the GraphQL side or the Swift side).

I don't know how clever the GraphQL parser is about numeric types, nor how clever Swift wants to be, I just trust neither 😉

@scottkicks scottkicks merged commit 0710a84 into main Mar 18, 2024
5 checks passed
@scottkicks scottkicks deleted the scott/pcb/create-checkout-implementation branch March 18, 2024 23:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants