Skip to content

Commit

Permalink
Merge pull request #8 from aligent/feature/cc_type
Browse files Browse the repository at this point in the history
cc_type: added support for cc_type
  • Loading branch information
Matthew O'Loughlin authored May 10, 2018
2 parents a2f7d05 + 606ddd1 commit eed7ad5
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 @@ -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()));
}
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 eed7ad5

Please sign in to comment.