1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 13:12:50 +01:00

code cleanups

This commit is contained in:
paulwer 2024-01-27 10:49:13 +01:00
parent f557fe900d
commit 8a0b80d64b

View File

@ -81,15 +81,14 @@ class TransactionTransformer implements BankRevenueInterface
public function transformTransaction($transaction)
{
if ((!array_key_exists('transactionId', $transaction) && !array_key_exists('internalTransactionId', $transaction)) || !array_key_exists('transactionAmount', $transaction))
throw new \Exception('invalid dataset');
// depending on institution, the result can be different, so we load the first available unique id
$transactionId = '';
if (array_key_exists('transactionId', $transaction))
$transactionId = $transaction["transactionId"];
else if (array_key_exists('internalTransactionId', $transaction))
$transactionId = $transaction["internalTransactionId"];
else
throw new \Exception('invalid dataset: missing transactionId - Please report this error to the developer');
$amount = (float) $transaction["transactionAmount"]["amount"];