1 Commits

View File

@@ -7,6 +7,7 @@ import { CartService } from '../../../../core/services/cart/cart.service';
import { TenantService } from '../../../../core/services/tenant.service';
import { CheckoutService, CreatePurchasePayload } from '../../../../core/services/checkout.service';
import { AuthService } from '../../../../core/services/auth/auth.service';
import { ToastService } from '../../../../core/services/toast.service';
import { BankAccount } from '../../../../core/services/tenant.interface';
import { CartItem } from '../../../../core/services/cart/cart.interface';
import { CartComponent, CartItemMock } from '../../../../shared/components/cart/cart.component';
@@ -37,6 +38,7 @@ export class CheckoutPageComponent implements OnInit {
private readonly tenantService = inject(TenantService);
private readonly checkoutService = inject(CheckoutService);
private readonly authService = inject(AuthService);
private readonly toastService = inject(ToastService);
@ViewChild(StepperComponent) stepper!: StepperComponent;
@@ -219,6 +221,13 @@ export class CheckoutPageComponent implements OnInit {
}
} catch (error) {
console.error('Failed to generate payment intent:', error);
const backendMessage = (error as { error?: { message?: unknown } } | null)?.error?.message;
const message = typeof backendMessage === 'string'
? backendMessage
: error instanceof Error
? error.message
: 'No pudimos obtener la información de pago. Intentá nuevamente.';
this.toastService.danger(message);
} finally {
this.isGeneratingIntent.set(false);
}