From a1034a5d68af7fad4a9a1fae30ec1f2b474f536b Mon Sep 17 00:00:00 2001 From: vegim carkaxhija Date: Tue, 18 Jun 2024 10:27:44 +0200 Subject: [PATCH] Ensure that $buckarooFeeData is an array --- buckaroo3.php | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/buckaroo3.php b/buckaroo3.php index bcde1aef..1af022ac 100644 --- a/buckaroo3.php +++ b/buckaroo3.php @@ -117,9 +117,16 @@ public function hookDisplayAdminOrderMainBottom($params) $this->context->smarty->assign($refunds); $buckarooFeeData = (new RawBuckarooFeeRepository())->getFeeByOrderId($order->id); - $buckarooFeeData['buckaroo_fee_tax'] = $buckarooFeeData['buckaroo_fee_tax_incl'] - $buckarooFeeData['buckaroo_fee_tax_excl']; + + // Ensure that $buckarooFeeData is an array if (!is_array($buckarooFeeData)) { - return $this->display(__FILE__, 'views/templates/hook/refund-hook.tpl'); + $buckarooFeeData = [ + 'buckaroo_fee_tax_excl' => 0, + 'buckaroo_fee_tax_incl' => 0, + 'buckaroo_fee_tax' => 0 + ]; + } else { + $buckarooFeeData['buckaroo_fee_tax'] = $buckarooFeeData['buckaroo_fee_tax_incl'] - $buckarooFeeData['buckaroo_fee_tax_excl']; } $this->context->smarty->assign([