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

Update ECE expressPaymentType #448

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/types/src/valid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -870,7 +870,7 @@ expressCheckoutElement
}) => {}
);
Copy link
Contributor

Choose a reason for hiding this comment

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

It might be worth adding validation for the click event here as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe that's taken care of with StripeExpressCheckoutElementClickEvent!


expressCheckoutElement.on('confirm', ({paymentFailed}) => {
expressCheckoutElement.on('confirm', ({paymentFailed, expressPaymentType}) => {
paymentFailed();
paymentFailed({});
paymentFailed({reason: 'invalid_shipping_address'});
Expand Down
6 changes: 3 additions & 3 deletions types/stripe-js/elements/express-checkout.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ export type StripeExpressCheckoutElement = StripeElementBase & {
): StripeExpressCheckoutElement;
};

export type PaymentMethodType = 'google_pay' | 'apple_pay' | 'link';
export type ExpressPaymentType = 'google_pay' | 'apple_pay' | 'link' | 'paypal';

export type ExpressCheckoutPartialAddress = {
city: string;
Expand Down Expand Up @@ -420,7 +420,7 @@ export interface StripeExpressCheckoutElementClickEvent {
/**
* The payment method associated with the button that was clicked.
*/
paymentMethodType: PaymentMethodType;
expressPaymentType: ExpressPaymentType;

/**
* Callback to configure the details shown on a payment interface, including which fields to collect.
Expand All @@ -443,7 +443,7 @@ export interface StripeExpressCheckoutElementConfirmEvent {

shippingRate?: ShippingRate;

paymentMethodType: PaymentMethodType;
expressPaymentType: ExpressPaymentType;
}

export type ChangeResolveDetails = {
Expand Down