first commit

This commit is contained in:
sdarbinyan
2026-01-23 00:52:04 +04:00
parent 975b59c7b9
commit 2e516fa4d3
32 changed files with 3397 additions and 388 deletions

View File

@@ -1,59 +1,175 @@
# FastCheck
# FastCheck - СБП Payment System
This project was generated using [Angular CLI](https://github.com/angular/angular-cli) version 21.0.4.
FastCheck is an online payment system that allows users to create and manage payment checks with СБП (Faster Payment System).
## Development server
## Features
To start a local development server, run:
- ✅ QR Code Authentication
- ✅ Balance Management
- ✅ Create FastCheck with custom amount
- ✅ Accept FastCheck with number and PIN
- ✅ View Active Checks
- ✅ Transaction History
- ⏳ Bank Integration (To be implemented)
## Tech Stack
- **Framework**: Angular 21
- **Language**: TypeScript
- **Styling**: SCSS
- **HTTP Client**: Angular HttpClient
- **QR Code**: angularx-qrcode
- **API**: RESTful API (api.fastcheck.store)
## Getting Started
### Prerequisites
- Node.js (v18 or higher)
- npm (v10 or higher)
### Installation
```bash
ng serve
# Install dependencies
npm install
# Start development server
npm start
# The app will run on http://localhost:4200
```
Once the server is running, open your browser and navigate to `http://localhost:4200/`. The application will automatically reload whenever you modify any of the source files.
## Code scaffolding
Angular CLI includes powerful code scaffolding tools. To generate a new component, run:
### Build
```bash
ng generate component component-name
# Production build
npm run build
# Output will be in dist/ folder
```
For a complete list of available schematics (such as `components`, `directives`, or `pipes`), run:
## Project Structure
```bash
ng generate --help
```
src/
├── app/
│ ├── components/
│ │ ├── login/ # QR login with polling
│ │ ├── dashboard/ # Main dashboard
│ │ ├── active-checks/ # Active FastChecks list
│ │ └── history/ # Transaction history
│ ├── services/
│ │ ├── api.service.ts # HTTP client wrapper
│ │ ├── auth.service.ts # Authentication logic
│ │ └── fastcheck.service.ts # FastCheck operations
│ ├── models/ # TypeScript interfaces
│ ├── guards/ # Route guards
│ └── app.routes.ts # Route configuration
```
## Building
## API Documentation
To build the project run:
### Implemented APIs
```bash
ng build
-`GET /ping` - Check server availability
-`GET /websession` - Create QR session
-`GET /websession/:id` - Check login status (polling)
-`DELETE /websession/:id` - Logout
-`POST /fastcheck` - Create new FastCheck
-`POST /fastcheck` - Accept FastCheck
-`GET /fastcheck` - Check FastCheck status
### Missing APIs (Mocked in Frontend)
See `public/missing-apis.txt` for complete specifications:
-`GET /balance` - Get user balance
-`GET /fastcheck/active` - Get active checks
-`GET /fastcheck/history` - Get transaction history
**Note**: These APIs are currently mocked in the frontend. The backend team needs to implement them.
## Features Overview
### 1. Authentication
- Scan QR code with mobile app
- Auto-polling every 2 seconds
- Session management with sessionStorage
### 2. Dashboard
- View current balance
- Create new FastCheck
- Accept existing FastCheck
- FastCheck format: `xxxx-xxxx-xxxx`
- Code format: `xxxx`
### 3. Active Checks
- View all unused FastChecks
- Copy number and code to clipboard
- See expiration dates
### 4. Transaction History
- View used/expired checks
- Filter by created/accepted
- See timestamps
### 5. Balance Top-Up (To be implemented)
- Bank integration needed
- Will redirect to bank payment page
- Auto-refresh balance after payment
## Development Notes
### Mock Data
The following services return mock data:
- `getBalance()` - Returns 150,000 RUB
- `getActiveFastChecks()` - Returns 2 sample active checks
- `getFastCheckHistory()` - Returns 2 sample history records
Replace the mocked `of()` observables with real API calls once backend is ready.
### Environment Configuration
Update `src/environments/environment.ts` for different API URLs:
```typescript
export const environment = {
production: false,
apiUrl: 'https://api.fastcheck.store'
};
```
This will compile your project and store the build artifacts in the `dist/` directory. By default, the production build optimizes your application for performance and speed.
## Backend Requirements
## Running unit tests
Backend team needs to implement:
To execute unit tests with the [Vitest](https://vitest.dev/) test runner, use the following command:
1. **Balance API** - `GET /balance`
2. **Active Checks API** - `GET /fastcheck/active`
3. **History API** - `GET /fastcheck/history`
4. **Bank Integration** - Payment gateway integration
```bash
ng test
```
See `public/missing-apis.txt` for detailed API specifications.
## Running end-to-end tests
## Security Notes
For end-to-end (e2e) testing, run:
- SessionId stored in sessionStorage (clears on tab close)
- All authenticated requests include Authorization header
- FastCheck codes are sensitive - handle securely
- Implement HTTPS in production
```bash
ng e2e
```
## Browser Support
Angular CLI does not come with an end-to-end testing framework by default. You can choose one that suits your needs.
- Chrome (latest)
- Firefox (latest)
- Safari (latest)
- Edge (latest)
## Additional Resources
## License
For more information on using the Angular CLI, including detailed command references, visit the [Angular CLI Overview and Command Reference](https://angular.dev/tools/cli) page.
Private - 4Pay
## Contact
For questions or issues, contact: sdarbinyan@4pay.ru