Skip to content

feat(google): loyalty balance and account name on store cards - #82

Merged
alexpate merged 2 commits into
mainfrom
google-loyalty-balance
Oct 8, 2026
Merged

alexpate merged 2 commits into
mainfrom
google-loyalty-balance

Conversation

@alexpate

@alexpate alexpate commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

What

Adds google.loyalty to store cards so Google Wallet loyalty objects can show a native balance and the holder's name:

  • points / secondaryPoints: { label, balance } become loyaltyPoints / secondaryLoyaltyPoints. A string balance is sent as balance.string (so "6 / 10" works as-is), an int32 as balance.int, any other finite number as balance.double.
  • accountName: the holder's name. null leaves it off the object.
  • New exported types: GoogleLoyalty, GoogleLoyaltyPoints. README section and a minor changeset included.

Why

Store cards always put the pass description in accountName, which Google defines as the holder's name (for example "John Smith"). Stamp cards therefore showed "Stamp card for ..." there and had no native balance.

Testing

  • Render tests: each balance type, int32 overflow to double, secondary points, accountName set and null, class output unchanged.
  • Schema tests: accepted shape, rejection of empty label, empty string balance, NaN balance and empty accountName; other styles still strip google.
  • Full gate green: lint, type-check, build, test, bundle-guard, size (13.34 kB of 15 kB), test:workers, publint, attw.

Compatibility

Opt-in. Without google.loyalty the output is byte-for-byte what 0.6.0 renders, and accountName still defaults to the description (pinned by a full-payload test whose expected output was captured from the 0.6.0 release). Both fields are object-level, so a balance change never re-submits the class for review. Other styles ignore the key (it's stripped, as unknown keys always were). A malformed google value on a store card is now a schema error (it used to be stripped silently).

@alexpate
alexpate marked this pull request as ready for review October 8, 2026 15:56
@alexpate
alexpate merged commit 18927dc into main Oct 8, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant