-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
fix: booking_paid webhook and added new payment metadata #11093
fix: booking_paid webhook and added new payment metadata #11093
Conversation
CAL-2328 Add more data to booking_paid webhook
We can add { stripePaymentId, stripeCustomerId, providerId: "cal.com", userId, eventName, eventId } |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
2 Ignored Deployments
|
Thank you for following the naming conventions! 🙏 |
await Promise.all(promises); | ||
|
||
if (paid) { |
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.
Added a whole section when receiving paid flag here
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.
How about refactoring it out to a handlePaidEventConfirmation
function
triggerEvent: WebhookTriggerEvents.BOOKING_PAID, | ||
teamId: booking.eventType?.teamId, | ||
}); | ||
const bookingWithPayment = await prisma.booking.findFirst({ |
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.
Gather all required information
bookerEmail: evt.attendees[0].email, | ||
eventTitle: booking.eventType?.title, | ||
externalId: paymentExternalId, | ||
}; |
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.
Declare new metadata for payment
); | ||
|
||
// I don't need to await for this | ||
Promise.all(bookingPaidSubscribers); |
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.
Don't await to complete this
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.
We don't need to do a Promise.all I guess, if we aren't waiting for the results.
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.
We don't need to do a Promise.all I guess, if we aren't waiting for the results.
It's ok, we want them to start in parallel instead of cascading even if we don't wait for the response
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.
But calls would go in parallel already due to line 380. We don't need the result of any of those promises. So we don't need line number 400 at all.
📦 Next.js Bundle Analysis for @calcom/webThis analysis was generated by the Next.js Bundle Analysis action. 🤖 This PR introduced no changes to the JavaScript bundle! 🙌 |
Current Playwright Test Results Summary✅ 117 Passing - Run may still be in progress, this comment will be updated as current testing workflow or job completes... (Last updated on 09/05/2023 05:56:01am UTC) Run DetailsRunning Workflow PR Update on Github Actions Commit: 0dc1fe8 Started: 09/05/2023 05:54:19am UTC
|
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Stripe integration Can book a paid booking
Retry 1 • Initial Attempt |
6.45% (18)18 / 279 runsfailed over last 7 days |
9.32% (26)26 / 279 runsflaked over last 7 days |
📄 apps/web/playwright/webhook.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
FORM_SUBMITTED on submitting user form, triggers user webhook
Retry 1 • Initial Attempt |
0% (0)0 / 3 runsfailed over last 7 days |
33.33% (1)1 / 3 runflaked over last 7 days |
📄 packages/embeds/embed-core/playwright/tests/action-based.e2e.ts • 1 Flake
Test Case Results
Test Case | Last 7 days Failures | Last 7 days Flakes |
---|---|---|
Popup Tests should be able to reschedule
Retry 1 • Initial Attempt |
6.03% (17)17 / 282 runsfailed over last 7 days |
92.91% (262)262 / 282 runsflaked over last 7 days |
I will be soon opening a PR to handle firing BOOKING_CREATED webhook and others for paid events as per #7120. I was going to add BOOKING_PAYMENT_SUCCESSFUL as well event which you already handled here as BOOKING_PAID |
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.
Seems to fix the issue. I feel this can be improved upon. But good enough for now. Nice job @alannnc
* Pass organization name & logo * Overflow hidden * Show org icon on public page * Add org logo to large user avatars * Clean up * Add org name and logo to context * Get org logo from /avatar.png endpoint * Do not query for logo * Remove name and logo from session middleware * Type fix * Set user onboarding org logo * feat: organization avatar component (#10788) Co-authored-by: sean-brydon <[email protected]> * Type fixes * Type fix * Transition to org slug for organization avatar * Address feedback * Clean up * Clean up * Type fix * fix: set avatar cache control (#11163) * test: Integration tests for handleNewBooking (#11044) Co-authored-by: Shivam Kalra <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> * fix: booking_paid webhook and added new payment metadata (#11093) * app store improvements, logos, dark mode, added screenshots, fixed author names (#11164) * fix: mobile event types and avatars (#11184) * New Crowdin translations by Github Action * fix: updateProfile metadata overwrite (#11188) Co-authored-by: alannnc <[email protected]> * New Crowdin translations by Github Action --------- Co-authored-by: Sean Brydon <[email protected]> Co-authored-by: sean-brydon <[email protected]> Co-authored-by: Omar López <[email protected]> Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: Shivam Kalra <[email protected]> Co-authored-by: alannnc <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Leo Giovanetti <[email protected]> Co-authored-by: Crowdin Bot <[email protected]>
* Pass organization name & logo * Overflow hidden * Show org icon on public page * Add org logo to large user avatars * Clean up * Add org name and logo to context * Get org logo from /avatar.png endpoint * Do not query for logo * Remove name and logo from session middleware * Type fix * Set user onboarding org logo * feat: organization avatar component (calcom#10788) Co-authored-by: sean-brydon <[email protected]> * Type fixes * Type fix * Transition to org slug for organization avatar * Address feedback * Clean up * Clean up * Type fix * fix: set avatar cache control (calcom#11163) * test: Integration tests for handleNewBooking (calcom#11044) Co-authored-by: Shivam Kalra <[email protected]> Co-authored-by: Joe Au-Yeung <[email protected]> * fix: booking_paid webhook and added new payment metadata (calcom#11093) * app store improvements, logos, dark mode, added screenshots, fixed author names (calcom#11164) * fix: mobile event types and avatars (calcom#11184) * New Crowdin translations by Github Action * fix: updateProfile metadata overwrite (calcom#11188) Co-authored-by: alannnc <[email protected]> * New Crowdin translations by Github Action --------- Co-authored-by: Sean Brydon <[email protected]> Co-authored-by: sean-brydon <[email protected]> Co-authored-by: Omar López <[email protected]> Co-authored-by: Hariom Balhara <[email protected]> Co-authored-by: Shivam Kalra <[email protected]> Co-authored-by: alannnc <[email protected]> Co-authored-by: Peer Richelsen <[email protected]> Co-authored-by: Leo Giovanetti <[email protected]> Co-authored-by: Crowdin Bot <[email protected]>
What does this PR do?
Fixes #10679
https://www.loom.com/share/c0a54a80063841d5947917934c8eee6c?sid=bf913ef1-1219-4c2d-aee1-f40f9ebd43b4
Requirement/Documentation
Type of change
How should this be tested?
Mandatory Tasks
Checklist