Skip to content

Commit

Permalink
fix(null): handle nullable postcode and state ZNA (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomtomau authored Apr 20, 2023
1 parent bb6e9f9 commit 5753351
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
6 changes: 2 additions & 4 deletions src/Model/AbnResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,10 @@ final class AbnResponse extends AbstractResponse
public \DateTimeImmutable $addressDate;

#[SerializedName('AddressPostcode')]
#[NotBlank]
public string $addressPostcode;
public ?string $addressPostcode;

#[SerializedName('AddressState')]
#[NotBlank]
public string $addressState;
public ?string $addressState;

/**
* @var string[]
Expand Down
10 changes: 8 additions & 2 deletions tests/Model/AbnResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ public function getValidTests(): \Generator
$fields = MockAbnResponse::valid();
$fields['Gst'] = null;
yield 'no gst' => [$fields];

$fields = MockAbnResponse::valid();
$fields['AddressState'] = null;
yield 'no address state' => [$fields];

$fields = MockAbnResponse::valid();
$fields['AddressPostcode'] = null;
yield 'no AddressPostcode' => [$fields];
}

/**
Expand Down Expand Up @@ -85,8 +93,6 @@ public function getInvalidTests(): \Generator
'AbnStatus',
'AbnStatusEffectiveFrom',
'AddressDate',
'AddressPostcode',
'AddressState',
'EntityName',
'EntityTypeCode',
'EntityTypeName',
Expand Down

0 comments on commit 5753351

Please sign in to comment.