chiiya / passes

PHP library for creating iOS and Android Wallet Passes
MIT License
36 stars 16 forks source link

Google Pass EventTicketClass GET from API does not include `issuerName`, but `localizedIssuerName` #12

Open jdnwi opened 1 year ago

jdnwi commented 1 year ago

I'm working with the Google Pass for EventTicketClass. After successfully creating a Class, I am later retrieving it via the Event Ticket Class Repository GET function. The retrieval is OK, but the conversion to the Class object fails due to class validation on the API response.

Here is a sample API response:

{
  "allowMultipleUsersPerObject": true,
  "confirmationCodeLabel": "orderNumber",
  "dateTime": {
    "doorsOpen": "2023-01-18T17:30-05:00",
    "end": "2023-01-18T21:00-05:00",
    "kind": "walletobjects#eventDateTime",
    "start": "2023-01-18T18:30-05:00"
  },
  "eventId": "my-id",
  "eventName": {
    "defaultValue": {
      "kind": "walletobjects#translatedString",
      "language": "en",
      "value": "my event name"
    },
    "kind": "walletobjects#localizedString"
  },
  "homepageUri": {
    "uri": "my.uri"
  },
  "id": "3388000000022084756.my.uri_my-id",
  "kind": "walletobjects#eventTicketClass",
  "localizedIssuerName": {
    "defaultValue": {
      "kind": "walletobjects#translatedString",
      "language": "en",
      "value": "myissuer"
    },
    "kind": "walletobjects#localizedString"
  },
  "multipleDevicesAndHoldersAllowedStatus": "multipleHolders",
  "reviewStatus": "approved",
  "venue": {
    "address": {
      "defaultValue": {
        "kind": "walletobjects#translatedString",
        "language": "en",
        "value": "my address"
      },
      "kind": "walletobjects#localizedString"
    },
    "kind": "walletobjects#eventVenue",
    "name": {
      "defaultValue": {
        "kind": "walletobjects#translatedString",
        "language": "en",
        "value": "my location"
      },
      "kind": "walletobjects#localizedString"
    }
  },
  "version": "1"
}

BaseRepository calls the get function and when it runs return new $class($response); it throws a ValidationException with the message:

Validation errors:
     - `Chiiya\Passes\Google\Passes\EventTicketClass->issuerName`: The field is required.

The response does not include issuerName, but localizedIssuerName. I believe this should be corrected to match the API's response.

chiiya commented 1 year ago

Weird, according to the documentation it should be a required property: https://developers.google.com/wallet/tickets/events/rest/v1/eventticketclass#EventTicketClass Is this an issue only for the GET request?

jdnwi commented 1 year ago

Weird, according to the documentation it should be a required property: https://developers.google.com/wallet/tickets/events/rest/v1/eventticketclass#EventTicketClass Is this an issue only for the GET request?

Yes- it's only an issue in the GET request