开发者

Magento Custom Payment Method: how to get data that was set via Mage_Payment_Model_Method_Abstract::assignData()?

I'm currently developing a payment method and things are working quite well.

Just one thing: The customer enters some information along the payment method and through debugging I can see that it gets written into the InfoInstance via Mage_Payment_Model_Method_Abstract::assignData() Unfortunately, I can't read that data when I'm in the capture()-Method. I retrieve the InfoInstance and try to read the information, but it's not set.

assignData() method:

public function assignData($data开发者_StackOverflow) {
    if (!($data instanceof Varien_Object)) {
        $data = new Varien_Object($data);
    }

    $info = $this->getInfoInstance();
    $info->setEtixType($data->getEtixType());

    return $this;
}

capture() method:

public function capture(Varien_Object $payment, $amount) {
    // ...

    $info = $this->getInfoInstance();

    Mage::log('etix_type: '.$info->getEtixType());  //I expect something like "etix_type: cc"

    // ...
}

Any help is appreciated. I'm sure I missed something.


Found it,

Assigning veriables directly to the InfoInstance works, but it does not persist through the whole checkout process. Instead, you have to set it on the additional_data:

$info = $this->getInfoInstance();
$info->setAdditionalInformation('etix_type', $data->getEtixType());

And later you can read it via:

$info = $this->getInfoInstance();
$etix_type = $info->getAdditionalInformation('etix_type');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜