Jump to content



Latest News: (loading..)

- - - - -

Eway Payment Contribtion


  • Please log in to reply
8 replies to this topic

#1   john_t_h

john_t_h
  • Members
  • 43 posts
  • Real Name:john

Posted 18 February 2004 - 02:27 AM

I have a problem with the eway payment contribution.

http://www.oscommerce.com/community/contributions,875

It seems that a transaction with the total amount of $3,195.86 went through as $3.00.  

As transactions under $1000 go through no problems I am assuming that the "," seperator is being sent in the total amount.  The eway gateway requires the total amount to be sent in cents.  i.e. $3,195.86 should be sent as 319586

I'm assuming that to fix this I will need to do a simple number_format()

Anyone have any ideas?

#2   Mibble

Mibble
  • Members
  • 13,404 posts
  • Real Name:JAO
  • Location:MA (US): 42n22, 71w04, Massachusetts

Posted 18 February 2004 - 03:19 AM

from looking at their 'live form' which can be downloaded, i see this line:

<td>Enter Total Amount in Cents</td>
<td><input type=text name=totalamount size="6" $a = 1234; # decimal number
value=<?echo$totalamount?>>
&nbsp; </td>

couldnt you convert the dollar amount to text to send?
John Oligario

Knowledge Base   Contributions

#3   kagg

kagg
  • Members
  • 487 posts
  • Real Name:Kavita
  • Gender:Female
  • Location:India

Posted 18 February 2004 - 05:28 AM

Find the following line in /catalog/includes/modules/payment/eway.php

Quote

$amount = number_format($order->info['total'], 2);

Replace the above line with:

Quote

$amount = $order->info['total'];

Thanks for reminding the bug. I had fixed it earlier but could not post.

I will also update the module to reflect the changes.

#4   john_t_h

john_t_h
  • Members
  • 43 posts
  • Real Name:john

Posted 18 February 2004 - 07:59 AM

ummm I gave that a quick test with a $2.28 transaction and was returned this error

Quote

Error: Invalid Amount. Your credit card has not been billed for this transaction. TotalAmount= 228.14 , please try again

Now I didn't have enough in the card I used to cover $228 but it still needs some sort of formatting?

:(

Edited by john_t_h, 18 February 2004 - 08:01 AM.


#5   kagg

kagg
  • Members
  • 487 posts
  • Real Name:Kavita
  • Gender:Female
  • Location:India

Posted 18 February 2004 - 08:25 AM

Check if /includes/modules/payment/eway.php has the following lines for amount:

Quote

$amount = $order->info['total'];
$amount = $amount * 100;

If this still do not solve your problem, you may post function process_button() from eway.php.

#6   john_t_h

john_t_h
  • Members
  • 43 posts
  • Real Name:john

Posted 18 February 2004 - 10:42 AM

Yeah I had that second line in the code.  Here is the function process_button ( I have the $amount = $order->info['total']; commented out for now as I have reverted back to the original.  

function process_button() {
                              

        global $HTTP_POST_VARS, $HTTP_SERVER_VARS, $CardNumber, $order, $customer_id, $zone_id, $zone_query;	

$year = $HTTP_POST_VARS['eway_cc_expires_year'];	

$zone_query = tep_db_query("select * from zones where zone_name = '" . $order->delivery['state'] . "'");
          if (tep_db_num_rows($zone_query) == 1) {
            $zone_values = tep_db_fetch_array($zone_query);
            $zone_id = $zone_values['zone_code'];
          } 
    else $zone_id='KA';
$amount = number_format($order->info['total'],2);
//$amount = $order->info['total'];
$amount = $amount * 100;
        $process_button_string = tep_draw_hidden_field('my_customerid', MODULE_PAYMENT_EWAY_CUSTOMER_ID) .
        tep_draw_hidden_field('my_invoice_ref', $customer_id . '-' . date('Ymdhis')) .
        tep_draw_hidden_field('my_totalamount', $amount) .
        tep_draw_hidden_field('my_firstname', $order->customer['firstname']) .
        tep_draw_hidden_field('my_lastname', $order->billing['lastname']) .
        tep_draw_hidden_field('my_address', $order->billing['street_address']) .
        tep_draw_hidden_field('my_postcode', $order->customer['postcode']) .
                                                                          tep_draw_hidden_field('eWAYURL ', tep_href_link(FILENAME_CHECKOUT_PROCESS,'','SSL',false)) .
                                                                           tep_draw_hidden_field('eWAYAutoRedirect', '1') .
        tep_draw_hidden_field('my_email', $order->customer['email_address']) .
        tep_draw_hidden_field('my_card_name', $this->cc_owner) .
                                 tep_draw_hidden_field('my_card_number', $this->cc_number) .
                                 tep_draw_hidden_field('my_card_exp_month', $this->cc_expires_month) .
        tep_draw_hidden_field('my_card_exp_year', $year).
tep_draw_hidden_field('my_ewayOption1', tep_session_id());
                                 
tep_draw_hidden_field('my_invoice_description', tep_session_id());
        
        
 return $process_button_string;
    }


#7   john_t_h

john_t_h
  • Members
  • 43 posts
  • Real Name:john

Posted 19 February 2004 - 12:23 AM

What format is the $order->info['total'] sent in before formating?

is it 3,123.25?

I guess it still needs to be formated so it is sent to eway as 312325.  Can the number_format function strip out the "," and the "." from the variable?  Or perhaps there is some other function that can do it?

#8   kagg

kagg
  • Members
  • 487 posts
  • Real Name:Kavita
  • Gender:Female
  • Location:India

Posted 19 February 2004 - 04:47 AM

Quote

Error: Invalid Amount. Your credit card has not been billed for this transaction. TotalAmount= 228.14 , please try again

228.14 is not the amount in $, but it is amount sent in cents.

What is the default currency in your store? Can you PM or email me your site URL, admin and FTP login so that I may have look into the problem.

#9   MistyGully

MistyGully
  • Members
  • 3 posts
  • Real Name:Andrea Prickett

Posted Today, 12:59 AM

I realise that this is a very old post but I am experiencing the same error in our online store. I am the store owner and this problem only started after I made a change to the position of the EWAY option in the display of the payment area that the customer sees when checking out. I used the standard position option in the payment module and moved them around. After I did this I started to get my customers contacting me (the same day) to say that their payment could not go through and the error showing was  Invalid Amount. Your credit card has not been billed for this transaction. TotalAmount=    . I contacted Eway and they said that they require the amount to come through as cents. I moved the EWAY option back to its original position and the problem still continued, however it is only an intermittent problem for low priced orders that seem to be below $40 odd dollars. I contacted my web host and he said he would have to get a programmer to look into it that he had no idea of why it was happening and that I would have to cover the cost, I am a bit gun shy after the last time OS commerce broke it cost us over $2,000 in upgrades and fixes to be put in place. I don't understand why this is happening and how OS commerce could be broken so easily. Can anyone share with me what could have happened to cause this and any suggestions as to what I need to do to fix it. I would like to be able to provide our programmer with the correct information so it can be fixed, the above details are quite old so I thought it best to check what it should be now.