Assist_Design/docs/testing/sim-api-test-tracking.md
tema 94b341dd93 Enhance Freebit Integration and Update UI Components
- Added FreebitTestTrackerService to FreebitClientService for improved API call tracking.
- Updated Freebit module to include the new test tracker service.
- Refactored HowItWorksSection and PublicInternetPlans to enhance user guidance with clearer steps and improved styling.
- Introduced a new VpnHowItWorksSection to provide users with a simplified setup process for VPN services.
- Enhanced PublicOfferingCard and VpnPlanCard components with updated styles and additional feature highlights for better user engagement.
2026-01-17 18:47:13 +09:00

88 lines
2.9 KiB
Markdown

# SIM API Test Tracking
## Overview
The test tracking system automatically logs all Freebit API calls made during physical SIM testing to a CSV file. This allows you to track which APIs were tested on which phones and at what time.
## Log File Location
The test tracking log file is created at the project root:
- **File**: `sim-api-test-log.csv`
- **Location**: Project root directory
## Log Format
The CSV file contains the following columns:
1. **Timestamp** - ISO 8601 timestamp of when the API was called
2. **API Endpoint** - The Freebit API endpoint (e.g., `/mvno/getDetail/`, `/master/addSpec/`)
3. **API Method** - HTTP method (typically "POST")
4. **Phone Number** - The phone number/SIM account identifier
5. **SIM Identifier** - Additional SIM identifier if available
6. **Request Payload** - JSON string of the request (sensitive data redacted)
7. **Response Status** - Success or error status code
8. **Error** - Error message if the call failed
9. **Additional Info** - Additional status information
## What Gets Tracked
The system automatically tracks all Freebit API calls that include a phone number/account identifier, including:
- **Physical SIM Activation** (`/master/addSpec/` or `/mvno/eachQuota/`)
- **SIM Top-up** (`/master/addSpec/` or `/mvno/eachQuota/`)
- **SIM Details** (`/mvno/getDetail/`)
- **SIM Usage** (`/mvno/getTrafficInfo/`)
- **Plan Changes** (`/mvno/changePlan/`)
- **SIM Cancellation** (`/mvno/releasePlan/`)
- **eSIM Operations** (`/esim/reissueProfile/`, `/mvno/esim/addAcnt/`)
- **Quota History** (`/mvno/getQuotaHistory/`)
## Usage
The tracking is **automatic** - no code changes needed. Every time a Freebit API is called with a phone number, it will be logged to the CSV file.
### Example Log Entry
```csv
Timestamp,API Endpoint,API Method,Phone Number,SIM Identifier,Request Payload,Response Status,Error,Additional Info
2025-01-15T10:30:45.123Z,/master/addSpec/,POST,02000002470001,02000002470001,"{""account"":""02000002470001"",""quota"":0}",Success,,"OK"
```
## Test Data Files
The following CSV files contain test SIM data:
- `ASI_N6_PASI_20251229.csv` - 半黒データ (Half-black data) - 50 SIMs (rows 1-50)
- `ASI_N7_PASI_20251229.csv` - 半黒音声 (Half-black voice) - 50 SIMs (rows 51-100)
Each row contains:
- Row number
- SIM number (phone number)
- PT number
- PASI identifier
- Date (20251229)
## Notes
- The tracking system only logs API calls that include a phone number/account identifier
- Tracking failures do not affect API functionality - if logging fails, the API call still proceeds
- The log file is append-only - new entries are added to the end of the file
- Request payloads are redacted for security (sensitive data like auth keys are removed)
## Viewing the Log
You can view the log file using any CSV viewer or text editor:
```bash
# View the log file
cat sim-api-test-log.csv
# View last 20 entries
tail -20 sim-api-test-log.csv
# Filter by phone number
grep "02000002470001" sim-api-test-log.csv
```