stripe removed
This commit is contained in:
parent
36c5bd5dd6
commit
ec86ff8441
|
|
@ -1,4 +1,3 @@
|
||||||
import Stripe from 'stripe';
|
|
||||||
import { BusinessListing, CommercialPropertyListing, Sender, SortByOptions, SortByTypes, User } from './db.model';
|
import { BusinessListing, CommercialPropertyListing, Sender, SortByOptions, SortByTypes, User } from './db.model';
|
||||||
import { State } from './server.model';
|
import { State } from './server.model';
|
||||||
|
|
||||||
|
|
@ -409,8 +408,6 @@ export function createDefaultBusinessListing(): BusinessListing {
|
||||||
listingsCategory: 'business',
|
listingsCategory: 'business',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
export type StripeSubscription = Stripe.Subscription;
|
|
||||||
export type StripeUser = Stripe.Customer;
|
|
||||||
export type IpInfo = {
|
export type IpInfo = {
|
||||||
ip: string;
|
ip: string;
|
||||||
city: string;
|
city: string;
|
||||||
|
|
@ -424,8 +421,6 @@ export type IpInfo = {
|
||||||
export interface CombinedUser {
|
export interface CombinedUser {
|
||||||
keycloakUser?: KeycloakUser;
|
keycloakUser?: KeycloakUser;
|
||||||
appUser?: User;
|
appUser?: User;
|
||||||
stripeUser?: StripeUser;
|
|
||||||
stripeSubscription?: StripeSubscription;
|
|
||||||
}
|
}
|
||||||
export interface RealIpInfo {
|
export interface RealIpInfo {
|
||||||
ip: string;
|
ip: string;
|
||||||
|
|
|
||||||
|
|
@ -30,15 +30,14 @@
|
||||||
"@angular/platform-server": "^19.2.16",
|
"@angular/platform-server": "^19.2.16",
|
||||||
"@angular/router": "^19.2.16",
|
"@angular/router": "^19.2.16",
|
||||||
"@angular/ssr": "^19.2.16",
|
"@angular/ssr": "^19.2.16",
|
||||||
"@bluehalo/ngx-leaflet": "^18.0.2",
|
"@bluehalo/ngx-leaflet": "^19.0.0",
|
||||||
"@fortawesome/angular-fontawesome": "^0.15.0",
|
"@fortawesome/angular-fontawesome": "^1.0.0",
|
||||||
"@fortawesome/fontawesome-free": "^6.7.2",
|
"@fortawesome/fontawesome-free": "^6.7.2",
|
||||||
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
||||||
"@fortawesome/free-brands-svg-icons": "^6.7.2",
|
"@fortawesome/free-brands-svg-icons": "^6.7.2",
|
||||||
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
"@fortawesome/free-solid-svg-icons": "^6.7.2",
|
||||||
"@ng-select/ng-select": "^13.4.1",
|
"@ng-select/ng-select": "^14.9.0",
|
||||||
"@ngneat/until-destroy": "^10.0.0",
|
"@ngneat/until-destroy": "^10.0.0",
|
||||||
"@stripe/stripe-js": "^4.3.0",
|
|
||||||
"@types/cropperjs": "^1.3.0",
|
"@types/cropperjs": "^1.3.0",
|
||||||
"@types/leaflet": "^1.9.12",
|
"@types/leaflet": "^1.9.12",
|
||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
|
|
@ -50,12 +49,11 @@
|
||||||
"leaflet": "^1.9.4",
|
"leaflet": "^1.9.4",
|
||||||
"memoize-one": "^6.0.0",
|
"memoize-one": "^6.0.0",
|
||||||
"ng-gallery": "^11.0.0",
|
"ng-gallery": "^11.0.0",
|
||||||
"ngx-currency": "^18.0.0",
|
"ngx-currency": "^19.0.0",
|
||||||
"ngx-image-cropper": "^8.0.0",
|
"ngx-image-cropper": "^8.0.0",
|
||||||
"ngx-mask": "^18.0.0",
|
"ngx-mask": "^18.0.0",
|
||||||
"ngx-quill": "^26.0.5",
|
"ngx-quill": "^27.1.2",
|
||||||
"ngx-sharebuttons": "^15.0.3",
|
"ngx-sharebuttons": "^15.0.3",
|
||||||
"ngx-stripe": "^18.1.0",
|
|
||||||
"on-change": "^5.0.1",
|
"on-change": "^5.0.1",
|
||||||
"posthog-js": "^1.259.0",
|
"posthog-js": "^1.259.0",
|
||||||
"quill": "2.0.2",
|
"quill": "2.0.2",
|
||||||
|
|
@ -64,7 +62,6 @@
|
||||||
"urlcat": "^3.1.0",
|
"urlcat": "^3.1.0",
|
||||||
"uuid": "^10.0.0",
|
"uuid": "^10.0.0",
|
||||||
"zone.js": "~0.15.0",
|
"zone.js": "~0.15.0",
|
||||||
"stripe": "^19.3.0",
|
|
||||||
"zod": "^4.1.12"
|
"zod": "^4.1.12"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,6 @@ import { GALLERY_CONFIG, GalleryConfig } from 'ng-gallery';
|
||||||
import { provideQuillConfig } from 'ngx-quill';
|
import { provideQuillConfig } from 'ngx-quill';
|
||||||
import { provideShareButtonsOptions, SharerMethods, withConfig } from 'ngx-sharebuttons';
|
import { provideShareButtonsOptions, SharerMethods, withConfig } from 'ngx-sharebuttons';
|
||||||
import { shareIcons } from 'ngx-sharebuttons/icons';
|
import { shareIcons } from 'ngx-sharebuttons/icons';
|
||||||
import { provideNgxStripe } from 'ngx-stripe';
|
|
||||||
import { environment } from '../environments/environment';
|
import { environment } from '../environments/environment';
|
||||||
import { routes } from './app.routes';
|
import { routes } from './app.routes';
|
||||||
import { AuthInterceptor } from './interceptors/auth.interceptor';
|
import { AuthInterceptor } from './interceptors/auth.interceptor';
|
||||||
|
|
@ -77,7 +76,6 @@ export const appConfig: ApplicationConfig = {
|
||||||
),
|
),
|
||||||
...(environment.production ? [POSTHOG_INIT_PROVIDER] : []),
|
...(environment.production ? [POSTHOG_INIT_PROVIDER] : []),
|
||||||
provideAnimations(),
|
provideAnimations(),
|
||||||
provideNgxStripe('pk_test_IlpbVQhxAXZypLgnCHOCqlj8'),
|
|
||||||
provideQuillConfig({
|
provideQuillConfig({
|
||||||
modules: {
|
modules: {
|
||||||
syntax: true,
|
syntax: true,
|
||||||
|
|
|
||||||
|
|
@ -2,9 +2,7 @@ import { CommonModule } from '@angular/common';
|
||||||
import { Component } from '@angular/core';
|
import { Component } from '@angular/core';
|
||||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import { lastValueFrom } from 'rxjs';
|
|
||||||
import { AuthService } from '../../services/auth.service';
|
import { AuthService } from '../../services/auth.service';
|
||||||
import { SubscriptionsService } from '../../services/subscriptions.service';
|
|
||||||
import { UserService } from '../../services/user.service';
|
import { UserService } from '../../services/user.service';
|
||||||
import { map2User } from '../../utils/utils';
|
import { map2User } from '../../utils/utils';
|
||||||
|
|
||||||
|
|
@ -21,7 +19,6 @@ export class LoginComponent {
|
||||||
private activatedRoute: ActivatedRoute,
|
private activatedRoute: ActivatedRoute,
|
||||||
|
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private subscriptionService: SubscriptionsService,
|
|
||||||
private authService: AuthService,
|
private authService: AuthService,
|
||||||
) {}
|
) {}
|
||||||
async ngOnInit() {
|
async ngOnInit() {
|
||||||
|
|
@ -29,19 +26,17 @@ export class LoginComponent {
|
||||||
const keycloakUser = map2User(token);
|
const keycloakUser = map2User(token);
|
||||||
const email = keycloakUser.email;
|
const email = keycloakUser.email;
|
||||||
const user = await this.userService.getByMail(email);
|
const user = await this.userService.getByMail(email);
|
||||||
if (!user.subscriptionPlan) {
|
// if (!user.subscriptionPlan) {
|
||||||
//this.router.navigate(['/pricing']);
|
// const subscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(user.email));
|
||||||
const subscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(user.email));
|
// const activeSubscription = subscriptions.filter(s => s.status === 'active');
|
||||||
const activeSubscription = subscriptions.filter(s => s.status === 'active');
|
// if (activeSubscription.length > 0) {
|
||||||
if (activeSubscription.length > 0) {
|
// user.subscriptionPlan = activeSubscription[0].metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional';
|
||||||
user.subscriptionPlan = activeSubscription[0].metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional';
|
// this.userService.saveGuaranteed(user);
|
||||||
this.userService.saveGuaranteed(user);
|
// } else {
|
||||||
} else {
|
// this.router.navigate([`/home`]);
|
||||||
// Pricing page removed - redirect to home
|
// return;
|
||||||
this.router.navigate([`/home`]);
|
// }
|
||||||
return;
|
// }
|
||||||
}
|
|
||||||
}
|
|
||||||
this.router.navigate([`/${this.page}`]);
|
this.router.navigate([`/${this.page}`]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ import { ChangeDetectorRef, Component } from '@angular/core';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||||
import { NgSelectModule } from '@ng-select/ng-select';
|
import { NgSelectModule } from '@ng-select/ng-select';
|
||||||
import { NgxCurrencyDirective } from 'ngx-currency';
|
|
||||||
import { ImageCropperComponent } from 'ngx-image-cropper';
|
|
||||||
import { QuillModule } from 'ngx-quill';
|
import { QuillModule } from 'ngx-quill';
|
||||||
import { lastValueFrom } from 'rxjs';
|
import { lastValueFrom } from 'rxjs';
|
||||||
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
import { User } from '../../../../../../bizmatch-server/src/models/db.model';
|
||||||
|
|
@ -13,10 +11,8 @@ import { environment } from '../../../../environments/environment';
|
||||||
import { ConfirmationComponent } from '../../../components/confirmation/confirmation.component';
|
import { ConfirmationComponent } from '../../../components/confirmation/confirmation.component';
|
||||||
import { ConfirmationService } from '../../../components/confirmation/confirmation.service';
|
import { ConfirmationService } from '../../../components/confirmation/confirmation.service';
|
||||||
import { ImageCropAndUploadComponent, UploadReponse } from '../../../components/image-crop-and-upload/image-crop-and-upload.component';
|
import { ImageCropAndUploadComponent, UploadReponse } from '../../../components/image-crop-and-upload/image-crop-and-upload.component';
|
||||||
import { MessageComponent } from '../../../components/message/message.component';
|
|
||||||
import { MessageService } from '../../../components/message/message.service';
|
import { MessageService } from '../../../components/message/message.service';
|
||||||
import { TooltipComponent } from '../../../components/tooltip/tooltip.component';
|
import { TooltipComponent } from '../../../components/tooltip/tooltip.component';
|
||||||
import { ValidatedCityComponent } from '../../../components/validated-city/validated-city.component';
|
|
||||||
import { ValidatedCountyComponent } from '../../../components/validated-county/validated-county.component';
|
import { ValidatedCountyComponent } from '../../../components/validated-county/validated-county.component';
|
||||||
import { ValidatedInputComponent } from '../../../components/validated-input/validated-input.component';
|
import { ValidatedInputComponent } from '../../../components/validated-input/validated-input.component';
|
||||||
import { ValidatedLocationComponent } from '../../../components/validated-location/validated-location.component';
|
import { ValidatedLocationComponent } from '../../../components/validated-location/validated-location.component';
|
||||||
|
|
@ -72,7 +68,6 @@ export class AccountComponent {
|
||||||
customerSubTypeOptions: Array<{ value: string; label: string }> = [];
|
customerSubTypeOptions: Array<{ value: string; label: string }> = [];
|
||||||
tooltipTargetAreasServed = 'tooltip-areasServed';
|
tooltipTargetAreasServed = 'tooltip-areasServed';
|
||||||
tooltipTargetLicensed = 'tooltip-licensedIn';
|
tooltipTargetLicensed = 'tooltip-licensedIn';
|
||||||
// subscriptions: StripeSubscription[] | any[];
|
|
||||||
constructor(
|
constructor(
|
||||||
public userService: UserService,
|
public userService: UserService,
|
||||||
private geoService: GeoService,
|
private geoService: GeoService,
|
||||||
|
|
@ -87,7 +82,6 @@ export class AccountComponent {
|
||||||
private sharedService: SharedService,
|
private sharedService: SharedService,
|
||||||
private titleCasePipe: TitleCasePipe,
|
private titleCasePipe: TitleCasePipe,
|
||||||
private validationMessagesService: ValidationMessagesService,
|
private validationMessagesService: ValidationMessagesService,
|
||||||
// private subscriptionService: SubscriptionsService,
|
|
||||||
private datePipe: DatePipe,
|
private datePipe: DatePipe,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
public authService: AuthService,
|
public authService: AuthService,
|
||||||
|
|
|
||||||
|
|
@ -1,17 +0,0 @@
|
||||||
import { HttpClient } from '@angular/common/http';
|
|
||||||
import { Injectable } from '@angular/core';
|
|
||||||
import { Observable } from 'rxjs';
|
|
||||||
import { StripeSubscription } from '../../../../bizmatch-server/src/models/main.model';
|
|
||||||
import { environment } from '../../environments/environment';
|
|
||||||
|
|
||||||
@Injectable({
|
|
||||||
providedIn: 'root',
|
|
||||||
})
|
|
||||||
export class SubscriptionsService {
|
|
||||||
private apiBaseUrl = environment.apiBaseUrl;
|
|
||||||
constructor(private http: HttpClient) {}
|
|
||||||
|
|
||||||
getAllSubscriptions(email: string): Observable<StripeSubscription[]> {
|
|
||||||
return this.http.get<StripeSubscription[]>(`${this.apiBaseUrl}/bizmatch/payment/subscriptions/${email}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
@ -1,10 +1,9 @@
|
||||||
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
import { HttpClient, HttpHeaders, HttpParams } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { PaymentMethod } from '@stripe/stripe-js';
|
|
||||||
import { catchError, forkJoin, lastValueFrom, map, Observable, of, Subject } from 'rxjs';
|
import { catchError, forkJoin, lastValueFrom, map, Observable, of, Subject } from 'rxjs';
|
||||||
import urlcat from 'urlcat';
|
import urlcat from 'urlcat';
|
||||||
import { User } from '../../../../bizmatch-server/src/models/db.model';
|
import { User } from '../../../../bizmatch-server/src/models/db.model';
|
||||||
import { CombinedUser, FirebaseUserInfo, KeycloakUser, ResponseUsersArray, StripeSubscription, StripeUser, UserListingCriteria, UserRole, UsersResponse } from '../../../../bizmatch-server/src/models/main.model';
|
import { CombinedUser, FirebaseUserInfo, KeycloakUser, ResponseUsersArray, UserListingCriteria, UserRole, UsersResponse } from '../../../../bizmatch-server/src/models/main.model';
|
||||||
import { environment } from '../../environments/environment';
|
import { environment } from '../../environments/environment';
|
||||||
|
|
||||||
@Injectable({
|
@Injectable({
|
||||||
|
|
@ -109,31 +108,7 @@ export class UserService {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAllStripeSubscriptions(): Observable<StripeSubscription[]> {
|
|
||||||
return this.http.get<StripeSubscription[]>(`${this.apiBaseUrl}/bizmatch/payment/subscription/all`).pipe(
|
|
||||||
catchError(error => {
|
|
||||||
console.error('Fehler beim Laden der Stripe-Subscriptions', error);
|
|
||||||
return of([]);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
getAllStripeUsers(): Observable<StripeUser[]> {
|
|
||||||
return this.http.get<StripeUser[]>(`${this.apiBaseUrl}/bizmatch/payment/user/all`).pipe(
|
|
||||||
catchError(error => {
|
|
||||||
console.error('Fehler beim Laden der Stripe-Benutzer', error);
|
|
||||||
return of([]);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
getPaymentMethods(email: string): Observable<PaymentMethod[]> {
|
|
||||||
return this.http.get<PaymentMethod[]>(`${this.apiBaseUrl}/bizmatch/payment/paymentmethod/${email}`).pipe(
|
|
||||||
catchError(error => {
|
|
||||||
console.error('Fehler beim Laden der Zahlungsinformationen', error);
|
|
||||||
return of([]);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
/**
|
/**
|
||||||
* Lädt alle Benutzer aus den verschiedenen Quellen und kombiniert sie.
|
* Lädt alle Benutzer aus den verschiedenen Quellen und kombiniert sie.
|
||||||
* @returns Ein Observable mit einer Liste von CombinedUser.
|
* @returns Ein Observable mit einer Liste von CombinedUser.
|
||||||
|
|
@ -142,10 +117,9 @@ export class UserService {
|
||||||
return forkJoin({
|
return forkJoin({
|
||||||
keycloakUsers: this.getKeycloakUsers(),
|
keycloakUsers: this.getKeycloakUsers(),
|
||||||
appUsers: this.getAppUsers(),
|
appUsers: this.getAppUsers(),
|
||||||
stripeSubscriptions: this.getAllStripeSubscriptions(),
|
|
||||||
stripeUsers: this.getAllStripeUsers(),
|
|
||||||
}).pipe(
|
}).pipe(
|
||||||
map(({ keycloakUsers, appUsers, stripeSubscriptions, stripeUsers }) => {
|
map(({ keycloakUsers, appUsers }) => {
|
||||||
const combinedUsers: CombinedUser[] = [];
|
const combinedUsers: CombinedUser[] = [];
|
||||||
|
|
||||||
// Map App Users mit Keycloak und Stripe Subscription
|
// Map App Users mit Keycloak und Stripe Subscription
|
||||||
|
|
@ -153,30 +127,14 @@ export class UserService {
|
||||||
const keycloakUser = keycloakUsers.find(kcUser => kcUser.email.toLowerCase() === appUser.email.toLowerCase());
|
const keycloakUser = keycloakUsers.find(kcUser => kcUser.email.toLowerCase() === appUser.email.toLowerCase());
|
||||||
|
|
||||||
// const stripeSubscription = appUser.subscriptionId ? stripeSubscriptions.find(sub => sub.id === appUser.subscriptionId) : null;
|
// const stripeSubscription = appUser.subscriptionId ? stripeSubscriptions.find(sub => sub.id === appUser.subscriptionId) : null;
|
||||||
const stripeUser = stripeUsers.find(suser => suser.email === appUser.email);
|
const stripeUser = null;
|
||||||
const stripeSubscription = stripeUser ? stripeSubscriptions.find(sub => sub.customer === stripeUser.id) : null;
|
const stripeSubscription = null;
|
||||||
combinedUsers.push({
|
combinedUsers.push({
|
||||||
appUser,
|
appUser,
|
||||||
keycloakUser,
|
keycloakUser
|
||||||
stripeUser,
|
|
||||||
stripeSubscription,
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// Füge Stripe-Benutzer hinzu, die nicht in App oder Keycloak vorhanden sind
|
|
||||||
stripeUsers.forEach(stripeUser => {
|
|
||||||
const existsInApp = appUsers.some(appUser => appUser.email.toLowerCase() === stripeUser.email.toLowerCase());
|
|
||||||
const existsInKeycloak = keycloakUsers.some(kcUser => kcUser.email.toLowerCase() === stripeUser.email.toLowerCase());
|
|
||||||
|
|
||||||
if (!existsInApp && !existsInKeycloak) {
|
|
||||||
combinedUsers.push({
|
|
||||||
stripeUser,
|
|
||||||
// Optional: Verknüpfe Stripe-Benutzer mit ihren Subscriptions
|
|
||||||
stripeSubscription: stripeSubscriptions.find(sub => sub.customer === stripeUser.id) || null,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return combinedUsers;
|
return combinedUsers;
|
||||||
}),
|
}),
|
||||||
catchError(err => {
|
catchError(err => {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Build information, automatically generated by `the_build_script` :zwinkern:
|
// Build information, automatically generated by `the_build_script` :zwinkern:
|
||||||
const build = {
|
const build = {
|
||||||
timestamp: "GER: 03.01.2026 13:12 | TX: 01/03/2026 6:12 AM"
|
timestamp: "GER: 04.01.2026 12:21 | TX: 01/04/2026 5:21 AM"
|
||||||
};
|
};
|
||||||
|
|
||||||
export default build;
|
export default build;
|
||||||
|
|
@ -27,7 +27,6 @@
|
||||||
],
|
],
|
||||||
"paths": {
|
"paths": {
|
||||||
"zod": ["node_modules/zod"],
|
"zod": ["node_modules/zod"],
|
||||||
"stripe": ["node_modules/stripe"]
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"angularCompilerOptions": {
|
"angularCompilerOptions": {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue