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 { State } from './server.model';
|
||||
|
||||
|
|
@ -409,8 +408,6 @@ export function createDefaultBusinessListing(): BusinessListing {
|
|||
listingsCategory: 'business',
|
||||
};
|
||||
}
|
||||
export type StripeSubscription = Stripe.Subscription;
|
||||
export type StripeUser = Stripe.Customer;
|
||||
export type IpInfo = {
|
||||
ip: string;
|
||||
city: string;
|
||||
|
|
@ -424,8 +421,6 @@ export type IpInfo = {
|
|||
export interface CombinedUser {
|
||||
keycloakUser?: KeycloakUser;
|
||||
appUser?: User;
|
||||
stripeUser?: StripeUser;
|
||||
stripeSubscription?: StripeSubscription;
|
||||
}
|
||||
export interface RealIpInfo {
|
||||
ip: string;
|
||||
|
|
|
|||
|
|
@ -30,15 +30,14 @@
|
|||
"@angular/platform-server": "^19.2.16",
|
||||
"@angular/router": "^19.2.16",
|
||||
"@angular/ssr": "^19.2.16",
|
||||
"@bluehalo/ngx-leaflet": "^18.0.2",
|
||||
"@fortawesome/angular-fontawesome": "^0.15.0",
|
||||
"@bluehalo/ngx-leaflet": "^19.0.0",
|
||||
"@fortawesome/angular-fontawesome": "^1.0.0",
|
||||
"@fortawesome/fontawesome-free": "^6.7.2",
|
||||
"@fortawesome/fontawesome-svg-core": "^6.7.2",
|
||||
"@fortawesome/free-brands-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",
|
||||
"@stripe/stripe-js": "^4.3.0",
|
||||
"@types/cropperjs": "^1.3.0",
|
||||
"@types/leaflet": "^1.9.12",
|
||||
"@types/uuid": "^10.0.0",
|
||||
|
|
@ -50,12 +49,11 @@
|
|||
"leaflet": "^1.9.4",
|
||||
"memoize-one": "^6.0.0",
|
||||
"ng-gallery": "^11.0.0",
|
||||
"ngx-currency": "^18.0.0",
|
||||
"ngx-currency": "^19.0.0",
|
||||
"ngx-image-cropper": "^8.0.0",
|
||||
"ngx-mask": "^18.0.0",
|
||||
"ngx-quill": "^26.0.5",
|
||||
"ngx-quill": "^27.1.2",
|
||||
"ngx-sharebuttons": "^15.0.3",
|
||||
"ngx-stripe": "^18.1.0",
|
||||
"on-change": "^5.0.1",
|
||||
"posthog-js": "^1.259.0",
|
||||
"quill": "2.0.2",
|
||||
|
|
@ -64,7 +62,6 @@
|
|||
"urlcat": "^3.1.0",
|
||||
"uuid": "^10.0.0",
|
||||
"zone.js": "~0.15.0",
|
||||
"stripe": "^19.3.0",
|
||||
"zod": "^4.1.12"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import { GALLERY_CONFIG, GalleryConfig } from 'ng-gallery';
|
|||
import { provideQuillConfig } from 'ngx-quill';
|
||||
import { provideShareButtonsOptions, SharerMethods, withConfig } from 'ngx-sharebuttons';
|
||||
import { shareIcons } from 'ngx-sharebuttons/icons';
|
||||
import { provideNgxStripe } from 'ngx-stripe';
|
||||
import { environment } from '../environments/environment';
|
||||
import { routes } from './app.routes';
|
||||
import { AuthInterceptor } from './interceptors/auth.interceptor';
|
||||
|
|
@ -77,7 +76,6 @@ export const appConfig: ApplicationConfig = {
|
|||
),
|
||||
...(environment.production ? [POSTHOG_INIT_PROVIDER] : []),
|
||||
provideAnimations(),
|
||||
provideNgxStripe('pk_test_IlpbVQhxAXZypLgnCHOCqlj8'),
|
||||
provideQuillConfig({
|
||||
modules: {
|
||||
syntax: true,
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ import { CommonModule } from '@angular/common';
|
|||
import { Component } from '@angular/core';
|
||||
import { ActivatedRoute, Router, RouterModule } from '@angular/router';
|
||||
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
import { AuthService } from '../../services/auth.service';
|
||||
import { SubscriptionsService } from '../../services/subscriptions.service';
|
||||
import { UserService } from '../../services/user.service';
|
||||
import { map2User } from '../../utils/utils';
|
||||
|
||||
|
|
@ -21,7 +19,6 @@ export class LoginComponent {
|
|||
private activatedRoute: ActivatedRoute,
|
||||
|
||||
private router: Router,
|
||||
private subscriptionService: SubscriptionsService,
|
||||
private authService: AuthService,
|
||||
) {}
|
||||
async ngOnInit() {
|
||||
|
|
@ -29,19 +26,17 @@ export class LoginComponent {
|
|||
const keycloakUser = map2User(token);
|
||||
const email = keycloakUser.email;
|
||||
const user = await this.userService.getByMail(email);
|
||||
if (!user.subscriptionPlan) {
|
||||
//this.router.navigate(['/pricing']);
|
||||
const subscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(user.email));
|
||||
const activeSubscription = subscriptions.filter(s => s.status === 'active');
|
||||
if (activeSubscription.length > 0) {
|
||||
user.subscriptionPlan = activeSubscription[0].metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional';
|
||||
this.userService.saveGuaranteed(user);
|
||||
} else {
|
||||
// Pricing page removed - redirect to home
|
||||
this.router.navigate([`/home`]);
|
||||
return;
|
||||
}
|
||||
}
|
||||
// if (!user.subscriptionPlan) {
|
||||
// const subscriptions = await lastValueFrom(this.subscriptionService.getAllSubscriptions(user.email));
|
||||
// const activeSubscription = subscriptions.filter(s => s.status === 'active');
|
||||
// if (activeSubscription.length > 0) {
|
||||
// user.subscriptionPlan = activeSubscription[0].metadata['plan'] === 'Broker Plan' ? 'broker' : 'professional';
|
||||
// this.userService.saveGuaranteed(user);
|
||||
// } else {
|
||||
// this.router.navigate([`/home`]);
|
||||
// return;
|
||||
// }
|
||||
// }
|
||||
this.router.navigate([`/${this.page}`]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,8 +3,6 @@ import { ChangeDetectorRef, Component } from '@angular/core';
|
|||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { faTrash } from '@fortawesome/free-solid-svg-icons';
|
||||
import { NgSelectModule } from '@ng-select/ng-select';
|
||||
import { NgxCurrencyDirective } from 'ngx-currency';
|
||||
import { ImageCropperComponent } from 'ngx-image-cropper';
|
||||
import { QuillModule } from 'ngx-quill';
|
||||
import { lastValueFrom } from 'rxjs';
|
||||
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 { ConfirmationService } from '../../../components/confirmation/confirmation.service';
|
||||
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 { 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 { ValidatedInputComponent } from '../../../components/validated-input/validated-input.component';
|
||||
import { ValidatedLocationComponent } from '../../../components/validated-location/validated-location.component';
|
||||
|
|
@ -72,7 +68,6 @@ export class AccountComponent {
|
|||
customerSubTypeOptions: Array<{ value: string; label: string }> = [];
|
||||
tooltipTargetAreasServed = 'tooltip-areasServed';
|
||||
tooltipTargetLicensed = 'tooltip-licensedIn';
|
||||
// subscriptions: StripeSubscription[] | any[];
|
||||
constructor(
|
||||
public userService: UserService,
|
||||
private geoService: GeoService,
|
||||
|
|
@ -87,7 +82,6 @@ export class AccountComponent {
|
|||
private sharedService: SharedService,
|
||||
private titleCasePipe: TitleCasePipe,
|
||||
private validationMessagesService: ValidationMessagesService,
|
||||
// private subscriptionService: SubscriptionsService,
|
||||
private datePipe: DatePipe,
|
||||
private router: Router,
|
||||
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 { Injectable } from '@angular/core';
|
||||
import { PaymentMethod } from '@stripe/stripe-js';
|
||||
import { catchError, forkJoin, lastValueFrom, map, Observable, of, Subject } from 'rxjs';
|
||||
import urlcat from 'urlcat';
|
||||
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';
|
||||
|
||||
@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.
|
||||
* @returns Ein Observable mit einer Liste von CombinedUser.
|
||||
|
|
@ -142,10 +117,9 @@ export class UserService {
|
|||
return forkJoin({
|
||||
keycloakUsers: this.getKeycloakUsers(),
|
||||
appUsers: this.getAppUsers(),
|
||||
stripeSubscriptions: this.getAllStripeSubscriptions(),
|
||||
stripeUsers: this.getAllStripeUsers(),
|
||||
|
||||
}).pipe(
|
||||
map(({ keycloakUsers, appUsers, stripeSubscriptions, stripeUsers }) => {
|
||||
map(({ keycloakUsers, appUsers }) => {
|
||||
const combinedUsers: CombinedUser[] = [];
|
||||
|
||||
// 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 stripeSubscription = appUser.subscriptionId ? stripeSubscriptions.find(sub => sub.id === appUser.subscriptionId) : null;
|
||||
const stripeUser = stripeUsers.find(suser => suser.email === appUser.email);
|
||||
const stripeSubscription = stripeUser ? stripeSubscriptions.find(sub => sub.customer === stripeUser.id) : null;
|
||||
const stripeUser = null;
|
||||
const stripeSubscription = null;
|
||||
combinedUsers.push({
|
||||
appUser,
|
||||
keycloakUser,
|
||||
stripeUser,
|
||||
stripeSubscription,
|
||||
keycloakUser
|
||||
});
|
||||
});
|
||||
|
||||
// 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;
|
||||
}),
|
||||
catchError(err => {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
// Build information, automatically generated by `the_build_script` :zwinkern:
|
||||
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;
|
||||
|
|
@ -27,7 +27,6 @@
|
|||
],
|
||||
"paths": {
|
||||
"zod": ["node_modules/zod"],
|
||||
"stripe": ["node_modules/stripe"]
|
||||
}
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
|
|
|
|||
Loading…
Reference in New Issue