diff --git a/.gitignore b/.gitignore index 5e1493e..29720c8 100644 --- a/.gitignore +++ b/.gitignore @@ -5,8 +5,10 @@ /out-tsc /bazel-out /dist + +# Local-only docs and scratch (not for publishing) +/docs/ changes.txt -api.txt # Node /node_modules diff --git a/public/Fastcheck_API (1).txt b/public/Fastcheck_API (1).txt deleted file mode 100644 index ee210a8..0000000 --- a/public/Fastcheck_API (1).txt +++ /dev/null @@ -1,142 +0,0 @@ -eFastcheck.store -General Information -Information exchange with the Fastcheck server is realized via RESTful API. All requests to the server must be executed via HTTPS using GET||POST||PUT||DELETE requests to the given ROOT address. Body of requests must be in JSON format. All not public requests must be signed by the client and the public key must be sent to the server for client identification and sign checking. - - - - -Check if server is available -Client needs to periodically check if the server is available by sending “ping” to the client. On error corresponding message must be shown. -Protocol: https -Root Path: api.Fastcheck.store -Type GET -Path /ping -Request Parameters: -{ - - -} -Response (OK): -{ -"message": "pong", -} -________________ - - -Create new websession -Creates a new websession for qr generation. By timeout a new websession must be requested, after the user shows some activity (click on qr). -Protocol: https -Root Path: api.Fastcheck.store -Type GET -Path /websession -Request Parameters: -{ - - -} -Response (OK): -{ -"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A” -"userId" : "", -"expires" : "sessionId", -"userSessionId": "", -"Status": false -} -________________ - - -Check websession status -Check if the user is already logged in. a new websession for qr generation. By timeout a new websession must be requested, after the user shows some activity (click on qr). -Protocol: https -Root Path: api.Fastcheck.store -Type GET -Path /websession/:webSessionID -Request Parameters: -{ - - -} -Response (OK): -{ -"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A”, -"userId" : "kHaAe9roaC2uq63AKGE/8+Ti/t/iFro68QhEZ1dRGLo", -"expires" : "sessionId", -"userSessionId": "8A94EFEFD003426A9B456C48CAC99BE6", -"Status": true -} -________________ -Delete websession status -Delete the session to log out from the system. -Protocol: https -Root Path: api.Fastcheck.store -Type DELETE -Path /websession/:webSessionID -Request Parameters: -{ -"sessionId": “1AF3781BF6B94604B771AEA1D44FA63A” -} -Response (OK): -{ -} -________________ - - -Check Fastcheck status -Check if fastcheck exists and get the amount assigned to check. -Protocol: https -Root Path: api.Fastcheck.store -Type GET -Path /fastcheck - - -Request Parameters: -{ -"fastcheck": “1234-5678-0001”, -} -Response (OK): -{ - "fastcheck": "1234-5678-0001", - "expiration": 2021-07-07T09:08:18Z , - "Status": true -} -________________ -New Fastcheck -Create a fastcheck for a given amount. The Users must have a sufficient amount on the balance. -Protocol: https -Root Path: api.Fastcheck.store -Type POST -Path /fastcheck -HEADER: Authorization - {"sessionID": "1AF3781BF6B94604B771AEA1D44FA63A"} -Request Parameters: - { - "amount": 158000, - "currency": "RUB" - } -Response (OK): -{ - "fastcheck": "1234-5678-0001", - "expiration": 2021-07-07T09:08:18Z , - "code": "5864", - "Status": true -} -________________ -Accept Fastcheck -Accept fastcheck to the user balance. -Protocol: https -Root Path: api.Fastcheck.store -Type POST -Path /fastcheck -HEADER: Authorization - {"sessionID": "1AF3781BF6B94604B771AEA1D44FA63A"} -Request Parameters: - { - "fastcheck": "1234-5678-0001", - "code": "5864" - } -Response (404-ERROR): -{ - "message": "not authorized" -} -Response (200-OK): -{ - "message": "ok" -} \ No newline at end of file diff --git a/public/SBP QR API.txt b/public/SBP QR API.txt deleted file mode 100644 index 157b449..0000000 --- a/public/SBP QR API.txt +++ /dev/null @@ -1,262 +0,0 @@ -General Information -Information exchange with the SBP server is realized via RESTful API. All requests to the server must be executed via HTTPS using GET||POST||PUT||DELETE requests to the given ROOT address. Body of requests must be in JSON format. All not public requests must be signed by the client and the public key must be sent to the server for client identification and sign checking. - - -Header: -“Authorization”: {JSON WITH KEY AND PARTNERID} - - -Check if server is available -Client needs to periodically check if the server is available by sending “ping” to the client. On error corresponding message must be shown. -Protocol: https -Root Path: QR.VITANOVA.NETWORK -Type GET -Path /ping -Request Parameters: -{ - - -} -Response (Error): -{ -"message": "pong", -"status": "Wrong Header" -} -Response (OK): -{ -"message": "pong", -"status": "Correct Header" -} -________________ - - -Create New QR code -Create New QR for payment via SBP -Protocol: https -Root Path: QR.VITANOVA.NETWORK -Type POST -Path /qr -Request Parameters: -{ -"amount": 10.00, //amount from 10Rub to 499.000 Rub -"qrDescription": "Item description", -"order": "540", //orderid at partner’s platform -"partnerID": 102 //same as in header -"Phonemask": 79xxxx66265 //User phone number mask, needed only for crypto based operations. Payment will be accepted only from phone numbers corresponding to the mask -"Namelastname": Hakxx Sargxxxx /Mask for User name, lastname in cyrilic, needed only for crypto based operations. Payment will be accepted only from the user corresponding to that mask. -} - - -Response !=200(Error): -{ - "error": "wrong key" -} -Response =200(OK): -{ - "qrId": "BD10002CI1V3JP1T8QR8TIQ8K35RBVQB", - "qrStatus": "NEW", - "qrExpirationDate": "2025-11-20T10:10:44Z", - "Payload": "https://qr.nspk.ru/BD10002CI1V3JP1T8QR8TIQ8K35RBVQB?type=02&bank=100000000007&sum=1000&cur=RUB&crc=8ACC", - "qrUrl": "https://e-commerce.raiffeisen.ru/api/sbp/v1/qr/BD10002CI1V3JP1T8QR8TIQ8K35RBVQB/image" -} -________________ - - -Check Dynamic QR code -Check QR status -Protocol: https -Root Path: QR.VITANOVA.NETWORK -Type GET -Path /qr/dynamic/{qrId} - - -Request Parameters: -{ -} - - -Response !=200(Error): -{ - "error": "Error from the bank " -} -Response =200(OK): -{ -`json:"nspkID"` //": "AD100060JFQF8FSB9Q28FFL88IH6SST0" `json:"amount"` // "1235" -`json:"currency" // "RUB" -`json:"order"` // "126" partner order id PaymentDetails -`json:"paymentDetails"` // "Назначение платежа 2", -`json:"qrType"` //"QRDynamic", -`json:"qrExpirationDate"` //: "2025-11-22T09:14:38+03:00" `json:"sbpBank"` // "raiffeisen" -`json:"sbpMerchant"` //"Dexar" -`json:"sbpMerchantId"` //"", uint64 -`json:"sbpOperationId"` //0 Status -`json:"status"` //": "NEW", "APPROVED", "REJECTED", "COMPLETED" -`json:"nspkurl"` //"https://qr.nspk.ru/AD100060JFQF8FSB9Q28FFL88IH6SST0 -`json:"statusurl"` // "https://partner.com/1234321/status" url for checking QR `json:"redirectUrl"` //"https://fastcheck.store/" -`json:"qrDescription"` //"QR для оплаты заказа" -`json:"additionalInfo"` // TTL -`json:"TTL"` //10 timeout in minutes -`json:"callbackUrl"` // https://partner.com/1234321 callback after QR get paid -`json:"retry"` //0 retry count for calling partner -`json:"partnerID"` //103 Partner created QR PartnerqrID `json:"partnerqrID"` //QR ID in partner system RequestIP -`json:"requestIP"` //IP address of client requested QR -} -________________ - - -Check Static QR code -Get all qr-s paid by static QR for today, skipping already read qr codes -Protocol: https -Root Path: QR.VITANOVA.NETWORK -Type GET -Path /qr/static/{qrId}?skip=25 -Request Parameters: -{ -} - - -Response =200(OK): -[{ -`json:"nspkID"` //": "AD100060JFQF8FSB9Q28FFL88IH6SST0" `json:"amount"` // "1235" -`json:"currency" // "RUB" -`json:"order"` // "126" partner order id PaymentDetails -`json:"paymentDetails"` // "Назначение платежа 2", -`json:"qrType"` //"QRDynamic", -`json:"qrExpirationDate"` //: "2025-11-22T09:14:38+03:00" `json:"sbpBank"` // "raiffeisen" -`json:"sbpMerchant"` //"Dexar" -`json:"sbpMerchantId"` //"", uint64 -`json:"sbpOperationId"` //0 Status -`json:"status"` //": "NEW", "APPROVED", "REJECTED", "COMPLETED" -`json:"nspkurl"` //"https://qr.nspk.ru/AD100060JFQF8FSB9Q28FFL88IH6SST0 -`json:"statusurl"` // "https://partner.com/1234321/status" url for checking QR `json:"redirectUrl"` //"https://fastcheck.store/" -`json:"qrDescription"` //"QR для оплаты заказа" -`json:"additionalInfo"` // TTL -`json:"TTL"` //10 timeout in minutes -`json:"callbackUrl"` // https://partner.com/1234321 callback after QR get paid -`json:"retry"` //0 retry count for calling partner -`json:"partnerID"` //103 Partner created QR PartnerqrID `json:"partnerqrID"` //QR ID in partner system RequestIP -`json:"requestIP"` //IP address of client requested QR -}] - - -________________ - - -Delete QR -Delete unused QR. If QR is not paid until expiration time, it will be automatically deleted. -Protocol: https -Root Path: QR.VITANOVA.NETWORK -Type DELETE -Path /qr/{qrId} -Request Parameters: -{ -} - - -Response !=200(Error): -{ -"error": "Error from the bank " - - -} -Response =200(OK): -{ - } -________________ -Check Partner -Returns partner status, with balance and transactions. Each transaction id is QR code, which can be checked additionally. -Root Path: API.VITANOVA.NETWORK -Type Get -Path /partners/{partnerID} -Request Parameters: -{ -} -Response !=200(Error): -{ -"error": "Not authorized " -} -Response =200(OK): -{ - "telegram_id": 8285633, - "username": "ZZZ", - "first_name": "АMAN", - "last_name": "", - "balance": 22, - "transaction": [ - { - "additionalInfo": "Ручка", - "paymentPurpose": "Ручка", - "amount": 22, - "code": "SUCCESS", - "createDate": "2025-11-22T15:57:40.925104+03:00", - "currency": "RUB", - "order": "8285633735_301", - "paymentStatus": "SUCCESS", - "qrId": "AD10004C1K9N71MN907RD56UOA0BHIBR", - "transactionDate": "2025-11-22T15:58:14.814187+03:00", - "transactionId": 771515533, - "qrExpirationDate": "2025-11-22T16:12:40+03:00" - } - ], - "inn": 0 - } - - - - - - -________________ - - -Withdraw -Get amount from balance and Creates fastcheck, which then can be for buying usdt, transferring to bank account and to bank card. Fastcheck can be checked on site or via API only by Id, but can be used only with code. -Root Path: QR.VITANOVA.NETWORK -Type POST -Path/partners/withdraw/{partnerID} -Request Parameters: -{ -“amount”: 10600.00 -“currency”: “RUB” -“partnerId: “1023454” -“wallet”: “TBia4uHnb3oSSZm5isP284cA7Np1v15Vhi” -“” -“rate”:79.50 -} - - -Response !=200(Error): -{ -"error": "Not enough amount on balance " -} -Response !=200(Error): -{ -"error": "Rate is not correct " -} -Response =200(OK): -{ - “trxID”:”T5Mv2v8n9L7jY4k1pW3QhUoZfE9R1X3s7rY6tB0pA2C4D6E8F5H” -} -________________ -RATE -Get currency exchange rate. -Root Path: QR.VITANOVA.NETWORK -Type GET -Path/partners/rate -Request Parameters: - - - - -Response !=200(Error): -{ -"error": "Not Authorized " -} - - -Response =200(OK): - - -{ - "rate": 78.5 -} \ No newline at end of file diff --git a/src/app/pages/create-page/create-page.ts b/src/app/pages/create-page/create-page.ts index c3ff5ee..7203541 100644 --- a/src/app/pages/create-page/create-page.ts +++ b/src/app/pages/create-page/create-page.ts @@ -11,7 +11,6 @@ type Currency = 'RUB'; interface SettingsResponse { minAmount?: number; maxAmount?: number; - [key: string]: unknown; } interface CreateQrResponse { @@ -21,14 +20,10 @@ interface CreateQrResponse { nspkurl?: string; // actual field name in real responses qrUrl?: string; status?: string; // e.g. "REGISTERED" - [key: string]: unknown; } interface QrStatusResponse { status?: string; // "REGISTERED" | "NEW" | "APPROVED" | "REJECTED" | "COMPLETED" - nspkurl?: string; - nspkID?: string; - [key: string]: unknown; } @Component({ @@ -51,7 +46,6 @@ export class CreatePage { note = signal(''); error = signal(''); loading = signal(false); - settingsLoaded = signal(false); currency = signal('RUB'); payment = signal('sbp'); @@ -72,7 +66,6 @@ export class CreatePage { qrStatus = signal(''); paymentDone = signal(false); private pollHandle: ReturnType | null = null; - private activeQrId = ''; /** Auth credentials passed by the host page as URL params. */ private get authKey(): string { @@ -100,18 +93,13 @@ export class CreatePage { // The `id` query param is the user's id. Fetch per-user amount limits. // If the call fails or omits a value, keep current defaults. const userId = this.partnerqrID; - if (!userId) { - this.settingsLoaded.set(true); - return; - } + if (!userId) return; const url = `${QR_VITANOVA_API}/settings?id=${encodeURIComponent(userId)}`; this.http.get(url).subscribe({ next: (s) => { if (typeof s?.minAmount === 'number') this.minAmount.set(s.minAmount); if (typeof s?.maxAmount === 'number') this.maxAmount.set(s.maxAmount); - this.settingsLoaded.set(true); - }, - error: () => this.settingsLoaded.set(true) // proceed with current defaults + } }); } @@ -167,7 +155,6 @@ export class CreatePage { } if (qrId || nspkUrl) { - this.activeQrId = qrId; const qrData = nspkUrl ? `https://api.qrserver.com/v1/create-qr-code/?size=256x256&margin=8&data=${encodeURIComponent(nspkUrl)}` : (res.qrUrl ?? null); @@ -227,13 +214,9 @@ export class CreatePage { } closeQr(): void { + this.stopPolling(); this.qrImageUrl.set(null); - this.qrPolling.set(false); this.qrStatus.set(''); this.paymentDone.set(false); - if (this.pollHandle !== null) { - clearInterval(this.pollHandle); - this.pollHandle = null; - } } }