Skip to content

Commit

Permalink
Add a new sign_out_user prop to zoid checkout component (#2262)
Browse files Browse the repository at this point in the history
* Add a new sign_out_user prop to zoid checkout component

* Add test coverage for sign_out_user prop
  • Loading branch information
jshawl authored Nov 1, 2023
1 parent fa83159 commit a19661e
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/zoid/checkout/component.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,12 @@ export function getCheckoutComponent(): CheckoutComponent {
required: false,
queryParam: true,
},

sign_out_user: {
type: "boolean",
queryParam: true,
required: false,
},
},

dimensions: ({ props }) => {
Expand Down
25 changes: 25 additions & 0 deletions test/integration/tests/checkout/happy.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,31 @@ describe(`paypal checkout component happy path`, () => {
});
});

it("should render checkout with sign_out_user=true to enable paying with a different account", () => {
return wrapPromise(({ expect, error }) => {
return runOnClick(() => {
const orderID = generateOrderID();

return window.paypal
.Checkout({
buttonSessionID: uniqueID(),
fundingSource: FUNDING.PAYPAL,
createOrder: expect("createOrder", () => orderID),
sign_out_user: true,
onApprove: expect("onApprove", (data) => {
if (data.currentUrl.indexOf(`sign_out_user=true`) === -1) {
throw new Error(
`Expected to find sign_out_user=true in url, got ${data.currentUrl}`
);
}
}),
onCancel: error("onCancel"),
})
.render("body");
});
});
});

it("should render checkout, and click the close button to close the window", () => {
return wrapPromise(({ expect, error }) => {
return runOnClick(() => {
Expand Down

0 comments on commit a19661e

Please sign in to comment.