api changed

This commit is contained in:
sdarbinyan
2026-06-06 16:16:37 +04:00
parent 14bdd3bcd0
commit 58e0869916
3 changed files with 41 additions and 31 deletions

View File

@@ -9,7 +9,7 @@ export interface QrCreateRequest {
qrtype: 'QRDynamic';
amount: number;
currency: 'RUB';
partnerqrID: string;
partnerqrID?: string;
qrDescription?: string;
Userid?: string;
Reference?: string;
@@ -49,12 +49,19 @@ export interface QrDynamicStatusResponse {
qrExpirationDate: string;
}
export interface QrPaymentStatusResponse {
status?: string;
paymentStatus?: string;
code?: string;
}
@Injectable({
providedIn: 'root'
})
export class ApiService {
private readonly baseUrl = environment.apiUrl;
private readonly qrBaseUrl = (environment as any).qrApiUrl as string;
private readonly sbpQrUrl = 'https://qr.vitanova.network:567/qr';
private readonly retryConfig = {
count: 2,
@@ -404,6 +411,15 @@ export class ApiService {
return this.http.post<QrCreateResponse>(`${this.qrBaseUrl}/qr`, payload, { headers: httpHeaders });
}
createSbpPayment(payload: QrCreateRequest): Observable<QrCreateResponse> {
return this.http.post<QrCreateResponse>(this.sbpQrUrl, payload);
}
checkSbpPaymentStatus(paymentId: string): Observable<QrPaymentStatusResponse> {
const params = new HttpParams().set('id', paymentId);
return this.http.get<QrPaymentStatusResponse>(this.sbpQrUrl, { params });
}
checkPaymentStatus(partnerQrId: string, qrId: string): Observable<QrDynamicStatusResponse> {
return this.http.get<QrDynamicStatusResponse>(
`${this.qrBaseUrl}/qr/dynamic/${encodeURIComponent(partnerQrId)}/${encodeURIComponent(qrId)}`