Skip to content
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 src/components/ButtonStripe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default function ButtonStripe(props: {
{ price: props.price_id, quantity: 1 },
],
mode: "subscription",
clientReferenceId: props.donorname + sep + props.forumname,
clientReferenceId: (props.donorname || "") + sep + (props.forumname || ""),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

While this is fine, you might want to use ?? in the future, as there is a slight difference.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks for the hint, I don't have that much JS experience. What would the difference be in this case?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

successUrl: process.env.GATSBY_SITEURL + "/donate/success-stripe",
cancelUrl: process.env.GATSBY_SITEURL + "/donate",
});
Expand Down
10 changes: 2 additions & 8 deletions src/pages/donate/by-stripe.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,11 @@ export default class PageStripe extends React.Component {
const handleOneTimeClick = async event => {
// When the customer clicks on the button, redirect them to Checkout.
let sep = "\u2028";
let donorname = "";
if (this.state.otPrice === "" || !/^\d+$/.test(this.state.otPrice)) {
return;
}
if (this.state.donor != "") {
donorname = this.state.donor;
}
let forumname = "";
if (this.state.forum != "") {
forumname = this.state.forum;
}
let donorname = this.state.donor || "";
let forumname = this.state.forum || "";
let current_datetime = new Date();
const stripe = await stripePromise;
const { error } = await stripe.redirectToCheckout({
Expand Down