concardis / PHP_SDK

MIT License
3 stars 10 forks source link

Fatal error when trying to get a transaction of an order #5

Closed ocean90 closed 6 years ago

ocean90 commented 6 years ago

Since b0301ffb5e8a314c6466b37b78de649e2f5efbf3 I'm getting a fatal error when requesting an transaction through $payengine->orders( $order_id )->transactions( $transaction_id )->get();

Fatal error: Uncaught TypeError: Argument 2 passed to Concardis\Payengine\Lib\Internal\AbstractClass\AbstractModel::getSubmodel() must be of the type array, string given, called in /vendor/payengine/php_sdk/src/Concardis/Payengine/Lib/Internal/AbstractClass/AbstractModel.php on line 102 and defined in /vendor/payengine/php_sdk/src/Concardis/Payengine/Lib/Internal/AbstractClass/AbstractModel.php:18
Stack trace:
#0 /vendor/payengine/php_sdk/src/Concardis/Payengine/Lib/Internal/AbstractClass/AbstractModel.php(102): Concardis\Payengine\Lib\Internal\AbstractClass\AbstractModel->getSubmodel('transactions', 'transaction_0vn...')
#1 /vendor/payengine/php_sdk/src/Concardis/Payengine/Lib/Internal/AbstractClass/AbstractModel.php(25): Concardis\Payengine\Lib\Internal\Abstrac in /vendor/payengine/php_sdk/src/Concardis/Payengine/Lib/Internal/AbstractClass/AbstractModel.php on line 18
Sharenkamp commented 6 years ago

Hi @ocean90,

should be fixed with 607193f0eec18450b2338c5e8f98e8fae038c9be. To avoid recursion, already outputted Transactions will be displayed as Id instead of a whole object. The logic was missing that, which let to the error above.

Best regards

ocean90 commented 6 years ago

Thanks for the quick fix @Sharenkamp, much appreciated!