You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document describes the changes made to integrate the JSON API response format into the RAS Member Portal. The API now returns data exclusively in a JSON format that includes membership information, payment history, and available snack items.
5
+
6
+
## API Response Format
7
+
8
+
The API now returns data in the following format:
9
+
```json
10
+
{
11
+
"eid": "km54774",
12
+
"timestamp": "2025-10-09T17:04:31.788Z",
13
+
"payments": [
14
+
"id:km54774;shirtM:1",
15
+
"rasform25;id:km54774;shirtm:1;shirtl:1",
16
+
"rasform25;id:km54774;poptarts:1"
17
+
],
18
+
"snack": [
19
+
{
20
+
"id": "chips",
21
+
"text": "Chips",
22
+
"price": 50,
23
+
"online": 0,
24
+
"irl": 1
25
+
},
26
+
{
27
+
"id": "caprisun",
28
+
"text": "Capri Sun",
29
+
"price": 50,
30
+
"online": 0,
31
+
"irl": 1
32
+
}
33
+
]
34
+
}
35
+
```
36
+
37
+
## Changes Made
38
+
39
+
### 1. Cleaned up `eidStats.js`:
40
+
- Removed all CSV-related code as the API now only returns JSON
41
+
- Simplified data processing functions to handle only JSON
42
+
- Created functionality to extract payment information from the payments array
43
+
- Added handling of snack data from the API
44
+
- Updated the member existence check to use the timestamp as an indicator of form completion
45
+
46
+
### 2. Updated Shop Functionality:
47
+
- Modified shop generation to use snack data from the API when available
48
+
49
+
### 3. Added Diagnostic Tools:
50
+
- Created a test module (`testApiIntegration.js`) to verify API integration
51
+
- Added a test button to the UI for development purposes
52
+
53
+
## Technical Details
54
+
55
+
### JSON Payment Data Handling
56
+
The system now parses payment data from an array of strings, where each string may contain multiple items in a semicolon-delimited format. The system extracts item IDs and quantities and aggregates them into a purchases object.
57
+
58
+
### Snack Data Handling
59
+
The API now provides a list of available snack items with details such as price, name, and availability (online/in-person). The shop functionality now incorporates these items when displaying the shop interface.
60
+
61
+
### Member Existence Check
62
+
The timestamp field in the API response is used to determine whether a member has completed the membership form. If the timestamp is present and non-empty, the member is considered to have filled out the form.
63
+
64
+
## Testing
65
+
66
+
To test the API integration:
67
+
1. Load the member portal page
68
+
2. Enter the test EID "km54774"
69
+
3. Click the "Run API Integration Tests" button at the bottom of the page
0 commit comments