Skip to content

Commit

Permalink
Merge pull request #17839 from mozilla/FXA-7587-PayPal-Implement-onEr…
Browse files Browse the repository at this point in the history
…ror-and-onInit-hooks

feat(next): Add enabled and onError hooks to paypal component
  • Loading branch information
david1alvarez authored Oct 17, 2024
2 parents adaff7f + c24345d commit b575985
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions libs/payments/ui/src/lib/client/components/CheckoutForm/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import {
handleStripeErrorAction,
recordEmitterEventAction,
checkoutCartWithStripe,
finalizeCartWithError,
} from '@fxa/payments/ui/actions';
import { CartErrorReasonId } from '@fxa/shared/db/mysql/account/kysely-types';

interface CheckoutFormProps {
cmsCommonContent: {
Expand Down Expand Up @@ -260,6 +262,14 @@ export function CheckoutForm({
tagline: false,
}}
className="mt-6"
onError={async () => {
await finalizeCartWithError(
cart.id,
CartErrorReasonId.BASIC_ERROR
);
router.push('./error');
}}
disabled={loading || !formEnabled}
/>
) : (
<BaseButton
Expand Down

0 comments on commit b575985

Please sign in to comment.