Stripe Integration

This commit is contained in:
2024-08-20 23:27:07 +02:00
parent 056db7b199
commit 48bff89526
28 changed files with 728 additions and 21 deletions

View File

@@ -255,6 +255,10 @@ export interface ModalResult {
accepted: boolean;
criteria?: BusinessListingCriteria | CommercialPropertyListingCriteria | UserListingCriteria;
}
export interface Checkout {
priceId: string;
email: string;
}
export function isEmpty(value: any): boolean {
// Check for undefined or null
if (value === undefined || value === null) {
@@ -294,7 +298,7 @@ export interface ValidationMessage {
field: string;
message: string;
}
export function createDefaultUser(email: string, firstname: string, lastname: string): User {
export function createDefaultUser(email: string, firstname: string, lastname: string, subscriptionPlan: 'free' | 'professional' | 'broker'): User {
return {
id: undefined,
email,
@@ -316,6 +320,11 @@ export function createDefaultUser(email: string, firstname: string, lastname: st
customerSubType: null,
created: new Date(),
updated: new Date(),
stripeCustomerId: null,
subscriptionId: null,
planActive: false,
planExpires: null,
subscriptionPlan: subscriptionPlan,
};
}
export function createDefaultCommercialPropertyListing(): CommercialPropertyListing {