Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix processPayoutInvoiceFailure

Steven Tey987651ed4ae0
diff --git a/apps/web/app/(ee)/api/stripe/webhook/utils/process-payout-invoice-failure.ts b/apps/web/app/(ee)/api/stripe/webhook/utils/process-payout-invoice-failure.ts
index 0e80c28f55..045a3dfa6e 100644
--- a/apps/web/app/(ee)/api/stripe/webhook/utils/process-payout-invoice-failure.ts
+++ b/apps/web/app/(ee)/api/stripe/webhook/utils/process-payout-invoice-failure.ts
@@ -102,22 +102,24 @@ export async function processPayoutInvoiceFailure({
waitUntil(
(async () => {
// Send email to the workspace users about the failed payout
- const emailData = workspace.users.map((user) => ({
- email: user.user.email!,
- workspace: {
- slug: workspace.slug,
- },
- program: {
- name: workspace.programs[0].name,
- },
- payout: {
- amount: charge.amount,
- ...(chargedFailureFee && {
- failureFee: PAYOUT_FAILURE_FEE_CENTS,
- cardLast4,
- }),
- },
- }));
+ const emailData = workspace.users
+ .filter((user) => user.user.email)
+ .map((user) => ({
+ email: user.user.email!,
+ workspace: {
+ slug: workspace.slug,
+ },
+ program: {
+ name: workspace.programs[0].name,
+ },
+ payout: {
+ amount: charge.amount,
+ ...(chargedFailureFee && {
+ failureFee: PAYOUT_FAILURE_FEE_CENTS,
+ cardLast4,
+ }),
+ },
+ }));
if (emailData.length === 0) {
console.log("No users found to send email, skipping...");
diff --git a/apps/web/lib/stripe/create-payment-intent.ts b/apps/web/lib/stripe/create-payment-intent.ts
index 31266c098c..8535c2b68d 100644
--- a/apps/web/lib/stripe/create-payment-intent.ts
+++ b/apps/web/lib/stripe/create-payment-intent.ts
@@ -54,7 +54,7 @@ export const createPaymentIntent = async ({
statement_descriptor: statementDescriptor,
description,
},
- idempotencyKey ? { idempotencyKey } : {},
+ idempotencyKey ? { idempotencyKey } : undefined,
);
console.log(