Search code examples
walletgoogle-wallet

Google Wallet Generic Class (two-item row is not shown)


I followed the codelab for adding a new card to google wallet (of course I used the business profile of the company and the issuer id was not temporary).

As one of steps, I added one row with two items, in generic_class.js,but it is not shown in the final generated card

'classTemplateInfo': {
'cardTemplateOverride': {
  'cardRowTemplateInfos': [
    {
      'twoItems': {
        'startItem': {
          'firstValue': {
            'fields': [
              {
                'fieldPath': 'object.textModulesData["company"]',
              },
            ],
          },
        },
        'endItem': {
          'firstValue': {
            'fields': [
              {
                'fieldPath': 'object.textModulesData["badgeId"]',
              },
            ],
          },
        },
      },
    },
  ],
}

(of course, if I click on details, they are shown in the bottom, outside of the card).

enter image description here

Then I noticed that the final card of the codelab is also without the row!

enter image description here

So I want to add two or three rows to my generic_class like the pass builder, any idea? enter image description here

I searched the web and asked wallet support team, no answer yet.


Solution

  • OMG, I found the solution! I wrongly updated the class :-| It should be like this:

      updatedClass['classTemplateInfo'] = {
        "cardTemplateOverride": {
          "cardRowTemplateInfos": [
            {
              "twoItems": {
                "startItem": {
                  "firstValue": {
                    "fields": [
                      {
                        "fieldPath": "object.textModulesData['company']"
                      }
                    ]
                  }
                },
                "endItem": {
                  "firstValue": {
                    "fields": [
                      {
                        "fieldPath": "object.textModulesData['badgeId']"
                      }
                    ]
                  }
                }
              }
            }
          ]
        }
    

    };

    I had written an extra 'classTemplateInfo': { under the updatedClass['classTemplateInfo'] = { and that's why it didn't work!

    the final result of the Card with row!