Compare commits
6 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d73532054 | |||
| dcf5740489 | |||
| e15977ba82 | |||
| 4079ed9d26 | |||
| 1cc708e6b4 | |||
| 6b300626a0 |
@@ -35,12 +35,6 @@ portalRouter.get("/me", async (c) => {
|
|||||||
return c.json({ id: client.id, name: client.name, email: client.email, phone: client.phone });
|
return c.json({ id: client.id, name: client.name, email: client.email, phone: client.phone });
|
||||||
});
|
});
|
||||||
|
|
||||||
portalRouter.get("/config", async (c) => {
|
|
||||||
return c.json({
|
|
||||||
stripePublishableKey: process.env.STRIPE_PUBLISHABLE_KEY ?? "",
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
portalRouter.get("/services", async (c) => {
|
portalRouter.get("/services", async (c) => {
|
||||||
const db = getDb();
|
const db = getDb();
|
||||||
const allServices = await db.select().from(services).where(eq(services.active, true));
|
const allServices = await db.select().from(services).where(eq(services.active, true));
|
||||||
@@ -129,7 +123,7 @@ portalRouter.get("/invoices", async (c) => {
|
|||||||
id: inv.id,
|
id: inv.id,
|
||||||
status: inv.status,
|
status: inv.status,
|
||||||
totalCents: inv.totalCents,
|
totalCents: inv.totalCents,
|
||||||
date: inv.createdAt,
|
createdAt: inv.createdAt,
|
||||||
lineItems: (itemsByInvoice[inv.id] || []).map(li => ({ id: li.id, description: li.description, quantity: li.quantity, unitPriceCents: li.unitPriceCents, totalCents: li.totalCents })),
|
lineItems: (itemsByInvoice[inv.id] || []).map(li => ({ id: li.id, description: li.description, quantity: li.quantity, unitPriceCents: li.unitPriceCents, totalCents: li.totalCents })),
|
||||||
})));
|
})));
|
||||||
});
|
});
|
||||||
@@ -459,6 +453,7 @@ portalRouter.delete("/waitlist/:id", async (c) => {
|
|||||||
import {
|
import {
|
||||||
createPaymentIntent,
|
createPaymentIntent,
|
||||||
listPaymentMethods,
|
listPaymentMethods,
|
||||||
|
attachPaymentMethod,
|
||||||
detachPaymentMethod,
|
detachPaymentMethod,
|
||||||
createSetupIntent,
|
createSetupIntent,
|
||||||
getOrCreateStripeCustomer,
|
getOrCreateStripeCustomer,
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
import { loadStripe } from "@stripe/stripe-js";
|
import { loadStripe, type Stripe } from "@stripe/stripe-js";
|
||||||
import { Elements, PaymentElement, useStripe, useElements } from "@stripe/react-stripe-js";
|
import { Elements, PaymentElement, useStripe, useElements } from "@stripe/react-stripe-js";
|
||||||
import { CreditCard, DollarSign, Package, Zap } from "lucide-react";
|
import { CreditCard, DollarSign, Package, Zap } from "lucide-react";
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@ interface BillingPaymentsProps {
|
|||||||
function BillingPaymentsInner({ sessionId, readOnly }: BillingPaymentsProps) {
|
function BillingPaymentsInner({ sessionId, readOnly }: BillingPaymentsProps) {
|
||||||
const [invoices, setInvoices] = useState<Invoice[]>([]);
|
const [invoices, setInvoices] = useState<Invoice[]>([]);
|
||||||
const [paymentMethods, setPaymentMethods] = useState<PaymentMethod[]>([]);
|
const [paymentMethods, setPaymentMethods] = useState<PaymentMethod[]>([]);
|
||||||
const [packages] = useState<{ name: string; remaining: number }[]>([]);
|
const [packages, setPackages] = useState<{ name: string; remaining: number }[]>([]);
|
||||||
const [loading, setLoading] = useState(true);
|
const [loading, setLoading] = useState(true);
|
||||||
const [error, setError] = useState<string | null>(null);
|
const [error, setError] = useState<string | null>(null);
|
||||||
const [tab, setTab] = useState<"invoices" | "payment" | "packages">("invoices");
|
const [tab, setTab] = useState<"invoices" | "payment" | "packages">("invoices");
|
||||||
@@ -398,10 +398,7 @@ function PaymentModal({ sessionId, pending, onClose, onSuccess }: PaymentModalPr
|
|||||||
const { error: stripeError } = await stripe.confirmPayment({
|
const { error: stripeError } = await stripe.confirmPayment({
|
||||||
elements,
|
elements,
|
||||||
clientSecret,
|
clientSecret,
|
||||||
confirmParams: {
|
confirmParams: saveCard ? { setup_future_usage: "off_session" } : undefined,
|
||||||
return_url: `${window.location.origin}/portal/billing`,
|
|
||||||
...(saveCard ? { setup_future_usage: "off_session" } : {}),
|
|
||||||
},
|
|
||||||
});
|
});
|
||||||
|
|
||||||
if (stripeError) {
|
if (stripeError) {
|
||||||
|
|||||||
Reference in New Issue
Block a user