Skip to content

Commit 833fb82

Browse files
authored
Update PaymentTransaction.php
1 parent 57069ce commit 833fb82

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Model/Response/PaymentTransaction.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ class PaymentTransaction
1414
public ?string $description;
1515
public PaymentTransactionRedirect $redirects;
1616
public PaymentTransactionCustomer $customer;
17-
public PaymentTransactionAddress $billing;
18-
public PaymentTransactionAddress $shipping;
17+
public ?PaymentTransactionAddress $billing;
18+
public ?PaymentTransactionAddress $shipping;
1919
/**
2020
* @var PaymentTransactionCartItem[]|null
2121
*/
2222
public ?array $cart;
23-
public \DateTimeImmutable $paidAt;
23+
public ?\DateTimeImmutable $paidAt;
2424
public ?\DateTimeImmutable $expiresAt;
2525
public \DateTimeImmutable $createdAt;
2626
public \DateTimeImmutable $updatedAt;
@@ -34,10 +34,10 @@ private function __construct(
3434
?string $description,
3535
PaymentTransactionRedirect $redirects,
3636
PaymentTransactionCustomer $customer,
37-
PaymentTransactionAddress $billing,
38-
PaymentTransactionAddress $shipping,
37+
?PaymentTransactionAddress $billing,
38+
?PaymentTransactionAddress $shipping,
3939
?array $cart,
40-
\DateTimeImmutable $paidAt,
40+
?\DateTimeImmutable $paidAt,
4141
?\DateTimeImmutable $expiresAt,
4242
\DateTimeImmutable $createdAt,
4343
\DateTimeImmutable $updatedAt
@@ -76,8 +76,8 @@ public static function createFromResponse(array $data): self
7676
$data['description'],
7777
PaymentTransactionRedirect::createFromResponse($data['redirect']),
7878
PaymentTransactionCustomer::createFromResponse($data['customer']),
79-
PaymentTransactionAddress::createFromResponse($data['billing']),
80-
PaymentTransactionAddress::createFromResponse($data['shipping']),
79+
empty($data['billing']) ? null : PaymentTransactionAddress::createFromResponse($data['billing']),
80+
empty($data['shipping']) ? null : PaymentTransactionAddress::createFromResponse($data['shipping']),
8181
$cartItems,
8282
new \DateTimeImmutable($data['paid_at']),
8383
new \DateTimeImmutable($data['expires_at']),

0 commit comments

Comments
 (0)