Try the Demo

Magento Forum

   
Payment method - new module tutorial
 
zburnham
Member
 
Avatar
Total Posts:  69
Joined:  2007-11-07
Westborough, MA
 

This tutorial does provide some great info… But is there a central documentation repository that I’m not finding?  Maybe it’s my lack of deep experience with XML, but how is one to figure out what tags are appropriate in what locations in these files, or how to add things like support for events and so forth?

I admit I’m not a very senior coder, but it seems like there’s a piece missing here that I could really use at this point.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Matt Kammersell
Jr. Member
 
Avatar
Total Posts:  16
Joined:  2007-09-21
Las Vegas, NV
 

Has anybody considered an ACH payment module?  I wonder how difficult that’s going to be.

 Signature 

-- Matt Kammersell
- Founder Intellect Labs
- Certified Magento Developer Plus

 
Magento Community Magento Community
Magento Community
Magento Community
 
mediacrea
Member
 
Total Posts:  71
Joined:  2008-02-06
Marseille
 

hi,

I’ve got some french bank kit, I post it here for whom want to make a module from it, I think it will be more easy for the CMCIC kit:

- CMCIC
- SIPS

Sorry for my bad english.

There are some modules developped for virtuemart, perhaps it can boost the integration of payment module.

File Attachments
CM_CIC_Paiement-1.03m.zip  (File Size: 1036KB - Downloads: 983)
SIPS-CCBP_API 600 LINUX PLUGIN.zip  (File Size: 3839KB - Downloads: 2170)
 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale
Guru
 
Avatar
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

iam trying to get my own payment method shown up in backend, no chance, i tried all hints in that thread. May i post my code here. Maybe iam blind at the moment. Trying under newest version of magento.

MZPayment/etc/config.xml

<config>
    <
modules>
        <
Mage_MZPayment>
            <
version>0.1.0</version>
        </
Mage_MZPayment>
    </
modules>

    <global>
        <
models>
            <
mzpayment>
                <class>
Mage_MZPayment_Model</class>
            </
mzpayment>
        </
models>

        <
resources>
            <
mzpayment_setup>
                <
setup>
                    <
module>Mage_MZPayment</module>
                </
setup>
                <
connection>
                    <use>
core_setup</use>
                </
connection>
            </
mzpayment_setup>
        </
resources>
    </global>

    <default>
        <
payment>
            <
mzpayment>
                <
active>1</active>
                <
cctypes>AE,VI,MC,DI</cctypes>
                <
model>payment/method_hpcc</model>
                <
order_status>pending</order_status>
                <
title>MZ_Payment</title>
                <
allowspecific>0</allowspecific>
            </
mzpayment>
        </
payment>
    </default>
</
config>

MZPayment/etc/system.xml

<config>
   <
sections>
        <
payment>            
            <
groups>
                <
mzpayment translate="label">
                    <
label>MZ Payment</label>
                    <
frontend_type>text</frontend_type>
                    <
sort_order>1</sort_order>
                    <
show_in_default>1</show_in_default>
                    <
show_in_website>1</show_in_website>
                    <
show_in_store>0</show_in_store>
                    <
fields>
                        <
active translate="label">
                            <
label>Enabled</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>adminhtml/system_config_source_yesno</source_model>
                            <
sort_order>1</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
active>                                        
                        <
model>
                        </
model>
                    </
fields>
                </
mzpayment>                
            </
groups>
        </
payment>
    </
sections>
</
config>

 Signature 

mzentrale | eCommerce - eBusiness
Agentur für eCommerce Beratung, Entwicklung & Marketing.
Magento™ Silver Partner
----

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale
Guru
 
Avatar
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

MZPayment/Model/HPCc.php

<?php 
/** Our test CC module adapter**/

class Mage_MZPayment_Model_PaymentMethod extends Mage_Payment_Model_Abstract
{  
    
/**   
    * unique internal payment method identifier   
    *    
    * @var string [a-z0-9_]   
    **/
    
protected $_code 'mzpayment';   
    
/**   
    * Possible result statuses   
    **/  
    
    
const RESPONSE_CODE_APPROVED 1;
    const 
RESPONSE_CODE_DECLINED 2;  
    const 
RESPONSE_CODE_ERROR 3;  
    const 
RESPONSE_CODE_HELD 4;   
    
    
}
?>

MZPayment/sql/mzpayment_setup.php

<?php 
$code 
'mzpayment'

$this->setConfigData('payment/'.$code.'/model''mzpayment/hpcc');

// create payment method group in Admin / System / Configuration / Payment Methods
$this->addConfigField(
    
'payment/'.$code
    
'MZPayment'
); 

// specify title for this payment method
$this->addConfigField(
    
'payment/'.$code.'/title'
    
'MZPayment'
);

$this->setConfigData(
    
'payment/'.$code.'/title'
    
'MZPayment'
); 

// add Enabled flag configuration
$this->addConfigField(
    
'payment/'.$code.'/active'
    
'Enabled'
    
, array(  
        
'frontend_type'=>'select',  
        
'source_model'=>'adminhtml/system_config_source_payment_active'
        
)
); 

// choose initial order status when checking out with this payment method
$this->addConfigField(
    
'payment/'.$code.'/order_status' 
    
'Order Status' 
    
, array(
        
'frontend_type'=>'select',  
        
'source_model'=>'adminhtml/system_config_source_order_status'
    
)
); 

// set position for this payment method in list
$this->addConfigField(
    
'payment/'.$code.'/sort_order'
    
'Sort Order'
);
?>

also added app/etc/modules/MZPayment.xml

<config>
    <
modules>
        <
Mage_MZPayment>
            <
active>true</active>
            <
codePool>locale</codePool>
        </
Mage_MZPayment>            
    </
modules>
</
config>

and app/etc/local.xml looks like

<config>
    <global>
        <
install>
            <
date><![CDATA[Tue05 Feb 2008 18:50:19 +0000]]></date>
        </
install>
        <
crypt>
            <
key><![CDATA[fsdjk324fjds523jgkv324tg2433s3]]></key>
        </
crypt>
        <
resources>
        </
resources>
     </global>
     <
modules>
        <
Mage_MZPayment>
            <
active>true</active>
            <
codePool>locale</codePool>
        </
Mage_MZPayment>            
    </
modules>     
</
config>

Nothing is shown up in backend, no SQL Inserts in DB, no Errors, using Magento 0.8.16100

Could anyone look at the code and report me my misstakes? For me it seems all is correct…
Maybe version conflicts? smth changed?

Thanks, KR

Stefan

 Signature 

mzentrale | eCommerce - eBusiness
Agentur für eCommerce Beratung, Entwicklung & Marketing.
Magento™ Silver Partner
----

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

[m] Zentrale: things i see right away:

MZPayment/sql/mzpayment_setup.php - the file name is not correct it should be mzpayment_setup-install-0.1.0.php, but it is not needed anymore in new version as all the configuration fiels are read from MZPayment/etc/system.xml

don’t need to update local.xml as you have already created app/etc/modules/MZPayment.xml

rename MZPayment/Model/HPCc.php to MZPayment/Model/Hpcc.php

// instead of 
class Mage_MZPayment_Model_PaymentMethod extends Mage_Payment_Model_Abstract

// use
class Mage_MZPayment_Model_Hpcc extends Mage_Payment_Model_Method_Abstract

 Signature 

- I would love to change the world, but they won’t give me the source code -

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale
Guru
 
Avatar
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi Moshe,

it still dont work, but than i tried to adapt the paygate module to an local module. i called it MZHeidelpay. I renamed Models, Controllers and all that stuff to the new names. Copied to local/Menge, cleared all cache in backend, cleared cache in folder, deactivated all caches but my module wount be displayed in payment modules anyway. Is it a problem to name the module and the model with same name? May i attach my adapted module?

KR

Stefan

File Attachments
MZHeidelpay.zip  (File Size: 13KB - Downloads: 520)
 Signature 

mzentrale | eCommerce - eBusiness
Agentur für eCommerce Beratung, Entwicklung & Marketing.
Magento™ Silver Partner
----

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale
Guru
 
Avatar
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

Ok, after reading you article i changed following:
name of file MHHeidelpay.php in Model changed to Mzheidelpay.php, also changed classname of model to Mage_MZHeidelpay_Model_Mzheidelpay instead of Mage_MZHeidelpay_Model_MZHeidelpay smile!

but it is still not shown up in Payment Modules :(! Its listed under “Advanced”

Need some help please

KR

Stefan

 Signature 

mzentrale | eCommerce - eBusiness
Agentur für eCommerce Beratung, Entwicklung & Marketing.
Magento™ Silver Partner
----

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale
Guru
 
Avatar
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi Guys,

so, now i have the solution for this:

I have to put my module to folder /app/code/community/Mage/ instead of folder /app/code/local/Mage/

and set in app/etc/modules/MZHeidelpay.xml

<config>
    <
modules>
        <
Mage_Heidelpay>
            <
active>true</active>
            <
codePool>community</codePool>
        </
Mage_Heidelpay>          
    </
modules>
</
config>

KR

Stefan

 Signature 

mzentrale | eCommerce - eBusiness
Agentur für eCommerce Beratung, Entwicklung & Marketing.
Magento™ Silver Partner
----

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale
Guru
 
Avatar
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

iam too stupid, in MZHeidelpay.xml i set for codePool to locale instead of local rasberry! OMG!

cheers

Stefan

 Signature 

mzentrale | eCommerce - eBusiness
Agentur für eCommerce Beratung, Entwicklung & Marketing.
Magento™ Silver Partner
----

 
Magento Community Magento Community
Magento Community
Magento Community
 
beha
Jr. Member
 
Total Posts:  4
Joined:  2008-02-20
Poland
 

Hi,

It seems like core_config_field table not longer exists in Magento 8.161

I ‘ve tried to go trough tutorial and at the end I getting an error

Zend_Db_Statement_Exception Object
(
    
[message:protected] => SQLSTATE[42S02]Base table or view not found1146 Table 'magento.core_config_field' doesnt exist
    [string
:private] => 
    
[code:protected] => 0
    [file
:protected] => /var/ww...
    
{...}

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale
Guru
 
Avatar
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

yes, in new Version smth changed, you dont need the sql any more. During the day ill post my code for implementation of a new Payment Module.

Cu later.

Cheers

Stefan

 Signature 

mzentrale | eCommerce - eBusiness
Agentur für eCommerce Beratung, Entwicklung & Marketing.
Magento™ Silver Partner
----

 
Magento Community Magento Community
Magento Community
Magento Community
 
beha
Jr. Member
 
Total Posts:  4
Joined:  2008-02-20
Poland
 

Hi,

Sorry, I should read all posts in the thread… :/ It’s pretty obvious, now.

 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale
Guru
 
Avatar
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

np, so i dont have to post my example.

Cheers

Stefan

 Signature 

mzentrale | eCommerce - eBusiness
Agentur für eCommerce Beratung, Entwicklung & Marketing.
Magento™ Silver Partner
----

 
Magento Community Magento Community
Magento Community
Magento Community
 
phrench
Member
 
Total Posts:  60
Joined:  2007-11-10
 
Moshe - 16 February 2008 09:26 AM

[m] Zentrale: things i see right away:

MZPayment/sql/mzpayment_setup.php - the file name is not correct it should be mzpayment_setup-install-0.1.0.php, but it is not needed anymore in new version as all the configuration fiels are read from MZPayment/etc/system.xml

Does this mean the wiki HowTo is not up to date anymore?

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