Skip to content

Commit 22c48f9

Browse files
committed
Refactor add card metadata comment history
1 parent d7ed61d commit 22c48f9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src/Service/Card/CardMetaService.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -57,22 +57,23 @@ public function process(array $rvvupPaymentResponse, OrderInterface $order)
5757
];
5858

5959
$payment = $order->getPayment();
60+
$message = "<strong>Rvvup Card Data:</strong> <br />";
61+
$addHistoryComment = false;
6062
foreach ($keys as $key) {
6163
if (isset($rvvupPaymentResponse[$key])) {
62-
$value = $this->mapCardValue($rvvupPaymentResponse[$key]);
6364
$payment->setAdditionalInformation(Method::PAYMENT_TITLE_PREFIX . $key, $rvvupPaymentResponse[$key]);
64-
$data[$key] = $key . ': ' . $value;
65+
$message .= $key . ': ' . $this->mapCardValue($rvvupPaymentResponse[$key]) . ' <br />';
66+
$addHistoryComment = true;
6567
}
6668
}
67-
if (!empty($data)) {
69+
if ($addHistoryComment) {
6870
try {
6971
$historyComment = $this->orderStatusHistoryFactory->create();
7072
$historyComment->setParentId($order->getEntityId());
7173
$historyComment->setIsCustomerNotified(0);
7274
$historyComment->setIsVisibleOnFront(0);
7375
$historyComment->setStatus($order->getStatus());
74-
$message = __("<strong>Rvvup Card Data:</strong> <br />" . implode("<br />", $data));
75-
$historyComment->setComment($message);
76+
$historyComment->setComment(__($message));
7677
$this->orderManagement->addComment($order->getEntityId(), $historyComment);
7778
} catch (\Exception $e) {
7879
$this->logger->error('Rvvup cards metadata comment failed with exception: ' . $e->getMessage());

0 commit comments

Comments
 (0)