-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
feature(functions): support twint #883
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Skipped Deployment
|
@@ -180,8 +180,8 @@ export class StripeEventHandler { | |||
* This is mainly for failed payments where we didn't create a user through the website directly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mkue, is this comment actually true?
In the webhooks logs from Stripe, it seems that the user doesn't exist for a successful twint payment. Where do you create the user? Is it a race condition, whatever is faster?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, this comment is wrong. The usual way for a user to get created is through the Stripe webhook.
And yes, it's technically a race condition. If a new user fills out the CreateUserForm before the Stripe webhook has been called (which should only happen if Stripe has a problem), then the user is created when the form is submitted. This is a very unlikely case, though.
I don't see how this can be avoided as we need to store the user info on form submit.
export const splitName = (name: string | undefined) => { | ||
if (!name) { | ||
return { | ||
firstname: undefined, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be safe, we could also use ''
here instead.
Visit the preview URL for this PR (updated for commit cce8e6b): https://si-admin-staging--pr883-ahee-optional-name-nv29fz30.web.app (expires Tue, 13 Aug 2024 07:02:04 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: b7b0969384059dce6ea8fad1ee1d1737e54e6676 |
Yes, this is correct. Theoretically, there could be a contributor without a name. This ensures that if a user makes a payment (on stripe form) but never fills out "our" form (asking for name) afterwards, they are still handled as a normal constributor. I guess 99% will fill out the form after payment anyway. There are rare cases where even the credit card company only provides the first name or only the last name. Making the |
The webhook importing twint charges throws an error:
The problem is, that we actively check if the user has a name field, which is not set for a twint payment.
public/shared/src/stripe/StripeEventHandler.ts
Line 183 in 77ac331
Since first and lastname are modelled as optional in our types, I assume we don't need them?