Moh*_*sal 2 php payment-gateway magento
我怎样才能获得cc_type支付网关模型中的值(文本,而不是代码)?
在支付网关模型authorize()和capture()我得到$payment的对象从中我得到cc_type的$payment->getCcType(),但它返回的代码cc_type我怎么能拿代码的价值.例如,它返回VI的VISA.所以,我怎么能得到VISA从$payment或$payment->getCcType()?
如果你只有CC码('VI','MA'在这一点上,等等),你可以使用:
// $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');
}
Run Code Online (Sandbox Code Playgroud)
如果您已经拥有该Mage_Payment_Model_Info块,您可以使用:
$sName = $payment->getMethod()->getInfoInstance()->getCcTypeName();
Run Code Online (Sandbox Code Playgroud)