문제

How could I get the value (text, not the code) of cc_type in my payment gateway model?

In payment gateway model for authorize() and capture() I do get $payment object from which I do get cc_type as $payment->getCcType() but it returns the code for the cc_type how could I get the value of the code. e.g., it return VI for the VISA. So, how could I get VISA from the $payment or $payment->getCcType()?

도움이 되었습니까?

해결책

If you only have the cc code ('VI', 'MA', etc.) at that point you could use:

// $sType = 'VI';
$sType = $payment->getCcType();
$aType = Mage::getSingleton('payment/config')->getCcTypes();
if (isset($aType[$sType])) {
    $sName = $aType[$sType];
}
else {
    $sName = Mage::helper('payment')->__('N/A');
}

If you already have the Mage_Payment_Model_Info block at that point you could use:

$sName = $payment->getMethod()->getInfoInstance()->getCcTypeName();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top