Skip to content

Commit

Permalink
fix onValidationError not firing for client onchange (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeyarpaing authored Aug 27, 2024
1 parent 7545988 commit 93a1959
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion example/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/components/form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ const ElementsForm: FC<ElementsFormProps> = (props) => {

if (onLoadError) onLoadError(eventPayload.message);
} else if (eventType === EventType.enum.VALIDATION_ERROR) {
if (extraData?.checkoutPaymentMethod.provider === 'credit_card') {
const provider = extraData?.checkoutPaymentMethod.provider;
if (provider === 'credit_card' || provider === undefined) {
console.error(`[form] Validation error for ${eventPayload.elementType}:`, eventPayload.errors);
if (onValidationError) onValidationError(eventPayload.elementType, eventPayload.errors, elementId);
}
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 93a1959

Please sign in to comment.