Call-back icon  Sales: Call 877.832.5289 (N America)|310.295.4144 (International)

Magento

eCommerce Software for Online Growth

Magento Forum

   
Page 13 of 14
Payment method - new module tutorial
 
jay77
Member
 
Total Posts:  31
Joined:  2007-10-22
 

To complete my previous post, please check the file attached.

it comes from my server activity. since i’ve installed the ‘bank transfer’ payment method, the activity has more than 20x.

Any clue ?

Image Attachments
sonar_grapher.html.png
 
Magento Community Magento Community
Magento Community
Magento Community
 
jay77
Member
 
Total Posts:  31
Joined:  2007-10-22
 

My admin has restarted the Apache server, and everything is now back to normal !

 
Magento Community Magento Community
Magento Community
Magento Community
 
cm_st
Jr. Member
 
Total Posts:  3
Joined:  2008-06-13
 

Hello,

I’m currently working on a SecureTrading payment module for their XPay (API) interface. So far I’m able to process a standard payment and display the results in the sales view of the admin screens. However SecureTrading require a number of additional fields to be displayed here.

I’ve managed to added a field to the database using the mysql install file (field can be seen in eav_attribute table) and I can see the field being set in the $payment object in the authorize method. However this field isn’t saved in sales_order_entity_varchar where as native fields such as cc_approval that have been set at the same time are saved.

I assume there is a mapping between setFirstwordSecondword("value") on the $payment object and firstword_secondword in the database? Is there any other methods that require overriding to save my additional field?

In addition to this problem I’m also trying to set cc_ss_start_year,cc_ss_start_month and cc_ss_issue within my authorize method by saving them from form.phtml input field names “payment[cc_ss_start_year]”, is this correct and would they then be retrieved by using $payment->getCcSsStartYear();? I’d be greatful for any assistance on these issues.

Regards,

Carl

 
Magento Community Magento Community
Magento Community
Magento Community
 
cm_st
Jr. Member
 
Total Posts:  3
Joined:  2008-06-13
 

Making progress on the above issue.

In the mysql install file, I adding an attribute to the wrong group. The below is my original code.

$installer->addAttribute('quote_payment''securetradingxpay_myfield1', array());

I changed ‘quote_payment’ to ‘order_payment’ as this is the same group as the credit card details and I can now see my field in the database and call it in the admin screens.

I’m still having issues with saving to cc_ss_start_year e.t.c, I’ve got a feeling it may be because these are fields from another module but I’m still investigating. Will update with my progress here for anybody who experiencing similar issues.

Regards,

Carl

 
Magento Community Magento Community
Magento Community
Magento Community
 
cm_st
Jr. Member
 
Total Posts:  3
Joined:  2008-06-13
 

Again, progressed with my issue.

In order to save my custom fields from form.phtml, I needed to include the following method.

class Mage_SecureTradingXPay_Model_Securetradingxpay extends Mage_Payment_Model_Method_Cc
{

...

   public function 
assignData($data)
    
{
        
if (!($data instanceof Varien_Object)) {
            $data 
= new Varien_Object($data);
        
}
        $info 
$this->getInfoInstance();
        
$info->setCcSsIssue($data->getCcSsIssue());
        return 
$this;
    
}
}

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cy
Jr. Member
 
Avatar
Total Posts:  6
Joined:  2008-06-25
Marbella - Spain
 

I am progressing on the elaboration of my own payment gateway module.

The only problem I am facing is that my Credit Card payment processor has a strange way of handling things which is.

1.- I need to “POST” the “order number” and “SHOP_IDENTIFICATION_NUMBER”, (Which I correctly did
2.- Then the gateway needs to call back my shop to a FIX URL where it enquires (USING THE ORDER NUMBER) for the cart contents and amount.
3.- After the result is given then the POS screen is shown to the end user for introducing his details.

I am stuck in point number 2. Although I have all the functions to do it, I don’t know how to make a STATIC URL inside the application to return the contents.

I imagine this is to do with me not understanding how the rewriting of URL works in Magento, but belive me I’ve done tons of searches and can’t find out how to make inside my model something that when I call a STATIC URL (IE: url.com/magento/mypaymentmodule/returncartcontents)

It’s mandatory for my payment processor that I setup in their administration this static URL to return them the contents and amount after I’ve called their URL with the “order number” and “SHOP_IDENTIFICATION_NUMBER”.

Is anybody able to help me on this or point me on the right direction?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cy
Jr. Member
 
Avatar
Total Posts:  6
Joined:  2008-06-25
Marbella - Spain
 

I’ve solved the rewrite problem, it’s just question of understanding the MVC structure, sorry about that.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Predrag
Jr. Member
 
Total Posts:  7
Joined:  2007-12-04
Croatia
 

Hi,

Can someone confirm that Wiki article about new payment module is updated to work with Magento ver. 1.0 ?
I have followed instructions on http://www.magentocommerce.com/wiki/how-to/create-payment-method-module - and so far I just got error message:

Fatal error: Uncaught exception ‘Mage_Core_Model_Store_Exception’ ...

I’m using Magento 1.0.19700 with PHP 5, Apache 2.2 and MySql 5 on Ubuntu 8.04.

 
Magento Community Magento Community
Magento Community
Magento Community
 
hogehoge
Jr. Member
 
Total Posts:  10
Joined:  2008-05-06
 

Please help !
@Magento ver. 1.0.19870

mysql install script :

$installer $this;
$installer->addAttribute('quote_payment''convenience_type', array());
$installer->addAttribute('order_payment''convenience_type', array());
$installer->addAttribute('invoice''convenience_type', array());

model :

/**
* Japanese convenience store
*/
class Mycompany_Payment_Model_Convenience extends Mage_Payment_Model_Method_Abstract
{
  
protected $_code 'convenience';

  protected 
$_formBlockType 'mycompanypayment/convenience_form';
  protected 
$_infoBlockType 'mycompanypayment/convenience_info';

  protected 
$_isGateway               true;
  protected 
$_canAuthorize            false;
  protected 
$_canCapture              false;
  protected 
$_canCapturePartial       false;
  protected 
$_canRefund               false;
  protected 
$_canVoid                 false;
  protected 
$_canUseInternal          true;
  protected 
$_canUseCheckout          true;
  protected 
$_canUseForMultishipping  true;

  public function 
validate()
  
{
    parent
::validate();
    
$info $this->getInfoInstance();     

    if (
$info instanceof Mage_Sales_Model_Order_Payment{
      $paymentType 
$info->getOrder()->getPayment()->getConvenienceType();
    
else {
      $paymentType 
$info->getQuote()->getPayment()->getConvenienceType();
    
}
   
   
// check convenience type 
    
if (is_null($paymentType)) {
      Mage
::throwException($this->_getHelper()->__('Please select convenience store.'));
    
}
    
elseif (!in_array($paymentTypeexplode(","$this->getConfigData('types')))) {
      Mage
::throwException($this->_getHelper()->__('invalid convenience store.'));
    
}
    
return $this;
  
}

  
public function canUseForCountry($country)
  
{
    
if ($country !== 'JP'{
      
return false;
    
}
    
return true;
  
}

  
/**
  * It connect to gateway.
  *
  * @see Mycompany_Payment_Model_Obverser
  * @trigger sales_order_payment_place_end
  */
  
public function doTransacrion($command$request$payment$amount)
  
{
    
//Omission
  
}
}

In the above-mentioned code

$info->getQuote()->getPayment()->getConvenienceType();
It is possible to acquire it.

But

$info->getOrder()->getPayment()->getConvenienceType();
It return null.

Why is it impossible to acquire it.

Someone helps.

UPDATE1
At saveOrderAction.

$_POST['payment']['convenience_type']
It is always possible to acquire it.

$info->getOrder()->getPayment()->getConvenienceType();
It is always impossible to acquire it .

Where do I add any code?

UPDATE2
Self-solving.
Mage_Sales_Model_Convert_Quote::paymentToOrderPayment() found.
thanks.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Predrag
Jr. Member
 
Total Posts:  7
Joined:  2007-12-04
Croatia
 

Wiki article about new payment module is OK but it did not work for me with 1.0.19700. 
No fatal errors now.

 
Magento Community Magento Community
Magento Community
Magento Community
 
isekream
Jr. Member
 
Total Posts:  2
Joined:  2008-07-16
Trinidad
 
chinesedream - 04 June 2008 05:59 PM

Gabriel Queiroz - 01 June 2008 10:03 AM


I’m finishing my module, it will be used for First Attlantic Commerce paygate. If anyone’s interested let me know and I’ll post it here.

See ya,

Hi Gabriel, yes please post it here. I need a payment module for TransFirst, and is hoping I can follow your working ones to make it work.

I have followed the WIKI’s article, it first didn’t show up on the frontend, and at the admin side, it shows only three options, after reading others’ comments on this thread, I made changes accordingly, now the admin side is throwing errors.

TIA

It would be great if I can get to use it...I was in the process of building a payment gateway module specifically for First Atlantic...you knowldege and code on it would be greatly appreciated…

 
Magento Community Magento Community
Magento Community
Magento Community
 
superglue
Jr. Member
 
Total Posts:  8
Joined:  2007-12-08
Kaunas
 
Mark Robinson - 25 April 2008 07:48 AM

Hi

I’m trying to develop a copy of the check/money order payment method for bank transfers. I got it all working on my local machine but when I transferred all the files to the server I get an error in the checkout page on the frontend:

Fatal error: Call to a member function setMethod() on a non-object in /home/user/public_html/bp/app/code/core/Mage/Payment/Helper/Data.php on line 125

The page url is http://www.example.com/checkout/onepage/

Any ideas how to troubleshoot this?

Thanks

Hello, did you found the way to solve this issue? I have the same situation.

 
Magento Community Magento Community
Magento Community
Magento Community
 
superglue
Jr. Member
 
Total Posts:  8
Joined:  2007-12-08
Kaunas
 
superglue - 20 July 2008 07:14 AM

Mark Robinson - 25 April 2008 07:48 AM
Hi

I’m trying to develop a copy of the check/money order payment method for bank transfers. I got it all working on my local machine but when I transferred all the files to the server I get an error in the checkout page on the frontend:

Fatal error: Call to a member function setMethod() on a non-object in /home/user/public_html/bp/app/code/core/Mage/Payment/Helper/Data.php on line 125

Hello, did you found the way to solve this issue? I have the same situation.

Solved this by adding local/Mage/MyPaymentMethod/Block/Form/MyPaymentMethod.php and local/Mage/MyPaymentMethod/Block/Info/MyPaymentMethod.php modules similar to those found in core/Mage/Payment/Block catalog.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Core
Member
 
Total Posts:  68
Joined:  2008-03-09
 

Has anyone created a pxpay payment module for DPS NZ? 

I saw reference to pxpay in this thread but it was referencing a file that doesn’t exist and a module that I can’t find. 

any help appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
jshirkey
Jr. Member
 
Total Posts:  12
Joined:  2008-06-20
Charlottesville, VA
 

I am creating an eCheck (ACH) payment module, and I’m having trouble with integrating custom user input fields into the onepage checkout process.  Having looked at the existing payment gateway code, this and other forum/wiki articles, I’m just not sure what I am missing.

My problem is this: when I select my eCheck payment option on the Payment Information tab of OnePage, my eCheck form shows up, and I can enter in my data.  Once I click submit, the Payment Method tab of the Checkout Progress sidebar appears, but the values I try to echo are blank.  However, when I continue on and Place Order, my order completes successfully, and the order confirmation email that I receive has the info fields properly populated.  I cannot figure out why my Checkout Progress -> Payment Method sidebar info template is not getting populated.  If I change the post variables in my form template to the same ones used in the default Credit Card payment form template, I am able to then reference those object variables in the same method as my code below, and get data back.

Here are relevant snippets of code from my module:

From the form template for my payment method:

<li>
    <
div class="input-box">
        <
label for="<?php echo $_code ?>_account_number"><?php echo $this->__('Bank Account Number'?> <span class="required">*</span></label><br/>
        <
input type="text" id="<?php echo $_code ?>_account_number" name="payment[account_number]" title="<?php echo $this->__('Bank Account Number') ?>" class="input-text" value="" />
    </
div>
</
li>
<
li>
    <
div class="input-box">
        <
label for="<?php echo $_code ?>_routing_number"><?php echo $this->__('Routing/Transit Number'?> <span class="required">*</span></label><br />
        <
input type="text" id="<?php echo $_code ?>_routing_number" name="payment[routing_number]" title="<?php echo $this->__('Routing/Transit Number') ?>" class="input-text" value="" maxlength="9"/>
    </
div>
</
li>
<
li>
    <
div class="input-box">
        <
label for="<?php echo $_code ?>_check_number"><?php echo $this->__('Next Available Check Number'?> <span class="required">*</span></label><br />
        <
input type="text" id="<?php echo $_code ?>_check_number" name="payment[check_number]" title="<?php echo $this->__('Next Available Check Number') ?>" class="input-text" value="" maxlength="9"/>
    </
div>
</
li>

From the info template for my payment method:

<?php echo Mage::helper('payment')->__('Check Number: %s'$this->htmlEscape($this->getCheckNumber())) ?><br/>
<?php echo Mage::helper('payment')->__('Account No: %s'$this->htmlEscape($this->getAccountNumber() )) ?><br/>
<?php echo Mage::helper('payment')->__('Routing No: %s'$this->htmlEscape($this->getRoutingNumber())) ?>

The assignData function in my payment method class

public function assignData($data)
{
    
if (!($data instanceof Varien_Object)) {
        $data 
= new Varien_Object($data);
    
}
        
    $info 
$this->getInfoInstance();
        
    
$info->setRoutingNumber($data->getRoutingNumber())
         ->
setAccountNumber($data->getAccountNumber())
           ->
setCheckNumber($data->getCheckNumber())
         ;
            
    return 
$this;
}

The paymentToQuotePayment function from my extended Mage_Sales_Model_Convert_Order class:

public function paymentToQuotePayment(Mage_Sales_Model_Order_Payment $payment$quotePayment=null)
{
    $quotePayment 
parent::paymentToQuotePayment($payment$quotePayment);
    
    
$quotePayment->setRoutingNumber($payment->getRoutingNumber());
    
$quotePayment->setAccountNumber($payment->getAccountNumber());
    
$quotePayment->setCheckNumber($payment->getCheckNumber());
       
    return 
$quotePayment;
}

My event observer for sales_convert_quote_payment_to_order_payment:

public function AddAdditionalParametersToOrderPayment($observer)
{
    $orderPayment 
$observer->getEvent()->getOrderPayment();
    
$payment $observer->getEvent()->getQuotePayment();
    
    
$orderPayment->setRoutingNumber($payment->getRoutingNumber());
    
$orderPayment->setAccountNumber($payment->getAccountNumber());
    
$orderPayment->setCheckNumber($payment->getCheckNumber());
}

Finally, I have installed eav_attribute records for “routing_number”, “account_number”, and “check_number” for both the “order_payment” and “quote_payment” eav_entity_type’s via the standard Magento method.  I see where my order_payment attributes have corresponding sales_order_entity_varchar records persisted after my order is placed.

I am developing against Magento 1.1.2.  Part of my problem is that I’m in the dark as far as properly debugging the onepage.  I’m using Eclipse PDT with the Zend Debugger module for apache, but the AJAX on onepage causes debugger/apache to crash everytime I load it.  :-(

I have also looked at the <fieldsets> definitions within Mage_Sales config.xml.  I see where the paymentToQuotePayment methods, etc have been updated to copy field sets.  I tried to define extra fieldset definitions in my modules config.xml in the following style, but that didn’t seem to help either:

<sales_convert_quote_payment>
    <
routing_number><to_order_payment>*</to_order_payment></routing_number>
</
sales_convert_quote_payment>

Anyway… if anyone knows of an obvious step I’ve overlooked, or what I might be doing improperly, I would GREATLY appreciate the help!  I’m stuck at the moment!  I had no problems creating a vanilla credit card payment module, but I have not done alot with altering the database structure in Magento and the process of adding custom input fields for this payment method has be confused.

Thanks in advance!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 13 of 14
 
Sales: Call 877.832.5289 (North America) 310.295.4144 (International)
© Copyright 2008 Varien. Magento, eCommerce software, is a trademark of Irubin Consulting Inc. DBA Varien
Privacy Policy|Terms of Service
Magento Community Count
52323 users|444 users currently online|105667 forum posts