Skip to content

Commit 51dc764

Browse files
authored
Merge pull request #4 from jolicode/feature/update-google-spec-20260410
2 parents 24c5651 + bf1850e commit 51dc764

9 files changed

Lines changed: 444 additions & 4 deletions

File tree

AGENTS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ castor spec:check:samsung # Samsung model keyset
3030
castor spec:baseline:google # Refresh Google baseline
3131
castor spec:baseline:apple # Refresh Apple keyset
3232
castor spec:baseline:samsung # Refresh Samsung keyset
33+
castor spec:diff:google # Diff live discovery enums against PHP models
34+
castor spec:diff:google --properties # Include schema property comparison
3335
```
3436

3537
CI runs 4 jobs: cs-check, spec-check, phpstan, and tests (PHP 8.3/8.4/8.5 matrix).

castor.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ function spec_baseline_google(): void
8080
run([spec_tools_php(), __DIR__ . '/tools/spec/google-wallet-spec.php', 'baseline']);
8181
}
8282

83+
#[AsTask('diff:google', namespace: 'spec', description: 'Diff live Google Wallet discovery enums/properties against PHP models')]
84+
function spec_diff_google(bool $properties = false): void
85+
{
86+
$args = [spec_tools_php(), __DIR__ . '/tools/spec/google-wallet-diff.php'];
87+
if ($properties) {
88+
$args[] = '--properties';
89+
}
90+
run($args);
91+
}
92+
8393
#[AsTask('check:samsung', namespace: 'spec', description: 'Compare Samsung Wallet phpstan keyset to tools/spec/samsung-wallet-keyset.json')]
8494
function spec_check_samsung(): void
8595
{

src/Pass/Android/Model/Flight/FlightClass.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,13 @@
3939
* @phpstan-import-type AppLinkDataType from AppLinkData
4040
* @phpstan-import-type BoardingPolicy from BoardingPolicyEnum
4141
* @phpstan-import-type SeatClassPolicy from SeatClassPolicyEnum
42+
* @phpstan-import-type FlightStatus from FlightStatusEnum
4243
* @phpstan-import-type MerchantLocationType from MerchantLocation
4344
* @phpstan-import-type ValueAddedModuleDataType from ValueAddedModuleData
4445
* @phpstan-import-type NotifyPreference from NotifyPreferenceEnum
4546
* @phpstan-import-type ReviewType from Review
4647
*
47-
* @phpstan-type FlightClassType array{id: string, issuerName: string, reviewStatus: ReviewStatus, origin: AirportInfoType, destination: AirportInfoType, flightHeader: FlightHeaderType, localScheduledDepartureDateTime?: string, localEstimatedOrActualDepartureDateTime?: string, localBoardingDateTime?: string, localScheduledArrivalDateTime?: string, localEstimatedOrActualArrivalDateTime?: string, localGateClosingDateTime?: string, boardingPolicy?: BoardingPolicy, seatClassPolicy?: SeatClassPolicy, localizedIssuerName?: LocalizedStringType, hexBackgroundColor?: string, countryCode?: string, heroImage?: ImageType, enableSmartTap?: bool, redemptionIssuers?: list<string>, multipleDevicesAndHoldersAllowedStatus?: MultipleDevicesAndHoldersAllowedStatus, callbackOptions?: CallbackOptionsType, securityAnimation?: SecurityAnimationType, viewUnlockRequirement?: ViewUnlockRequirement, messages?: list<GoogleMessageType>, imageModulesData?: list<ImageModuleDataType>, textModulesData?: list<TextModuleDataType>, linksModuleData?: LinksModuleDataType, appLinkData?: AppLinkDataType, languageOverride?: string, merchantLocations?: list<MerchantLocationType>, valueAddedModuleData?: list<ValueAddedModuleDataType>, notifyPreference?: NotifyPreference, review?: ReviewType}
48+
* @phpstan-type FlightClassType array{id: string, issuerName: string, reviewStatus: ReviewStatus, origin: AirportInfoType, destination: AirportInfoType, flightHeader: FlightHeaderType, localScheduledDepartureDateTime?: string, localEstimatedOrActualDepartureDateTime?: string, localBoardingDateTime?: string, localScheduledArrivalDateTime?: string, localEstimatedOrActualArrivalDateTime?: string, localGateClosingDateTime?: string, flightStatus?: FlightStatus, boardingPolicy?: BoardingPolicy, seatClassPolicy?: SeatClassPolicy, localizedIssuerName?: LocalizedStringType, hexBackgroundColor?: string, countryCode?: string, heroImage?: ImageType, enableSmartTap?: bool, redemptionIssuers?: list<string>, multipleDevicesAndHoldersAllowedStatus?: MultipleDevicesAndHoldersAllowedStatus, callbackOptions?: CallbackOptionsType, securityAnimation?: SecurityAnimationType, viewUnlockRequirement?: ViewUnlockRequirement, messages?: list<GoogleMessageType>, imageModulesData?: list<ImageModuleDataType>, textModulesData?: list<TextModuleDataType>, linksModuleData?: LinksModuleDataType, appLinkData?: AppLinkDataType, languageOverride?: string, merchantLocations?: list<MerchantLocationType>, valueAddedModuleData?: list<ValueAddedModuleDataType>, notifyPreference?: NotifyPreference, review?: ReviewType}
4849
*/
4950
class FlightClass
5051
{
@@ -69,6 +70,7 @@ public function __construct(
6970
public ?string $localScheduledArrivalDateTime = null,
7071
public ?string $localEstimatedOrActualArrivalDateTime = null,
7172
public ?string $localGateClosingDateTime = null,
73+
public ?FlightStatusEnum $flightStatus = null,
7274
public ?BoardingPolicyEnum $boardingPolicy = null,
7375
public ?SeatClassPolicyEnum $seatClassPolicy = null,
7476
public ?LocalizedString $localizedIssuerName = null,
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Jolicode\WalletKit\Pass\Android\Model\Flight;
6+
7+
/**
8+
* @phpstan-type FlightStatus 'FLIGHT_STATUS_UNSPECIFIED'|'SCHEDULED'|'ACTIVE'|'LANDED'|'CANCELLED'|'REDIRECTED'|'DIVERTED'
9+
*/
10+
enum FlightStatusEnum: string
11+
{
12+
case UNSPECIFIED = 'FLIGHT_STATUS_UNSPECIFIED';
13+
case SCHEDULED = 'SCHEDULED';
14+
case ACTIVE = 'ACTIVE';
15+
case LANDED = 'LANDED';
16+
case CANCELLED = 'CANCELLED';
17+
case REDIRECTED = 'REDIRECTED';
18+
case DIVERTED = 'DIVERTED';
19+
}

src/Pass/Android/Model/Shared/ReviewStatusEnum.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@
55
namespace Jolicode\WalletKit\Pass\Android\Model\Shared;
66

77
/**
8-
* @phpstan-type ReviewStatus 'DRAFT'|'UNDER_REVIEW'|'APPROVED'
8+
* @phpstan-type ReviewStatus 'REVIEW_STATUS_UNSPECIFIED'|'DRAFT'|'UNDER_REVIEW'|'APPROVED'|'REJECTED'
99
*/
1010
enum ReviewStatusEnum: string
1111
{
12+
case UNSPECIFIED = 'REVIEW_STATUS_UNSPECIFIED';
1213
case DRAFT = 'DRAFT';
1314
case UNDER_REVIEW = 'UNDER_REVIEW';
1415
case APPROVED = 'APPROVED';
16+
case REJECTED = 'REJECTED';
1517
}

src/Pass/Android/Normalizer/Flight/FlightClassNormalizer.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@ public function normalize(mixed $object, ?string $format = null, array $context
5757
$data['localGateClosingDateTime'] = $object->localGateClosingDateTime;
5858
}
5959

60+
if (null !== $object->flightStatus) {
61+
$data['flightStatus'] = $object->flightStatus->value;
62+
}
63+
6064
if (null !== $object->boardingPolicy) {
6165
$data['boardingPolicy'] = $object->boardingPolicy->value;
6266
}

tests/Pass/Android/Normalizer/FlightNormalizerTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Jolicode\WalletKit\Pass\Android\Model\Flight\FlightClass;
1414
use Jolicode\WalletKit\Pass\Android\Model\Flight\FlightHeader;
1515
use Jolicode\WalletKit\Pass\Android\Model\Flight\FlightObject;
16+
use Jolicode\WalletKit\Pass\Android\Model\Flight\FlightStatusEnum;
1617
use Jolicode\WalletKit\Pass\Android\Model\Flight\FrequentFlyerInfo;
1718
use Jolicode\WalletKit\Pass\Android\Model\Flight\ReservationInfo;
1819
use Jolicode\WalletKit\Pass\Android\Model\Flight\SeatClassPolicyEnum;
@@ -189,6 +190,7 @@ public function testFlightPass(): void
189190
localScheduledDepartureDateTime: '2025-08-15T10:00',
190191
localScheduledArrivalDateTime: '2025-08-15T14:30',
191192
localBoardingDateTime: '2025-08-15T09:30',
193+
flightStatus: FlightStatusEnum::SCHEDULED,
192194
boardingPolicy: BoardingPolicyEnum::ZONE_BASED,
193195
seatClassPolicy: SeatClassPolicyEnum::CABIN_BASED,
194196
hexBackgroundColor: Color::fromHex('#003366'),
@@ -235,6 +237,7 @@ classId: 'flight-class-1',
235237
self::assertSame('JFK', $classData['destination']['airportIataCode']);
236238
self::assertSame('AF', $classData['flightHeader']['carrier']['carrierIataCode']);
237239
self::assertSame('123', $classData['flightHeader']['flightNumber']);
240+
self::assertSame('SCHEDULED', $classData['flightStatus']);
238241
self::assertSame('ZONE_BASED', $classData['boardingPolicy']);
239242

240243
self::assertSame('flight-object-1', $objectData['id']);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"revision": "20260409",
2+
"revision": "20260410",
33
"version": "v1",
4-
"updatedAt": "2026-04-09T20:19:32+00:00"
4+
"updatedAt": "2026-04-10T22:43:31+00:00"
55
}

0 commit comments

Comments
 (0)