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

Problems Getting New Payments Gateway/Module To Show up In FrontEnd…
 
ckoeber
Jr. Member
 
Total Posts:  17
Joined:  2009-03-19
 

Hello,

I am attempting to create a new payment gateway for Magento 1.5 (latest but not RC).

I can get the module to show up in the configuration pages but I do not see the actual payment method in the frontend.

In the backend I see everything correctly and can edit the custom config options I created, etc.

See below for the code for the gateway.

Is there a different process that needs to be followed for Magento 1.5?

Thank you for your time.

Regards,
Chris K.

In the app\code\local\CompanyName folder the config.xml file lives:

<?xml version="1.0" encoding="utf-8"?>
<config>
    <
modules>
        <
CompanyName_ModuleName>
            <
version>0.0.2</version>
        </
CompanyName_ModuleName>
    </
modules>
    <global>
        <
blocks>
            <
ModuleName>
                <class>
CompanyName_ModuleName_Block</class>
            </
ModuleName>
        </
blocks>
        <
models>
            <
ModuleName>
                <class>
CompanyName_ModuleName_Model</class>
            </
ModuleName>
        </
models>
        <
resources>
            <
ModuleName_setup>
                <
setup>
                    <
module>CompanyName_ModuleName</module>
                </
setup>
                <
connection>
                    <use>
core_setup</use>
                </
connection>
            </
ModuleName_setup>
            <
ModuleName_write>
                <
connection>
                    <use>
core_write</use>
                </
connection>
            </
ModuleName_write>
            <
ModuleName_read>
                <
connection>
                    <use>
core_read</use>
                </
connection>
            </
ModuleName_read>
        </
resources>
    </global>
    <default>
        <
payment>
            <
ModuleName>
                <
active>1</active>
                <
model>ModuleName/paymentlogic</model>
                <
order_status>processing</order_status>
                <
title>Credit Card Payment</title>
                <
application_id>12345</application_id>
                <
application_url>https://urlhere.url</application_url>
                
<convenience_fee>0.00</convenience_fee>
                <
logsourceip>1</logsourceip>
                <
sendconfirmationemail>1</sendconfirmationemail>
                <
payment_action>authorize</payment_action>
                <
cctypes>VI,MC</cctypes>
                <
transaction_source>Web</transaction_source>
            </
ModuleName>
        </
payment
    </default>
</
config>

In the app\code\local\CompanyName\ModuleName\etc folder I have two files, the config.xml file and the system.xml file:

Config.xml:

<?xml version="1.0" encoding="utf-8"?>
<config>
    <
modules>
        <
CompanyName_ModuleName>
            <
version>0.0.2</version>
        </
CompanyName_ModuleName>
    </
modules>
    <global>
        <
blocks>
            <
ModuleName>
                <class>
CompanyName_ModuleName_Block</class>
            </
ModuleName>
        </
blocks>
        <
models>
            <
ModuleName>
                <class>
CompanyName_ModuleName_Model</class>
            </
ModuleName>
        </
models>
        <
resources>
            <
ModuleName_setup>
                <
setup>
                    <
module>CompanyName_ModuleName</module>
                </
setup>
                <
connection>
                    <use>
core_setup</use>
                </
connection>
            </
ModuleName_setup>
            <
ModuleName_write>
                <
connection>
                    <use>
core_write</use>
                </
connection>
            </
ModuleName_write>
            <
ModuleName_read>
                <
connection>
                    <use>
core_read</use>
                </
connection>
            </
ModuleName_read>
        </
resources>
    </global>
    <default>
        <
payment>
            <
ModuleName>
                <
active>1</active>
                <
model>ModuleName/paymentlogic</model>
                <
order_status>processing</order_status>
                <
title>Wesley Theological Seminary Credit Card Payment</title>
                <
application_id>12345</application_id>
                <
application_url>https://urlhere.url</application_url>
                
<convenience_fee>0.00</convenience_fee>
                <
logsourceip>1</logsourceip>
                <
sendconfirmationemail>1</sendconfirmationemail>
                <
payment_action>authorize</payment_action>
                <
cctypes>VI,MC</cctypes>
                <
transaction_source>Web</transaction_source>
            </
ModuleName>
        </
payment
    </default>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
ckoeber
Jr. Member
 
Total Posts:  17
Joined:  2009-03-19
 

--Continuation of above post--

System.xml:

<?xml version="1.0" encoding="utf-8"?>
<config>
    <
sections>
        <
payment>
            <
groups>
                <
ModuleName translate="label" module="paygate">
                    <
label>Official Payments</label>
                    <
sort_order>670</sort_order>
                    <
show_in_default>1</show_in_default>
                    <
show_in_website>1</show_in_website>
                    <
show_in_store>1</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>1</show_in_store>
                        </
active>
                        <
application_id translate="label">
                            <
label>Application ID</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>2</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
application_id>
                        <
application_url translate="label">
                            <
label>Application URL</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>3</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
application_url>
                        <
convenience_fee translate="label">
                            <
label>Convenience Fee</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>4</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
convenience_fee>
                        <
transaction_source translate="label">
                            <
label>Transaction Source</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>5</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
transaction_source>
                        <
logsourceip translate="label">
                            <
label>Log the Source IP?</label>
                            <
source_model>adminhtml/system_config_source_yesno</source_model>
                            <
sort_order>6</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
logsourceip>
                        <
sendconfirmationemail translate="label">
                            <
label>Send Confirmation Email from Official Payments?</label>
                            <
source_model>adminhtml/system_config_source_yesno</source_model>
                            <
sort_order>7</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
sendconfirmationemail>
                        <
payment_action translate="label">
                            <
label>Payment Action</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>paygate/authorizenet_source_paymentAction</source_model>
                            <
sort_order>8</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
payment_action>
                        <
order_status translate="label">
                            <
label>New Order Status</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>adminhtml/system_config_source_order_status_processing</source_model>
                            <
sort_order>9</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
order_status>
                        <
title translate="label">
                            <
label>Title</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>10</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
title>
                    </
fields>
                </
ModuleName>
            </
groups>
        </
payment>
    </
sections>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
ckoeber
Jr. Member
 
Total Posts:  17
Joined:  2009-03-19
 

--Continuation of Post Above---

And, lastly, in the app\\\\code\\\\local\\\\CompanyName\\\\ModuleName\\\\Model folder I have the PaymentLogic.php file. That file has the following code:

<?php
class CompanyName_OfficialPayments_Model_PaymentLogic extends Mage_Payment_Model_Method_Cc
{
/**
     * unique internal payment method identifier
     */
    
protected $_code 'OfficialPayments';

    
/**
     * this should probably be true if you're using this
     * method to take payments
     */
    
protected $_isGateway               true;

    
/**
     * can this method authorise?
     */
    
protected $_canAuthorize            true;

    
/**
     * can this method capture funds?
     */
    
protected $_canCapture              true;

    
/**
     * can we capture only partial amounts?
     */
    
protected $_canCapturePartial       false;

    
/**
     * can this method refund?
     */
    
protected $_canRefund               false;

    
/**
     * can this method void transactions?
     */
    
protected $_canVoid                 false;

    
/**
     * can admins use this payment method?
     */
    
protected $_canUseInternal          true;

    
/**
     * show this method on the checkout page
     */
    
protected $_canUseCheckout          true;

    
/**
     * available for multi shipping checkouts?
     */
    
protected $_canUseForMultishipping  true;

    
/**
     * can this method save cc info for later use?
     */
    
protected $_canSaveCc false;

    
/**
     * this method is called if we are just authorising
     * a transaction
     */
     
    
public function getclientip()
    
{
        
if (isset($_SERVER))
       
{
            
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"]))
                return 
$_SERVER["HTTP_X_FORWARDED_FOR"];
            if (isset(
$_SERVER["HTTP_CLIENT_IP"]))
                return 
$_SERVER["HTTP_CLIENT_IP"];
                return 
$_SERVER["REMOTE_ADDR"];
        
}
            
if (getenv('HTTP_X_FORWARDED_FOR'))
                return 
getenv('HTTP_X_FORWARDED_FOR');
            if (
getenv('HTTP_CLIENT_IP'))
                return 
getenv('HTTP_CLIENT_IP');
                return 
getenv('REMOTE_ADDR');
    
}
    
    
public function authorize (Varien_Object $payment$amount)
    
{
        
try {
            $orderId 
$payment->getOrder()->getIncrementId();
            
$billing $payment->getOrder()->getBillingAddress();
            
$application_id Mage::getStoreConfig('payment/OfficialPayments/application_id');
            
$application_url Mage::getStoreConfig('payment/OfficialPayments/application_url');
            
$convenience_fee Mage::getStoreConfig('payment/OfficialPayments/convenience_fee');
            
$logsourceip Mage::getStoreConfig('payment/OfficialPayments/logsourceip');
            
$sendconfirmationemail Mage::getStoreConfig('payment/OfficialPayments/sendconfirmationemail');
            
$transaction_source Mage::getStoreConfig('payment/OfficialPayments/transaction_source');
            
$clientip getclientip();
            
$paymentValues = array("cardType" => $payment->getCcCid(),
                                                    
"expiresMonth" => $payment->getCcExpMonth(),
                                                    
"expiresYear" => $payment->getCcExpYear(),
                                                    
"cardHolderName" => $payment->getCcOwner(),
                                                    
"cardNumber" => $payment->getCcNumber(),
                                                    
"amount" => $amount,
                                                    
"orderId" => $orderId,
                                                    
"LastName" => $billing->getLastname(),
                                                    
"FirstName" => $billing->getFirstname(),
                                                    
"StreetADDR1" => $billing->getStreet(1),
                                                    
"StreetADDR2" => $billing->getStreet(2),
                                                    
"ZipCode" => $billing->getPostcode(),
                                                    
"City" => $billing->getCity(),
                                                    
"State" => $billing->getRegion(),
                                                    
"Country" => $billing->getCountry(),
                                                    
"Email" => $billing->getEmail(),
                                                );

The file continues below.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ckoeber
Jr. Member
 
Total Posts:  17
Joined:  2009-03-19
 

--Continuation of Post Above---

$postData '';
            
$postData .= '<?xml version="1.0" encoding="utf-8"?>';
            
$postData .= '<soap:Envelope xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">';
            
$postData .= '<soap:Body>';
            
$postData .= '<PaymentCC xmlns="www.eposasp.com/PaySelect/EPayProcessor">';
            
$postData .= '<creditCardInfo>';
            
$postData .= '<dBaseAmount xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["amount"].'</dBaseAmount>';
            
$postData .= '<strApplicationID xmlns="www.eposasp.com/PaySelect/EPayD">'.$application_id.'</strApplicationID>';
            
$postData .= '<dAmount xmlns="www.eposasp.com/PaySelect/EPayD">'.floatval($paymentValues["amount"])+floatval($convenience_fee).'</dAmount>';
            
$postData .= '<dConvFee xmlns="www.eposasp.com/PaySelect/EPayD">'.$convenience_fee.'</dConvFee>';
            
$postData .= '<strAcctNum xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["cardNumber"].'</strAcctNum>';
            
$postData .= '<strExpDate xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["expiresMonth"].$paymentValues["expiresYear"].'</strExpDate>';
            
$postData .= '<strCVV2 xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["cardType"].'</strCVV2>';
            
$postData .= '<strAcctHolderAddress1 xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["StreetADDR1"].'</strAcctHolderAddress1>';
            
$postData .= '<strAcctHolderAddress2 xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["StreetADDR2"].'</strAcctHolderAddress2>';
            
$postData .= '<strZipCode xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["ZipCode"].'</strZipCode>';
            
$postData .= '<strTransactionData xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["orderId"].'</strTransactionData>';
            
$postData .= '<strRequestID xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["orderId"].'</strRequestID>';
            
$postData .= '<strEmail xmlns="www.eposasp.com/PaySelect/EPayD">'.$paymentValues["Email"].'</strEmail>';
            if ((int)
$logsourceip == 1)
            
{
                $postData 
.= '<strSourceID xmlns="www.eposasp.com/PaySelect/EPayD">'.$clientip.'</strSourceID>';
            
}
            
if ((int)$sendconfirmationemail == 1)
            
{
                $postData 
.= '<bSuppressEmailConfirmation xmlns="www.eposasp.com/PaySelect/EPayD">'.'0'.'</bSuppressEmailConfirmation>';
            
else {
                $postData 
.= '<bSuppressEmailConfirmation xmlns="www.eposasp.com/PaySelect/EPayD">'.'1'.'</bSuppressEmailConfirmation>';
            
}
            $postData 
.= '<transactionSource xmlns="www.eposasp.com/PaySelect/EPayD">'.$transaction_source.'</transactionSource>';
            
$postData .= '</creditCardInfo>';
            
$postData .= '</PaymentCC>';
            
$postData .= '</soap:Body>';
            
$postData .= '</soap:Envelope>';
            
/*
            *
            *
            *
            */
            
$ch curl_init();
            
curl_setopt($chCURLOPT_URL$application_url);
            
curl_setopt($chCURLOPT_TIMEOUT180);
            
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
            
curl_setopt($chCURLOPT_POSTtrue);
            
curl_setopt($chCURLOPT_POSTFIELDS$postData);
            
curl_setopt($chCURLOPT_SSL_VERIFYHOSTfalse);
            
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
            
curl_setopt($ch,CURLOPT_HTTPHEADER,array('Content-Type: text/xml; charset=utf-8'),'Content-Length: '.strlen($postData),'SOAPAction: "www.eposasp.com/PaySelect/EPayProcessor/PaymentCC"');
            
$responseData curl_exec($ch);
            
/*
            *
            *
            *
            */
 
Magento Community Magento Community
Magento Community
Magento Community
 
ckoeber
Jr. Member
 
Total Posts:  17
Joined:  2009-03-19
 

--Last part of File--

if (!$responseData{
                
throw new Exception(curl_error($ch));
            
}
            $httpCode 
curl_getinfo($chCURLINFO_HTTP_CODE);
            if (
$httpCode && substr($httpCode,0,2) != "20"{
                
throw new Exception ("Returned HTTP CODE: ".$httpCode." for this URL:. "$application_url);
            
}
            curl_close
($ch);
        
catch(Exception $e{
            $payment
->setStatus(self::STATUS_ERROR);
            
$payment->setAmount($amount);
            
$payment->setLastTransID($orderId);
            
$this->setStore($payment->getOrder()->getStoreId());
            
Mage::throwException($e->getMessage());
        
}
        $xmlResponse 
= new SimpleXMLElement($responseData);
        
$isPaymentAccepted $xmlResponse->bSuccess == 1;
        try 
{
            
if ($isPaymentAccepted{
                $this
->setStore($payment->getOrder()->getStoreId());
                
$payment->setStatus(self::STATUS_APPROVED);
                
$payment->setAmount($amount);
                
$payment->setLastTransId($orderId);
            
else {
                $this
->setStore($payment->getOrder()->getStoreId());
                
$this->setStatus(self::STATUS_DECLINED);
                
$payment->setAmount($amount);
                
$payment->setLastTransId($orderId);
                
$error $xmlResponse->strMessage;
                throw new 
Exception ("The payment processor returned with the following message: [".$error."]");
            
}
        } 
catch(Exception $e{
            Mage
::throwException($e->getMessage());
        
}
        
return $this;
    
}
    
    
/**
     * this method is called if we are authorising AND
     * capturing a transaction
     */
    
public function capture (Varien_Object $payment$amount)
    
{

    }

    
/**
     * called if refunding
     */
    
public function refund (Varien_Object $payment$amount)
    
{

    }

    
/**
     * called if voiding a payment
     */
    
public function void (Varien_Object $payment)
    
{

    }
}

Thanks so much for any help that can be provided.

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