mirror of
https://github.com/Litlyx/litlyx
synced 2025-12-12 00:38:36 +01:00
Services rewrite
This commit is contained in:
21
dashboard/server/api/pay/[project_id]/customer_info.ts
Normal file
21
dashboard/server/api/pay/[project_id]/customer_info.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import { getUserProjectFromId } from "~/server/LIVE_DEMO_DATA";
|
||||
import StripeService from '~/server/services/StripeService';
|
||||
|
||||
|
||||
export default defineEventHandler(async event => {
|
||||
|
||||
const project_id = getRequestProjectId(event);
|
||||
if (!project_id) return;
|
||||
|
||||
const user = getRequestUser(event);
|
||||
const project = await getUserProjectFromId(project_id, user, false);
|
||||
if (!project) return;
|
||||
|
||||
if (!project.customer_id) return;
|
||||
|
||||
const customer = await StripeService.getCustomer(project.customer_id);
|
||||
if (customer?.deleted) return;
|
||||
|
||||
return customer?.address;
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user