Magento payment methods: how to get the data that was set via Mage_Payment_Model_Method_Abstract :: assignData ()?

Hi guys,

I am currently developing a payment method and everything is working well. Only one thing: the client enters some information on the payment method and through debugging, I see that it is written to InfoInstance via Mage_Payment_Model_Method_Abstract :: assignData () Unfortunately, I can not read this data when I am in the capture () method - Method. I am extracting InfoInstance and trying to read information, but not installed.

assignData ():

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

Thanks aeno

+6
source share
1 answer

Found,

Assigning verifications directly to InfoInstance works, but it is not saved through the entire checkout process. Instead, you should install it on additional_data:

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

And later you can read it through:

 $info = $this->getInfoInstance(); $etix_type = $info->getAdditionalInformation('etix_type'); 
+8
source

Source: https://habr.com/ru/post/896897/


All Articles