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

Add component for payButton element #344

Merged
merged 4 commits into from
Nov 15, 2022
Merged

Add component for payButton element #344

merged 4 commits into from
Nov 15, 2022

Conversation

awalker-stripe
Copy link
Contributor

@awalker-stripe awalker-stripe commented Nov 12, 2022

Summary & motivation

Adds component for the payButton element.

Testing & documentation

Performed manual testing using a local React project.

@awalker-stripe awalker-stripe marked this pull request as ready for review November 14, 2022 22:53
@@ -10,6 +10,7 @@ import {
PaymentRequestButtonElementComponent,
CartElementComponent,
} from '../types';
import {PayButtonElement} from '..';
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we instead do import PayButtonElementComponent in the above import line?

Comment on lines 554 to 572
it('propagates the Element`s lineitemclick event to the current onConfirm prop', () => {
const mockHandler = jest.fn();
const mockHandler2 = jest.fn();
const {rerender} = render(
<Elements stripe={mockStripe}>
<PayButtonElement onConfirm={mockHandler} />
</Elements>
);
rerender(
<Elements stripe={mockStripe}>
<PayButtonElement onConfirm={mockHandler2} />
</Elements>
);

const confirmEventMock = Symbol('lineitemclick');
simulateConfirm(confirmEventMock);
expect(mockHandler2).toHaveBeenCalledWith(confirmEventMock);
expect(mockHandler).not.toHaveBeenCalled();
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe an accidental copy-paste?

Copy link
Contributor Author

@awalker-stripe awalker-stripe Nov 14, 2022

Choose a reason for hiding this comment

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

oops, good catch, ty!

/**
* Triggered when a buyer authorizes a payment within a supported payment method.
*/
onConfirm: (event: stripeJs.StripePayButtonElementConfirmEvent) => any;
Copy link
Contributor

Choose a reason for hiding this comment

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

nice :)

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