Skip to content

Failure to convert transitObjects with classId and id #59

@fenech

Description

@fenech

Describe the bug

Exporting train tickets from sncf-connect.com, the JWT payload is like:

{
  "iss": "client-google-wallet@invictus-bdd7b.iam.gserviceaccount.com",
  "aud": "google",
  "typ": "savetowallet",
  "iat": "",
  "origins": [
    "https://www.sncf-connect.com"
  ],
  "payload": {
    "transitObjects": [
      {
        "classId": "99999999999999999999.ticket",
        "id": "99999999999999999999.000000001.<UUID>.1.0"
      },
      {
        "classId": "99999999999999999999.ticket",
        "id": "99999999999999999999.000000002.<UUID>.0.0"
      },
      {
        "classId": "99999999999999999999.ticket",
        "id": "99999999999999999999.000000003.<UUID>.2.0"
      }
    ]
  }
}

extracting the payload and attempting to pass this to the CLI app results in:

TypeError: passClasses.filter(...)[0] is not a constructor
    at createPassForType (/home/tom/dev/pass-converter/pass/index.js:763:10)
    at Pass.fromGoogle (/home/tom/dev/pass-converter/pass/index.js:173:18)
    at convertPassLocal (/home/tom/dev/pass-converter/app.js:448:25)
    at main (/home/tom/dev/pass-converter/app.js:475:11)
    at Object.<anonymous> (/home/tom/dev/pass-converter/app.js:485:1)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at Object..js (node:internal/modules/cjs/loader:1708:10)
    at Module.load (node:internal/modules/cjs/loader:1318:32)
    at Function._load (node:internal/modules/cjs/loader:1128:12)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)

To Reproduce
Steps to reproduce the behavior:

  1. Extract payload from JWT payload
  2. Run node app.js $PWD/tickets.json

Expected behavior
The transitObjects are successfully converted into PKPasses

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Linux
  • Browser: N/A
  • Version: node v22.12.0

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions