-
Notifications
You must be signed in to change notification settings - Fork 3
Description
On my journey to find a fix for paynl/magento2-graphql#2 i ran into \PayNL\Sdk\Model\Request\TransactionStatusRequest which works for the most part.
The thing i run into is PayNL\Sdk\Model\Pay\PayOrder::getCapturedAmount(): Return value must be of type PayNL\Sdk\Model\Amount, null returned
Which makes sense as
php-sdk/src/Model/Pay/PayOrder.php
Line 523 in 9a132cc
| public function getCapturedAmount(): Amount |
claims it always returns an amount.
While this is not required, and even skipped in the construct.
php-sdk/src/Model/Pay/PayOrder.php
Line 150 in 9a132cc
| if (in_array($_key, ['amount', 'capturedAmount', 'authorizedAmount'])) { |
If setCapturedAmount is not called externally, getCapturedAmount will return null.
I recommend adding phpstan to the repo to prevent these kinds of issues in the future.
I reckon
turning
php-sdk/src/Model/Pay/PayOrder.php
Line 91 in 9a132cc
| protected $capturedAmount; |
into
- /**
- * @var Amount
- */
- protected $capturedAmount;
+ protected ?Amount $capturedAmount;would help phpstan in determining wether the value should be set on construct