Skip to content

Conversation

@pbennett1-godaddy
Copy link
Collaborator

Summary

Summary

Refactors the GoDaddy express checkout flow to pass complete tax and discount calculation data to the confirmCheckout mutation instead of just total amounts. This enables the backend to receive full
calculation details including line-level adjustments and tax breakdowns.

Changes

Type System Updates

  • Added CalculatedAdjustments and CalculatedTaxes type exports in packages/react/src/types.ts:1057-1064
  • Updated GraphQL schema introspection with new input types for taxes and adjustments

Hook Refactoring

  • useGetPriceAdjustments (packages/react/src/components/checkout/discount/utils/use-get-price-adjustments.ts)
    • Changed return type from number | null | undefined to CalculatedAdjustments | null | undefined
    • Now returns full calculatedAdjustments object instead of just totalDiscountAmount.value
  • useGetTaxes (packages/react/src/components/checkout/taxes/utils/use-get-taxes.ts)
    • Changed return type to return full calculatedTaxes object instead of just totalTaxAmount

Express Checkout Component

Updated packages/react/src/components/checkout/payment/checkout-buttons/express/godaddy.tsx:

  • Replaced priceAdjustment state (number) with calculatedAdjustments state (object)
  • Added calculatedTaxes state to store full tax calculation data
  • Updated all discount amount references to use calculatedAdjustments?.totalDiscountAmount?.value
  • Updated all tax amount references to use calculatedTaxes?.totalTaxAmount?.value
  • Modified confirmCheckout call to pass calculatedTaxes and calculatedAdjustments objects
  • Removed deprecated taxTotal parameter (replaced with calculatedTaxes)

GraphQL Query Updates

Updated packages/react/src/lib/godaddy/checkout-queries.ts:

  • Uncommented and enabled full field selection in DraftOrderPriceAdjustmentsQuery
  • Now retrieves complete adjustment details including:
    • Line-level adjustments with descriptions, IDs, labels, and names
    • Total discount and fee amounts
    • Calculation line metadata

Schema Updates

Added new GraphQL input types in packages/react/src/lib/godaddy/checkout-env.ts:

  • CalculatedAdjustmentsInput - For passing discount/fee data
  • CalculatedAdjustmentInput - Individual adjustment details
  • CalculatedLineInput - Line-level adjustment data
  • CalculatedTaxesInput - For passing tax calculation data
  • TaxCalculatedLineInput - Line-level tax data
  • TaxAmountInput, TaxRateInput, TaxRateValueInput - Tax rate details
  • CalculationLineInput - Metadata for calculation lines

Impact

  • Express checkout now provides complete calculation context to the backend
  • Enables backend to validate and audit discount/tax calculations
  • Maintains backward compatibility (only adds optional fields to confirmCheckout)
  • No breaking changes to existing API contracts

Changeset

  • Changeset added (docs)

Test Plan

@pbennett1-godaddy pbennett1-godaddy self-assigned this Jan 30, 2026
@pbennett1-godaddy pbennett1-godaddy requested a review from a team as a code owner January 30, 2026 16:08
@changeset-bot
Copy link

changeset-bot bot commented Jan 30, 2026

⚠️ No Changeset found

Latest commit: d5f4d54

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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