diff --git a/Model/Payment.php b/Model/Payment.php index 9865ab8..d2a8114 100644 --- a/Model/Payment.php +++ b/Model/Payment.php @@ -457,6 +457,7 @@ protected function _handleResponse($response, $payment) if ($result->isSuccess()) { $payment->setCcTransId($result->getToken()); $payment->setTransactionId($result->getToken()); + $payment->setCcType($result->getCCType()); } elseif ($error) { throw new LocalizedException(__($result->getErrorDescription())); } diff --git a/Model/Result.php b/Model/Result.php index 5d0cea5..b55cfe0 100644 --- a/Model/Result.php +++ b/Model/Result.php @@ -67,6 +67,28 @@ public function getToken() return ''; } + /** + * @return string | null + */ + public function getCCType() + { + $oCard = $this->getResponseValue('card'); + return (isset($oCard->scheme)) ? $oCard->scheme : null; + } + + /** + * @param $vKey + * + * @return mixed + */ + protected function getResponseValue($vKey) + { + if (!isset($this->_response) || (!isset($this->_response->response)) || (!isset($this->_response->response->$vKey))){ + return null; + } + return $this->_response->response->$vKey; + } + /** * @return null | string */