Skip to content

Commit

Permalink
Merge pull request #180 from bold-commerce/payment_title
Browse files Browse the repository at this point in the history
Remove unicodes from payment title.
  • Loading branch information
victorpetryk authored Nov 20, 2023
2 parents 2c8cc3b + f1cb163 commit 25f6e43
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Model/Payment/Gateway/Config/TitleValueHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ public function __construct(ConfigInterface $config, StoreManagerInterface $stor
*/
public function handle(array $subject, $storeId = null)
{
$payment = $subject['payment'] ?? null;
$paymentObject = $subject['payment'] ?? null;
$websiteId = (int)$this->storeManager->getWebsite()->getId();
if (!$payment) {
if (!$paymentObject || !$paymentObject->getPayment()) {
return $this->config->getPaymentTitle($websiteId);
}
$ccLast4 = $payment->getPayment()->getCcLast4();
$ccType = $payment->getPayment()->getCcType();
$ccLast4 = $paymentObject->getPayment()->getCcLast4();
$ccType = $paymentObject->getPayment()->getCcType();
if (!$ccLast4 || !$ccType) {
return $this->config->getPaymentTitle($websiteId);
}
return strlen($ccLast4) === 4
? $ccType . ': ••••• •••••• ' . $ccLast4
? $ccType . ': end with ' . $ccLast4
: $ccType . ': ' . $ccLast4;
}
}

0 comments on commit 25f6e43

Please sign in to comment.