-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Allow null product IDs in transaction preview responses (#90)
- Loading branch information
1 parent
807fd31
commit c4549fc
Showing
7 changed files
with
125 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/** | ||
* |------ | ||
* | ! Generated code ! | ||
* | Altering this code will result in changes being overwritten | | ||
* |-------------------------------------------------------------|. | ||
*/ | ||
|
||
namespace Paddle\SDK\Entities\Transaction; | ||
|
||
use Paddle\SDK\Entities\DateTime; | ||
use Paddle\SDK\Entities\Entity; | ||
use Paddle\SDK\Entities\Shared\CatalogType; | ||
use Paddle\SDK\Entities\Shared\CustomData; | ||
use Paddle\SDK\Entities\Shared\ImportMeta; | ||
use Paddle\SDK\Entities\Shared\Status; | ||
use Paddle\SDK\Entities\Shared\TaxCategory; | ||
|
||
class TransactionPreviewProduct implements Entity | ||
{ | ||
private function __construct( | ||
public string|null $id, | ||
public string $name, | ||
public string|null $description, | ||
public CatalogType|null $type, | ||
public TaxCategory $taxCategory, | ||
public string|null $imageUrl, | ||
public CustomData|null $customData, | ||
public Status $status, | ||
public ImportMeta|null $importMeta, | ||
public \DateTimeInterface $createdAt, | ||
public \DateTimeInterface $updatedAt, | ||
) { | ||
} | ||
|
||
public static function from(array $data): self | ||
{ | ||
return new self( | ||
id: $data['id'] ?? null, | ||
name: $data['name'], | ||
description: $data['description'] ?? null, | ||
type: CatalogType::from($data['type'] ?? ''), | ||
taxCategory: TaxCategory::from($data['tax_category']), | ||
imageUrl: $data['image_url'] ?? null, | ||
customData: isset($data['custom_data']) ? new CustomData($data['custom_data']) : null, | ||
status: Status::from($data['status']), | ||
importMeta: isset($data['import_meta']) ? ImportMeta::from($data['import_meta']) : null, | ||
createdAt: DateTime::from($data['created_at']), | ||
updatedAt: DateTime::from($data['updated_at']), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters