Überarbeitung des Stripe Prozesses

This commit is contained in:
2024-08-23 19:54:55 +02:00
parent 7a286e3519
commit 74d5f92aba
18 changed files with 164 additions and 68 deletions

View File

@@ -1,7 +1,15 @@
<div class="min-h-screen flex items-center justify-center">
<div class="bg-white p-6 rounded-lg shadow-lg max-w-md">
<div class="text-center">
@if(user && (user.subscriptionPlan==='professional' || user.subscriptionPlan==='broker')){
<!-- Neue Bedingung hinzufügen -->
@if(maxAttemptsReached) {
<h2 class="text-2xl font-bold text-red-800 mt-4">We're sorry!</h2>
<p class="text-gray-600 mt-2">
We regret to inform you that we have not yet received any response from our payment service provider regarding the status of your subscription. Please log in to the
<a href="https://www.bizmatch.net" class="text-blue-500 hover:underline">website</a> and check your subscription status under the Account menu. If you have any questions, please contact us at
<a href="mailto:support@bizmatch.net" class="text-blue-500 hover:underline">support&#64;bizmatch.net</a>.
</p>
} @else if(user && (user.subscriptionPlan==='professional' || user.subscriptionPlan==='broker')) {
<svg class="mx-auto h-16 w-16 text-green-500" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"></path>
</svg>

View File

@@ -16,7 +16,10 @@ import { map2User } from '../../utils/utils';
})
export class SuccessComponent {
user: User;
maxAttemptsReached: boolean = false; // Neue Variable hinzufügen
constructor(private keycloakService: KeycloakService, private userService: UserService, private logService: LogService, private router: Router) {}
async ngOnInit() {
let email = null;
try {
@@ -29,6 +32,7 @@ export class SuccessComponent {
this.checkSubscriptionPlan(email, e.message);
}
}
async checkSubscriptionPlan(email: string, error?: string) {
if (!email) {
this.logService.log({ severity: 'error', text: `Unauthorized Access to Success Page ${error}` });
@@ -44,12 +48,13 @@ export class SuccessComponent {
if (attempts >= maxAttempts) {
clearInterval(intervalId);
console.error('Max attempts reached');
this.maxAttemptsReached = true; // Setze die Variable auf true, wenn die max. Versuche erreicht wurden
return;
}
attempts++;
this.user = await this.userService.getByMail(email);
this.user = await this.userService.getByMail(email, true);
if (this.user && this.user.subscriptionPlan) {
clearInterval(intervalId);