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.

Update utils.ts

Kiran K8748d0b9f45c
diff --git a/apps/web/app/api/cron/invoices/utils.ts b/apps/web/app/api/cron/invoices/utils.ts
index e138b11c85..2f833a0fb3 100644
--- a/apps/web/app/api/cron/invoices/utils.ts
+++ b/apps/web/app/api/cron/invoices/utils.ts
@@ -66,7 +66,7 @@ export const processInvoice = async ({ invoiceId }: { invoiceId: string }) => {
}
try {
- const { latest_charge } = await stripe.paymentIntents.create({
+ const { status, latest_charge } = await stripe.paymentIntents.create({
amount: invoice.total,
customer: workspace.stripeId,
payment_method: invoice.paymentMethodId,
@@ -78,6 +78,11 @@ export const processInvoice = async ({ invoiceId }: { invoiceId: string }) => {
description: "Payout from Dub Partners",
});
+ // TODO:
+ // Handle different statuses
+
+ console.log("Payment intent created", { status, latest_charge });
+
// Create transfers for each partners
// TODO (Kiran): Need to optimize this when we have large number of payouts for an invoice.
for (const payout of payouts) {
@@ -97,6 +102,8 @@ export const processInvoice = async ({ invoiceId }: { invoiceId: string }) => {
description: "Stripe Payout",
});
+ console.log("Transfer created", transfer);
+
await prisma.payout.update({
where: {
id: payout.id,