Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
Checking the company name
Browse files Browse the repository at this point in the history
Added check if there is empty name and surname but not empty company name, to avoid errors while creating transactions.
  • Loading branch information
piotrjozwiak committed Apr 1, 2019
1 parent 9d57604 commit af2141b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions Model/TpayCards.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,10 @@ public function getTpayFormData($orderId = null)
$billingAddress = $order->getBillingAddress();
$amount = number_format($order->getGrandTotal(), 2, '.', '');
$name = $billingAddress->getData('firstname') . ' ' . $billingAddress->getData('lastname');

$companyName = $billingAddress->getData('company');
if (strlen($name) <= 3 && !empty($companyName) && strlen($companyName) > 3) {
$name = $companyName;
}
$om = ObjectManager::getInstance();
$resolver = $om->get('Magento\Framework\Locale\Resolver');
$language = Validate::validateCardLanguage($resolver->getLocale());
Expand All @@ -185,7 +188,8 @@ public function getTpayFormData($orderId = null)
}

/**
*
* @param int $orderId
* @return \Magento\Sales\Api\Data\OrderInterface
*/
protected function getOrder($orderId = null)
{
Expand Down Expand Up @@ -314,7 +318,6 @@ public function refund(InfoInterface $payment, $amount)
throw new Exception(__('Payment refunding error.'));
}


return $this;
}

Expand Down

0 comments on commit af2141b

Please sign in to comment.