diff --git a/src/edutap/wallet_google/modelbase.py b/src/edutap/wallet_google/modelbase.py index c464e3f..8c02f4a 100644 --- a/src/edutap/wallet_google/modelbase.py +++ b/src/edutap/wallet_google/modelbase.py @@ -1,5 +1,20 @@ +from .models.primitives import CallbackOptions +from .models.primitives import GroupingInfo +from .models.primitives import Image +from .models.primitives import PassConstraints +from .models.primitives import SecurityAnimation +from .models.primitives.barcode import Barcode +from .models.primitives.barcode import RotatingBarcode +from .models.primitives.class_template_info import ClassTemplateInfo +from .models.primitives.data import ImageModuleData +from .models.primitives.data import InfoModuleData +from .models.primitives.data import LinksModuleData +from .models.primitives.data import TextModuleData +from .models.primitives.enums import ViewUnlockRequirement +from .models.primitives.notification import Message from pydantic import BaseModel from pydantic import ConfigDict +from pydantic import Field class GoogleWalletModel(BaseModel): @@ -9,6 +24,7 @@ class GoogleWalletModel(BaseModel): model_config = ConfigDict( extra="forbid", + # extra="ignore", use_enum_values=True, ) @@ -18,6 +34,7 @@ class GoogleWalletWithIdModel(GoogleWalletModel): Base model for Google Wallet models with an identifier. """ + kind: str | None = Field(description="deprecated", exclude=True, default=None) id: str @@ -26,6 +43,36 @@ class GoogleWalletClassModel(GoogleWalletWithIdModel): Base model for all Google Wallet Class models. """ + classTemplateInfo: ClassTemplateInfo | None = None + imageModulesData: list[ImageModuleData] | None = None + textModulesData: list[TextModuleData] | None = None + linksModuleData: LinksModuleData | None = None + infoModuleData: InfoModuleData | None = Field( + description="deprecated", exclude=True, default=None + ) + + # Callback Options + callbackOptions: CallbackOptions | None = None + + # Smarttap Options + enableSmartTap: bool | None = None + redemptionIssuers: list[str] | None = None # string (int64 format) + + # Barcode Options + securityAnimation: SecurityAnimation | None = None + + # Security Options + viewUnlockRequirement: ViewUnlockRequirement = ( + ViewUnlockRequirement.VIEW_UNLOCK_REQUIREMENT_UNSPECIFIED + ) + + # Design Options + hexBackgroundColor: str | None = None + logo: Image | None = None + wideLogo: Image | None = None + heroImage: Image | None = None + wordMark: Image | None = Field(description="deprecated", exclude=True, default=None) + class GoogleWalletObjectModel(GoogleWalletWithIdModel): """ @@ -34,10 +81,27 @@ class GoogleWalletObjectModel(GoogleWalletWithIdModel): classId: str + groupingInfo: GroupingInfo | None = None + + # Security Options + passConstraints: PassConstraints | None = None + + # Barcode Options + barcode: Barcode | None = None + rotatingBarcode: RotatingBarcode | None = None + + +class GoogleWalletObjectReference(GoogleWalletObjectModel): + """ + Model for all Google Wallet Object with a Class references. + """ + + classReference: GoogleWalletClassModel | None = None + -class GoogleWalletObjectReference(GoogleWalletWithIdModel): +class GoogleWalletMessageble(GoogleWalletWithIdModel): """ - Model for all Google Wallet Object references. + Model for Google Wallet Classes or Objects that can retrieve Messages """ - classId: str | None = None + messages: list[Message] | None = None diff --git a/src/edutap/wallet_google/models/retail.py b/src/edutap/wallet_google/models/retail.py index 954e2ad..c395590 100644 --- a/src/edutap/wallet_google/models/retail.py +++ b/src/edutap/wallet_google/models/retail.py @@ -1,4 +1,5 @@ from ..modelbase import GoogleWalletClassModel +from ..modelbase import GoogleWalletMessageble from ..modelbase import GoogleWalletObjectModel from ..registry import register_model from .primitives import CallbackOptions @@ -72,17 +73,17 @@ class GiftCardClass(GoogleWalletClassModel): imageModulesData: list[ImageModuleData] | None = None textModulesData: list[TextModuleData] | None = None linksModuleData: LinksModuleData | None = None - redemptionIssuers: list[str] | None = None + # redemptionIssuers: list[str] | None = None countryCode: str | None = None - heroImage: Image | None = None + # heroImage: Image | None = None wordMark: Image | None = Field(description="deprecated", exclude=True, default=None) - enableSmartTap: bool | None = None + # enableSmartTap: bool | None = None hexBackgroundColor: str | None = None localizedIssuerName: LocalizedString | None = None multipleDevicesAndHoldersAllowedStatus: MultipleDevicesAndHoldersAllowedStatus = ( MultipleDevicesAndHoldersAllowedStatus.STATUS_UNSPECIFIED ) - callbackOptions: CallbackOptions | None = None + # callbackOptions: CallbackOptions | None = None securityAnimation: SecurityAnimation | None = None viewUnlockRequirement: ViewUnlockRequirement = ( ViewUnlockRequirement.VIEW_UNLOCK_REQUIREMENT_UNSPECIFIED @@ -109,6 +110,7 @@ class GiftCardObject(GoogleWalletObjectModel): locations: list[LatLongPoint] | None = None hasUsers: bool = False smartTapRedemptionValue: str | None = None + smartTapRedemptionLevel: str | None = None hasLinkedDevice: bool = False disableExpirationNotification: bool | None = False infoModuleData: InfoModuleData | None = None @@ -118,14 +120,14 @@ class GiftCardObject(GoogleWalletObjectModel): appLinkData: AppLinkData | None = None rotatingBarcode: RotatingBarcode | None = None heroImage: Image | None = None - groupingInfo: GroupingInfo | None = None - passConstraints: PassConstraints | None = None + # groupingInfo: GroupingInfo | None = None + # passConstraints: PassConstraints | None = None @register_model( "LoyaltyClass", url_part="loyaltyClass", plural="loyaltyClasses", can_disable=False ) -class LoyaltyClass(GoogleWalletClassModel): +class LoyaltyClass(GoogleWalletClassModel, GoogleWalletMessageble): """ see: https://developers.google.com/wallet/retail/loyalty-cards/rest/v1/loyaltyclass """ @@ -133,6 +135,9 @@ class LoyaltyClass(GoogleWalletClassModel): issuerName: str | None = None programName: str | None = None programLogo: Image | None = None + logo: Image | None = Field( + alias="programLogo", serialization_alias="programLogo", default=None + ) wideProgramLogo: Image | None = None reviewStatus: ReviewStatus = ReviewStatus.REVIEW_STATUS_UNSPECIFIED accountNameLabel: str | None = None @@ -150,23 +155,23 @@ class LoyaltyClass(GoogleWalletClassModel): localizedSecondaryRewardsTierLabel: LocalizedString | None = None localizedSecondaryRewardsTier: LocalizedString | None = None discoverableProgram: DiscoverableProgram | None = None - classTemplateInfo: ClassTemplateInfo | None = None + # classTemplateInfo: ClassTemplateInfo | None = None messages: list[Message] | None = None homepageUri: Uri | None = None locations: list[LatLongPoint] | None = None review: Review | None = None - imageModulesData: list[ImageModuleData] | None = None - textModulesData: list[TextModuleData] | None = None - linksModuleData: LinksModuleData | None = None - redemptionIssuers: list[str] | None = None # string (int64 format) + # imageModulesData: list[ImageModuleData] | None = None + # textModulesData: list[TextModuleData] | None = None + # linksModuleData: LinksModuleData | None = None + # redemptionIssuers: list[str] | None = None # string (int64 format) countryCode: str | None = None heroImage: Image | None = None - enableSmartTap: bool | None = False - hexBackgroundColor: str | None = None + # enableSmartTap: bool | None = False + # hexBackgroundColor: str | None = None multipleDevicesAndHoldersAllowedStatus: MultipleDevicesAndHoldersAllowedStatus = ( MultipleDevicesAndHoldersAllowedStatus.STATUS_UNSPECIFIED ) - callbackOptions: CallbackOptions | None + # callbackOptions: CallbackOptions | None securityAnimation: SecurityAnimation | None = None viewUnlockRequirement: ViewUnlockRequirement = ( ViewUnlockRequirement.VIEW_UNLOCK_REQUIREMENT_UNSPECIFIED