diff --git a/src/controllers/OrdersController.php b/src/controllers/OrdersController.php index 567543cf30..d2035064a7 100644 --- a/src/controllers/OrdersController.php +++ b/src/controllers/OrdersController.php @@ -1518,6 +1518,15 @@ private function _getTransactionsWithLevelsTableArray(array $transactions, int $ $transactionResponse = Json::htmlEncode($transactionResponse); } + $transactionNoteType = 'text'; + $transactionNote = Json::decodeIfJson($transaction->note); + if (is_array($transactionNote)) { + $transactionNoteType = 'response'; + $transactionNote = Json::htmlEncode($transactionNote); + } else { + $transactionNote = Html::encode($transaction->note); + } + $transactionMessage = Json::decodeIfJson($transaction->message); $transactionMessage = Json::htmlEncode($transactionMessage); @@ -1541,7 +1550,7 @@ private function _getTransactionsWithLevelsTableArray(array $transactions, int $ ['label' => Html::encode(Craft::t('commerce', 'Transaction Hash')), 'type' => 'code', 'value' => $transaction->hash], ['label' => Html::encode(Craft::t('commerce', 'Gateway Reference')), 'type' => 'code', 'value' => $transaction->reference], ['label' => Html::encode(Craft::t('commerce', 'Gateway Message')), 'type' => 'text', 'value' => $transactionMessage], - ['label' => Html::encode(Craft::t('commerce', 'Note')), 'type' => 'text', 'value' => Html::encode($transaction->note)], + ['label' => Html::encode(Craft::t('commerce', 'Note')), 'type' => $transactionNoteType, 'value' => $transactionNote], ['label' => Html::encode(Craft::t('commerce', 'Gateway Code')), 'type' => 'code', 'value' => $transaction->code], ['label' => Html::encode(Craft::t('commerce', 'Converted Price')), 'type' => 'text', 'value' => Plugin::getInstance()->getPaymentCurrencies()->convert($transaction->paymentAmount, $transaction->paymentCurrency) . ' (' . $transaction->currency . ')' . ' (1 ' . $transaction->currency . ' = ' . number_format($transaction->paymentRate) . ' ' . $transaction->paymentCurrency . ')'], ['label' => Html::encode(Craft::t('commerce', 'Gateway Response')), 'type' => 'response', 'value' => $transactionResponse],