Reputation: 21
i am trying to generate generic google wallet pass. i have been able to do that successfully but the issue i have is that i am unable to see the text fields that i override in cardTemplateOverride object. These are 'contacts' and 'points' fields. Attaching the code for reference.
async function createPassClass(req, res) {
// TODO: Create a Generic pass class
let genericClass = {
'id': `${classId}`,
'classTemplateInfo': {
'cardTemplateOverride': {
'cardRowTemplateInfos': [
{
'twoItems': {
'startItem': {
'firstValue': {
'fields': [
{
'fieldPath': 'object.textModulesData["points"]'
}
]
}
},
'endItem': {
'firstValue': {
'fields': [
{
'fieldPath': 'object.textModulesData["contacts"]'
}
]
}
}
}
}
]
},
},
};
}
async function createPassObject(req, res) {
// TODO: Create a new Generic pass for the user
let objectSuffix = `${req.body.email.replace(/[^\w.-]/g, '_')}`;
let objectId = `${issuerId}.${objectSuffix}`;
let genericObject = {
'cardTitle': {
'defaultValue': {
'language': 'en',
'value': 'Google I/O \'22'
}
},
'textModulesData': [
{
'header': 'POINTS',
'body': '1234',
'id': 'points'
},
{
'header': 'CONTACTS',
'body': '20',
'id': 'contacts'
}
]
};
}
;```
This is the exact code given in google codelab and it's not working as expected like it should show the Contacts and Points fields on the pass but it isn't.
Upvotes: 1
Views: 1507
Reputation: 227
Where you able to fix this issue I am trying the same thing with google sdk but the details doesn't show on the pass. But shows in the details screen.
"cardTemplateOverride": {
"cardRowTemplateInfos": [
{
"twoItems": {
"startItem": {
"firstValue": {
"fields": [
{
"fieldPath": "object.textModulesData['name']"
}
]
}
},
"endItem": {
"firstValue": {
"fields": [
{
"fieldPath": "object.textModulesData['member']"
}
]
}
}
}
}
]
}
Upvotes: 1
Reputation: 817
You need to reference your class into your object.
'id': `${objectId}`,
'classId': `${issuerId}.${classSuffix}`,
'genericType': 'GENERIC_TYPE_UNSPECIFIED',
Upvotes: 0
Reputation: 1
Yes even i had same issues. but i tried generic class and object from here Something Went Wrong - Google Wallet API Pass Creation
they did work, and i modified according to my code. i believe its because of the quotes
Upvotes: 0