Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Eway Payment Contribtion


Guest

Recommended Posts

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?

Link to comment
Share on other sites

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?>>

  </td>

 

couldnt you convert the dollar amount to text to send?

Link to comment
Share on other sites

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

 

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

 

Replace the above line with:

 

$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.

Link to comment
Share on other sites

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

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
Link to comment
Share on other sites

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

 

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

$amount = $amount * 100;

 

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

Link to comment
Share on other sites

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;
   }

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 9 years later...

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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...