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

Payment method - new module tutorial
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi,

if my english would be better i think i could explain my done work better - you see, german grammer in my sentences and too less thesaurus, sorry for that.

Cheers

 
Magento Community Magento Community
Magento Community
Magento Community
 
zburnham
Member
 
Avatar
Total Posts:  69
Joined:  2007-11-07
Westborough, MA
 

Anyone else care to have a stab at explaining [m]zentrale’s code a bit?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 
- 26 February 2008 08:56 AM


But there are some open questions:

* i updated version from 0.0.1 to 0.0.2 in config.xml, created a new mysql4-install-0.0.2.php but my changes were not written in the database. i searched the database and found one entry in table “core_resource” which owns the actual version, i had to delete this row and the last datas in “core_config_data”. How could i manage that automaticly, by a mysql4-uninstall-0.0.1.php?

the upgrade files should be named mysql4-upgrade-0.0.1-0.0.2.php

- 26 February 2008 08:56 AM

* i added some code to app\code\core\Mage\Sales\Model\Convert\Oder.php and Quote.php, i think thats not the best way, right? Better to overwrite the Model?

Yes, you should overload the original class with your model by extending it:

class MZentrale_Module_Model_Convert_Order extends Mage_Sales_Model_Convert_Order
{
    
public function paymentToQuotePayment(Mage_Sales_Model_Order_Payment $payment$quotePayment=null)
    
{
        $quotePayment 
parent::paymentToQuotePayment($payment$quotePayment);

        
//My Code
        
$quotePayment
            
->setHpdaAccountOwner($payment->getHpdaAccountOwner())
            ->
setHpdaAccountNumber($payment->getHpdaAccountNumber())
            ->
setHpdaBankCode($payment->getHpdaBankCode())
            ->
setHpdaBank($payment->getHpdaBank());
            
        return 
$quotePayment;
    
}

To override the model put this in your module/etc/config.xml:

<config>
...
   <global>
...
      <
models>
         <
sales>
            <
rewrite>
               <
convert_order>MZentrale_Module_Model_Convert_Order</convert_order>
            </
rewrite>
         </
sales>
      </
models>
   </global>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
mzentrale1
Guru
 
Total Posts:  731
Joined:  2007-12-06
Stuttgart, Germany
 

Hi Moshe,

thank you, ill update my module and reporting about success! Thanks.

I tried to upload some pics of my modul but it didnt work, after long loading time i got error?

Cheers

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

Hi Moshe,

thanks, works for me!

cheers

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
bendtsen
Jr. Member
 
Total Posts:  17
Joined:  2007-09-23
 

Hi - Im about to create a payment module for Magento, it has to verify payment based on credit card number, exp dates and a code. Im not sure where to start, the wiki is no longer up to date, so I guess its a waste of time reading it? I have read this thread a couple of times but im still not sure where to start. Will someone post a new wiki on the subject?

 
Magento Community Magento Community
Magento Community
Magento Community
 
jedimastafez
Member
 
Avatar
Total Posts:  45
Joined:  2008-01-22
Bucklands Beach
 
bendtsen - 04 March 2008 03:32 AM

Hi - Im about to create a payment module for Magento, it has to verify payment based on credit card number, exp dates and a code. Im not sure where to start, the wiki is no longer up to date, so I guess its a waste of time reading it? I have read this thread a couple of times but im still not sure where to start. Will someone post a new wiki on the subject?

I too am having trouble having done the tutorial and read this thread many times.

I am only a novice developer but I thought I might know enough to at least make a start.

I have created what I think is the right files etc but at this point am unsure as to how to actually execute the insall.php file to actually get Magento to make the changes.

I think someone asked about how to do this earlier on in the thread also.

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

Hi guys,

my two paymentmodules are ready now… i have one special cc paymentmodule and a direct debit module working, direct debit datas are shown up in backend. For both modules there is a integrated paygate check. Next week i have vacation, maybe i find some time to rewrite HowTo. But i think my english knowledge is too bad to build useful sentences smile! i think it will sound funny… Or better i post it here.

Cheers

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
bendtsen
Jr. Member
 
Total Posts:  17
Joined:  2007-09-23
 

Sounds good, if you have a hard time writing the how to in english, you can write it in German, then we can translate it to english.

 
Magento Community Magento Community
Magento Community
Magento Community
 
al_st
Jr. Member
 
Total Posts:  7
Joined:  2008-03-10
 

Hi,

I am currently in the process of configuring a payment module for SecureTrading, a UK based payment service provider.

I’ve been following various forums on the topic of integrating new payment modules with the cart, and have uploaded what I believe are the correct files, however, I am unable to see Securetrading as a payment option within the backend of the Shopping Cart when clicking System -> Configuration -> Payment Methods. I will go through what I have setup so far, then hopefully someone will be able to assist me or point me in the direction of where I can find a solution.

Within the directory app/code/local/, I have generated a directory called Mage and within this directory I have created a SecureTrading directory. This contains the following four directories:

Helper - which contains the Data.php file

Model - which contains SecureTrading.php and another directory called MySql4 which contains the file Setup.php

etc - which contains two XML files namely system.xml (which I believe should enable the payment module to be shown up in the shopping cart backend) and config.xml (which contains all the configuration data for the module)

sql - which contains another directory, securetrading_setup which in turn contains the file mysql4-install-0.7.0.php (having read threads on the topic, I am unsure if this is required at present as the declarations should all be contained within the system.xml, however I have left the file there just to be safe).

In addition to these four directories, within the directory app/etc/modules/ I have generated a file called SecureTrading.xml which contains the following:

<? xml version = "1.0" ?>
<config>
<modules>
<Mage_SecureTrading>
<active>true</active>
<codePool>local</codePool>
</Mage_SecureTrading>
</modules>
</config>

This should then enable by module, however at present nothing seems to be happening.

If you could please let me know if I am missing something really obvious, or if there’s anything I should be keeping an eye out for.

Once I can get the SecureTrading module to appear, I’m confident I can then start playing about with processing payments through the module!

Thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jamieconnor
Jr. Member
 
Avatar
Total Posts:  11
Joined:  2008-02-12
Auckland, New Zealand
 

I have edited the Payment Express module for DPS payment. Here is how I did it in case anyone else is wondering.

Inside app>code>core>Mage>Admin>Model>Paypal>Model>Api>Nvp.php

there is a function called callSetExpressCheckout()

Make sure that the include for pxpay is inside the Api folder.

replace it with this. There are a few variables you will have to change but shoud be obvious…

public function callSetExpressCheckout()
{
require_once("pxpay.php");
//------------------------------------------------------------------------------------------------------------------------------------
// Construct the parameter string that describes the SetExpressCheckout API call

$nvpArr = array(
‘PAYMENTACTION’ => $this->getPaymentType(),
‘AMT’ => $this->getAmount(),
‘CURRENCYCODE’ => $this->getCurrencyCode(),
‘RETURNURL’ => $this->getReturnUrl(),
‘CANCELURL’ => $this->getCancelUrl(),
);
$this->setUserAction(self::USER_ACTION_CONTINUE);

// for mark SetExpressCheckout API call
if ($a = $this->getShippingAddress()) {
$nvpArr = array_merge($nvpArr, array(
‘ADDROVERRIDE’ => 1,
‘SHIPTONAME’ => $a->getName(),
‘SHIPTOSTREET’ => $a->getStreet(1),
‘SHIPTOSTREET2’ => $a->getStreet(2),
‘SHIPTOCITY’ => $a->getCity(),
‘SHIPTOSTATE’ => $a->getRegionCode(),
‘SHIPTOCOUNTRYCODE’ => $a->getCountry(),
‘SHIPTOZIP’ => $a->getPostcode(),
‘PHONENUM’ => $a->getTelephone(),
));
$this->setUserAction(self::USER_ACTION_COMMIT);
}
//’---------------------------------------------------------------------------------------------------------------
//’ Make the API call to PayPal
//’ If the API call succeded, then redirect the buyer to PayPal to begin to authorize payment.
//’ If an error occured, show the resulting errors
//’---------------------------------------------------------------------------------------------------------------
$resArr = $this->call(’SetExpressCheckout’, $nvpArr);

if (false===$resArr) {
return false;
}

$this->setToken($resArr[’TOKEN’]);


// dps login details
$dpsAccount = ‘ACCOUNT NAME HERE’;
$dpsKey = ‘DPS KEY HERE’;
$pxpay = new PxPay( ‘https://www.paymentexpress.com/pxpay/pxaccess.aspx’, $dpsAccount, $dpsKey );

$request = new PxPayRequest();

//$http_host = getenv("HTTP_HOST");
//$request_uri = getenv("SCRIPT_NAME");
$http_host = ‘www.keepthree.com’;
$request_uri = getenv("SCRIPT_NAME");
$server_url = “http://$http_host”;
#$script_url = “$server_url/$request_uri”; //using this code before PHP version 4.3.4
#$script_url = “$server_url$request_uri”; //Using this code after PHP version 4.3.4
$script_url = (version_compare(PHP_VERSION, “4.3.4”, “>=")) ?"$server_url$request_uri" : “$server_url/$request_uri”;

$request->setAmountInput($this->getAmount());
$request->setTxnData1($a->getStreet(1));# whatever you want to appear
$request->setTxnData2($a->getStreet(2)); # whatever you want to appear
$request->setTxnData3($a->getCity() . ‘Post code: ‘.$data[’customer’][’shipping_post_code’]); # whatever you want to appear
$request->setTxnType("Purchase");
$request->setInputCurrency("NZD");
$request->setMerchantReference("123456"); # fill this with your order number
$request->setEmailAddress($a->getEmail());
$request->setUrlFail(Mage::getUrl(’checkout/cart/’)); # can be a dedicated failure page
$request->setUrlSuccess(Mage::getUrl(’paypal/express/saveOrder’)); # can be a dedicated success page

#Call makeResponse of PxPay object to obtain the 3-DES encrypted payment request
$request_string = $pxpay->makeRequest($request);
$response = new MifMessage( $request_string );
$url = $response->get_element_text("URI");
$valid = $response->get_attribute("valid");

$this->setRedirectUrl($url);
return $resArr;
}

Thanks zentrale for your help.

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

Hi,

theres a small error, file is located in app>code>core>Mage>Paypal>Model>Api>Nvp.php

Cheers and welcome smile

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
alanjewitt
Jr. Member
 
Total Posts:  4
Joined:  2008-02-01
 

Guys, I’m working on a module for SecPay, a UK-based PSP. I have managed to get the module showing in the Admin, and set up config values, but no luck getting it to show up in the checkout page. Any hints on where to look for the config which determines this? I’m assuming it’s an XML file somehere.

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

Hi,

could you post your config.xml and system.xml?

Cheers

Stefan

 
Magento Community Magento Community
Magento Community
Magento Community
 
magentix2008
Jr. Member
 
Total Posts:  4
Joined:  2008-03-14
 

Hi

(First post to this blog!)
I’m having the same problem as alanjewitt. My protx module is showing up in the admin, activated, but not showing up on the checkout page… :(
Will keep at it but if somone has any hints/ideas, most welcome!
Thanks

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