7

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) {
    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.

1 Answer 1

9

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.