Skip to content

Commit

Permalink
cc_type: added support for cc_type
Browse files Browse the repository at this point in the history
  • Loading branch information
zainengineer committed May 10, 2018
1 parent f03c7e6 commit 606ddd1
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions Model/Payment.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,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()));
}
Expand Down
22 changes: 22 additions & 0 deletions Model/Result.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 606ddd1

Please sign in to comment.