Compare commits

...

2 Commits

Author SHA1 Message Date
c0b7ac08fb link
Co-authored-by: Copilot <copilot@github.com>
2026-05-06 17:22:52 +04:00
889f289489 fast link
Co-authored-by: Copilot <copilot@github.com>
2026-05-06 17:21:35 +04:00
4 changed files with 50 additions and 13 deletions

View File

@@ -68,7 +68,8 @@
"buildTarget": "qr_vitanova:build:production" "buildTarget": "qr_vitanova:build:production"
}, },
"development": { "development": {
"buildTarget": "qr_vitanova:build:development" "buildTarget": "qr_vitanova:build:development",
"proxyConfig": "proxy.conf.json"
} }
}, },
"defaultConfiguration": "development" "defaultConfiguration": "development"

23
proxy.conf.json Normal file
View File

@@ -0,0 +1,23 @@
{
"/proxy/legacy-qr": {
"target": "https://qr.vitanova.network:567",
"secure": false,
"changeOrigin": true,
"pathRewrite": { "^/proxy/legacy-qr": "" },
"logLevel": "debug"
},
"/proxy/fastcheck": {
"target": "https://api.fastcheck.store",
"secure": true,
"changeOrigin": true,
"pathRewrite": { "^/proxy/fastcheck": "" },
"logLevel": "debug"
},
"/proxy/qr-vitanova": {
"target": "https://qr.vitanova.network",
"secure": true,
"changeOrigin": true,
"pathRewrite": { "^/proxy/qr-vitanova": "" },
"logLevel": "debug"
}
}

View File

@@ -1,11 +1,21 @@
/** import { isDevMode } from '@angular/core';
/**
* Endpoint constants for the Fastcheck backend (see public/api.txt). * Endpoint constants for the Fastcheck backend (see public/api.txt).
* Centralised so they can be swapped in one place. * Centralised so they can be swapped in one place.
* In dev mode (ng serve) requests go through the Angular proxy (proxy.conf.json)
* to avoid CORS issues. In production the real URLs are used.
*/ */
export const FASTCHECK_API = 'https://api.fastcheck.store'; export const FASTCHECK_API = isDevMode()
? '/proxy/fastcheck'
: 'https://api.fastcheck.store';
// Legacy QR endpoint kept for the SBP amount → payload redirect flow. // Legacy QR endpoint kept for the SBP amount → payload redirect flow.
export const QR_API = 'https://qr.vitanova.network:567/qr'; export const QR_API = isDevMode()
? '/proxy/legacy-qr/qr'
: 'https://qr.vitanova.network:567/qr';
// New QR Vitanova API (dynamic QR, settings, polling). // New QR Vitanova API (dynamic QR, settings, polling).
export const QR_VITANOVA_API = 'https://qr.vitanova.network/api'; export const QR_VITANOVA_API = isDevMode()
? '/proxy/qr-vitanova/api'
: 'https://qr.vitanova.network/api';

View File

@@ -1,4 +1,4 @@
import { Component, computed, inject, signal } from '@angular/core'; import { Component, computed, inject, isDevMode, signal } from '@angular/core';
import { FormsModule } from '@angular/forms'; import { FormsModule } from '@angular/forms';
import { ActivatedRoute } from '@angular/router'; import { ActivatedRoute } from '@angular/router';
import { HttpClient } from '@angular/common/http'; import { HttpClient } from '@angular/common/http';
@@ -30,7 +30,9 @@ export class LegacyPayPage {
private t(key: string): string { return this.i18n.translate(key); } private t(key: string): string { return this.i18n.translate(key); }
private readonly LEGACY_API = 'https://qr.vitanova.network:567/qr'; private readonly LEGACY_API = isDevMode()
? '/proxy/legacy-qr/qr'
: 'https://qr.vitanova.network:567/qr';
amount = signal<number | null>(null); amount = signal<number | null>(null);
note = signal<string>(''); note = signal<string>('');
@@ -40,8 +42,9 @@ export class LegacyPayPage {
paymentId = signal<string>(''); paymentId = signal<string>('');
readonly isMobile: boolean = typeof navigator !== 'undefined' readonly isMobile: boolean = typeof window !== 'undefined'
&& /android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent); && (navigator.maxTouchPoints > 0 || 'ontouchstart' in window
|| /android|iphone|ipad|ipod|mobile/i.test(navigator.userAgent));
canPay = computed(() => { canPay = computed(() => {
const a = this.amount(); const a = this.amount();
@@ -75,11 +78,11 @@ export class LegacyPayPage {
this.loading.set(true); this.loading.set(true);
const body = { const body = {
payment: 'sbp', qrtype: 'QRDynamic',
amount: this.amount(), amount: this.amount(),
currency: 'rub', currency: 'RUB',
id: this.paymentId(), partnerqrID: this.paymentId(),
note: this.note().trim() qrDescription: this.note().trim()
}; };
this.http.post<LegacyPayResponse>(this.LEGACY_API, body).subscribe({ this.http.post<LegacyPayResponse>(this.LEGACY_API, body).subscribe({