Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Protx Payment Module - Can’t get Start Date or Issue Number to stick
 
Simon King
Member
 
Avatar
Total Posts:  46
Joined:  2008-01-10
 

I have a payment module which requires capture of debit card start date and issue numbers. I have:

* Created a custom form with three fields (start month, start year and issue number)
* Created a validate() method in my payment model (which extends Mage_Payment_Model_Method_Cc)
* Overridden assignData in my payment model to record the additional fields

assignData($data) gets called, and $data contains the form fields - cc_start_year, cc_start_month and cc_issue. They also seem to be set, but at some unknown point in the future the values are lost.

My assignData method looks like this:

public function assignData($data)
    
{

        
if (!($data instanceof Varien_Object)) {
            $data 
= new Varien_Object($data);
        
}
        parent
::assignData($data);
        
$info $this->getInfoInstance();

        if (
$data->getCcIssue()) {
            $info
->setCcIssue($data->getCcIssue());
        
}
        
if ($data->getCcStartMonth() && $data->getCcStartYear()) {
            $info
->setCcStartMonth($data->getCcStartMonth())
                 ->
setCcStartYear($data->getCcStartYear());
        
}
        
return $this;
    
}

Any ideas what could be going on? I can’t seem to debug this one easily either, calling $data->getData() always ends up failing with a recursive dependency error.

 
Magento Community Magento Community
Magento Community
Magento Community
 
odi_um
Sr. Member
 
Avatar
Total Posts:  168
Joined:  2008-04-02
Ukraine
 

Hi Simon King,

They disappear bc u don’t have such attributes in your quote_payment entity (which is $info variable in your case).
In your modules install script ( for example sql/module_setup/mysql4-install-0.1.0.php) u need to add such attributes.

$installer->addAttribute('quote_payment''cc_start_year', array('type' => 'datetime'));
$installer->addAttribute('quote_payment''cc_start_month', array('type' => 'datetime'));
$installer->addAttribute('quote_payment''cc_issue', array()); // default type will be varchar

Also such attribute u need to add for order_payment entity if u will need them after order creation (showing this info on order view page for example).

For converting this values from quote_payment to order_payment entity u should use event sales_convert_quote_to_order.

Hope this will helps you.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Simon King
Member
 
Avatar
Total Posts:  46
Joined:  2008-01-10
 

Thanks odi-um. Great post - you answered my next question too!

Simon

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top