Skip to content

Commit 6cd1726

Browse files
committed
style google wallet pass
1 parent 74bb9f8 commit 6cd1726

1 file changed

Lines changed: 59 additions & 48 deletions

File tree

src/routes/passes.ts

Lines changed: 59 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import path from "path";
55
import { GoogleAuth } from "google-auth-library";
66
import jwt from "jsonwebtoken";
77

8-
98
const router = express.Router();
109

1110
const credentials = process.env.GOOGLE_APPLICATION_CREDENTIALS;
@@ -15,40 +14,39 @@ const Google = new GoogleAuth({
1514
scopes: ["https://www.googleapis.com/auth/wallet_object.issuer"],
1615
});
1716
const baseUrl = "https://walletobjects.googleapis.com/walletobjects/v1";
18-
const classId = `${issuerId}.hackathon2025`;
17+
const classId = `${issuerId}.hackthe6ix`;
1918

2019
async function createPassClass(): Promise<void> {
2120
const httpClient = await Google.getClient();
2221

2322
let genericClass = {
24-
"id": classId,
25-
"eventName": {
26-
"defaultValue": {
27-
"language": "en-US",
28-
"value": "Hack The 6ix 2025"
29-
}
30-
},
31-
"issuerName": "Hack The 6ix",
32-
"reviewStatus": "UNDER_REVIEW",
33-
"seatNumberLabel": {
34-
"defaultValue": {
35-
"language": "en-US",
36-
"value": "Team"
37-
}
38-
},
39-
"locations": [
40-
{
41-
"latitude": 43.7731,
42-
"longitude": 79.5038
43-
}
44-
],
45-
"startDate": "2025-09-12T09:00:00Z",
46-
"endDate": "2025-09-14T18:00:00Z",
47-
"hexBackgroundColor": "#4285F4",
48-
"logo": {
49-
"sourceUri": { "uri": "https://hackthe6ix.com/icon.png?c9f2203f230562e3" },
50-
"contentDescription": {
51-
"defaultValue": { "language":"en-US","value":"Hackathon Logo" }
23+
'id': `${classId}`,
24+
'classTemplateInfo': {
25+
'cardTemplateOverride': {
26+
'cardRowTemplateInfos': [
27+
{
28+
'twoItems': {
29+
'startItem': {
30+
'firstValue': {
31+
'fields': [
32+
{
33+
'fieldPath': 'object.textModulesData[\'address\']'
34+
}
35+
]
36+
}
37+
},
38+
'endItem': {
39+
'firstValue': {
40+
'fields': [
41+
{
42+
'fieldPath': 'object.textModulesData[\'date\']'
43+
}
44+
]
45+
}
46+
}
47+
}
48+
}
49+
]
5250
}
5351
}
5452
};
@@ -88,22 +86,24 @@ async function createPassObject(userID: string, userType: string): Promise<strin
8886
let objectSuffix = `${userID.replace(/[^\w.-]/g, '_')}`;
8987

9088
let genericObject = {
91-
"id": `${issuerId}.${objectSuffix}`,
92-
"classId": classId,
93-
"state": "ACTIVE",
89+
'id': `${issuerId}.${objectSuffix}`,
90+
'classId': classId,
91+
'genericType': 'GENERIC_TYPE_UNSPECIFIED',
92+
'state': 'ACTIVE',
9493
'cardTitle': {
9594
'defaultValue': {
96-
'language': 'en',
97-
'value': 'Hack The 6ix 2025'
95+
'language': 'en',
96+
'value': 'Hack The 6ix 2025'
9897
}
9998
},
100-
"barcode": {
101-
"type": "QR_CODE",
102-
"value": JSON.stringify({
103-
userID: userID,
104-
userType: userType,
99+
'hexBackgroundColor': '#CFEDAF',
100+
'barcode': {
101+
'type': 'QR_CODE',
102+
'value': JSON.stringify({
103+
'userID': userID,
104+
'userType': userType,
105105
}),
106-
"alternateText": `${userID}`
106+
'alternateText': `${userID}`
107107
},
108108
'subheader': {
109109
'defaultValue': {
@@ -113,20 +113,31 @@ async function createPassObject(userID: string, userType: string): Promise<strin
113113
},
114114
'header': {
115115
'defaultValue': {
116-
'language': 'en',
117-
'value': `${userID}`
116+
'language': 'en',
117+
'value': `Winston Yu`
118118
}
119119
},
120120
'heroImage': {
121121
'sourceUri': {
122-
'uri': 'https://storage.googleapis.com/wallet-lab-tools-codelab-artifacts-public/google-io-hero-demo-only.jpg'
122+
'uri': 'https://miro.medium.com/v2/resize:fit:1400/1*IMRytrOprJjmRPKEdtt6Aw.png'
123123
}
124124
},
125-
"textModulesData": [
126-
{
127-
"header": "Check-In Instructions",
128-
"body": "Please show this QR code at the door."
125+
'logo': {
126+
'sourceUri': {
127+
'uri': 'https://hackthe6ix.com/icon.png?c9f2203f230562e3'
129128
}
129+
},
130+
'textModulesData': [
131+
{
132+
'id': 'address',
133+
'header': 'Address',
134+
'body': 'York University Keele Campus,\n Accolade East Building'
135+
},
136+
{
137+
'id': 'date',
138+
'header': 'July 18, 2025',
139+
'body': '8:00 PM'
140+
}
130141
]
131142
}
132143

0 commit comments

Comments
 (0)