From 8a0b80d64b5ba813c8ec836a675944770f0ed2e0 Mon Sep 17 00:00:00 2001 From: paulwer Date: Sat, 27 Jan 2024 10:49:13 +0100 Subject: [PATCH] code cleanups --- .../Bank/Nordigen/Transformer/TransactionTransformer.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/app/Helpers/Bank/Nordigen/Transformer/TransactionTransformer.php b/app/Helpers/Bank/Nordigen/Transformer/TransactionTransformer.php index 422f59983a..839177f4ed 100644 --- a/app/Helpers/Bank/Nordigen/Transformer/TransactionTransformer.php +++ b/app/Helpers/Bank/Nordigen/Transformer/TransactionTransformer.php @@ -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"];