The general Google Wallet class is not a string of two elements and detailed information is not displayed

76 views Asked by At

I followed the codelab for adding a new card to google wallet. But as a result, I get a card without the expected fields on the front and additional information. Below is the class description from the manual

  let genericClass = {
    'id': `${classId}`,
    'classTemplateInfo': {
      'cardTemplateOverride': {
        'cardRowTemplateInfos': [
          {
            'twoItems': {
              'startItem': {
                'firstValue': {
                  'fields': [
                    {
                      'fieldPath': 'object.textModulesData["points"]'
                    }
                  ]
                }
              },
              'endItem': {
                'firstValue': {
                  'fields': [
                    {
                      'fieldPath': 'object.textModulesData["contacts"]'
                    }
                  ]
                }
              }
            }
          }
        ]
      },
      'detailsTemplateOverride': {
        'detailsItemInfos': [
          {
            'item': {
              'firstValue': {
                'fields': [
                  {
                    'fieldPath': 'class.imageModulesData["event_banner"]'
                  }
                ]
              }
            }
          },
          {
            'item': {
              'firstValue': {
                'fields': [
                  {
                    'fieldPath': 'class.textModulesData["game_overview"]'
                  }
                ]
              }
            }
          },
          {
            'item': {
              'firstValue': {
                'fields': [
                  {
                    'fieldPath': 'class.linksModuleData.uris["official_site"]'
                  }
                ]
              }
            }
          }
        ]
      }
    },
    'imageModulesData': [
      {
        'mainImage': {
          'sourceUri': {
            'uri': 'https://storage.googleapis.com/wallet-lab-tools-codelab-artifacts-public/google-io-2021-card.png'
          },
          'contentDescription': {
            'defaultValue': {
              'language': 'en-US',
              'value': 'Google I/O 2022 Banner'
            }
          }
        },
        'id': 'event_banner'
      }
    ],
    'textModulesData': [
      {
        'header': 'Gather points meeting new people at Google I/O',
        'body': 'Join the game and accumulate points in this badge by meeting other attendees in the event.',
        'id': 'game_overview'
      }
    ],
    'linksModuleData': {
      'uris': [
        {
          'uri': 'https://io.google/2022/',
          'description': 'Official I/O \'22 Site',
          'id': 'official_site'
        }
      ]
    }
  };

So, if you exclude the ā€œdetailsTemplateOverrideā€ field from the object, then detailed information appears (default display). However, it is not possible to achieve correct display of information on the front of the card. enter image description here

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

1

There are 1 answers

0
MaximChemist On

The support service helped solve a similar problem. You need to replace 'object.textModulesData["points"]' with "object.textModulesData['points']".