Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / Wrong total in bank module

Wrong total in bank module

Locked

Views: 4,876

Results 21 to 30 of 30
This thread is locked. New replies are disabled.
8 Sep 2006, 7:14 AM
#21
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Wrong total in bank module

Hi again,

the bank module php file that I have in my folder includes/modules/payment is identical with the same file that I used to have in the version 1.2.6. Is there something in the functions or elsewhere that should be changed for these new ZC versions?

For example in the payment module authorizenet there has appeared new things after 1.2.6. but I can't figure out if it is needed to be changed for the other modules as well and should I modify then some other files as well?

For example this is added for authorizenet:

class authorizenet extends base {
/**

  • $code determines the internal 'code' name used to designate "this" payment module
  • @var string
    /
    var $code;
    /
    *
  • $title is the displayed name for this payment method
  • @var string
    /
    var $title;
    /
    *
  • $description is a soft name for this payment method
  • @var string
    /
    var $description;
    /
    *
  • $enabled determines whether this module shows or not... in catalog.
  • @var boolean
    /
    var $enabled;
    /
    *
  • @return authorizenet

Elli

8 Sep 2006, 9:58 AM
#22
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Wrong total in bank module

I went through the available other payment modules to test how they work with my current shop. I managed to create an account and configure AlertPay to receive payments and it seems that it works with the same sums that it won't work with my bank module.

I had sum 30,40 euro and the AlertPay asked 38,70 dollars out of it. So, with today's currency rate it sounds perfect. Anyway no thousand times bigger sums created.

So, it looks like my payment module has some function or something incompatible with the new ZC since I have heard (and actually went to test in these shops I heard) this module has worked and is working currently perfectly in some shops with ZC1.2.6 and ZC1.2.7.

So, I do not know how to look what is wrong possibly in my bank module. Who could help me in that? (I still have it ready zipped for coming to a tester...;)

Elli

8 Sep 2006, 12:53 PM
#23
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Wrong total in bank module

I think I'm getting closer understanding where's the problem but somebody more expert may understand what is wrong here in my bank module (part of the code):

function process_button() {
global $order;
$this->total = $order->info['total'];
$this->make_ref();

	$process_button_string = zen_draw_hidden_field('SOLOPMT_VERSION', $this->ifversion) .

zen_draw_hidden_field('SOLOPMT_RCV_ID', MODULE_PAYMENT_NORDEASOLO_SOLOPMT_RCV_ID) . zen_draw_hidden_field('SOLOPMT_RCV_ACCOUNT', MODULE_PAYMENT_NORDEASOLO_SOLOPMT_RCV_ACCOUNT) . zen_draw_hidden_field('SOLOPMT_RCV_NAME', MODULE_PAYMENT_NORDEASOLO_SOLOPMT_RCV_NAME) .
zen_draw_hidden_field('SOLOPMT_LANGUAGE', $Lang) . zen_draw_hidden_field('SOLOPMT_MSG', MODULE_PAYMENT_NORDEASOLO_SOLOPMT_MSG) .
zen_draw_hidden_field('SOLOPMT_KEYVERS', MODULE_PAYMENT_NORDEASOLO_SOLOPMT_KEYVERS) .
zen_draw_hidden_field('SOLOPMT_DATE', 'EXPRESS') . zen_draw_hidden_field('SOLOPMT_CONFIRM', 'YES') . zen_draw_hidden_field('SOLOPMT_CUR', 'EUR') . zen_draw_hidden_field('SOLOPMT_RETURN', zen_href_link(FILENAME_CHECKOUT_PROCESS, '', 'SSL') . "&fcID=" . $this->mkref_check()) . zen_draw_hidden_field('SOLOPMT_CANCEL', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')) . zen_draw_hidden_field('SOLOPMT_REJECT', zen_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL')) .
zen_draw_hidden_field('SOLOPMT_STAMP', $this->refer) . zen_draw_hidden_field('SOLOPMT_REF', $this->mkref_check()) .
zen_draw_hidden_field('SOLOPMT_AMOUNT', $this->total) .
zen_draw_hidden_field('SOLOPMT_MAC', $this->make_mac());

return $process_button_string;

I looked the alertpay module and changed this line:

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

to this:

$this->total = number_format($order->info['total']);

Then the sum was not anymore thousand times bigger but it was rounded down, for example 30,40 euro sum ended up being 30,00 euro in the bank.

Elli

10 Sep 2006, 10:53 AM
#24
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Wrong total in bank module

So, I changed finally this line:

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

to this:

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

Then the sum was not anymore thousand times bigger neither it was rounded down, and it looks like working. Any reason why the original didn't work if this does? Do you think this is a safe solution for the case? I have been trying to test with different sums and shipping amount combinations now if all goes right... sofar it looks good.

Elli

12 Sep 2006, 6:33 PM
#25
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Wrong total in bank module

ellivir:

So, I changed finally this line:

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

to this:

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

Then the sum was not anymore thousand times bigger neither it was rounded down, and it looks like working. Any reason why the original didn't work if this does? Do you think this is a safe solution for the case? I have been trying to test with different sums and shipping amount combinations now if all goes right... sofar it looks good.

Elli

Nobody can comment this solution for me?
I put the shop online, I really hope this solution is durable.

Elli

12 Sep 2006, 6:46 PM
#26
ajeh avatar

ajeh

Oba-san

Join Date:
Sep 2003
Location:
Ohio
Posts:
62,757
Plugin Contributions:
1

Re: Wrong total in bank module

What are your Currency settings?

Any chance something is off on them?

12 Sep 2006, 7:22 PM
#27
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Wrong total in bank module

Ajeh:

What are your Currency settings?

Any chance something is off on them?

Currency settings should be fine and the above solution really looks like working but I would just like to know if the solution is clever or does it sound logical to you that changing this I didn't get anymore the thousand times bigger sums in the bank side.

I'm asking this because I am not a coder and I'm just trying what solution would work.
Over 100 euro sums worked before as well but the problem was the sums with 2 numbers in them, like 32 euro plus some shipping sum, for example 3 euro added. Then it went crazy saying that it was 35.000,00 euro instead of only 35,00 euro. But now with the above solution this doesn't appear and all seems working well. :)

I'm just an amateur in coding and thus hesitating if my solution lasts...

Elli

16 Sep 2006, 7:35 PM
#28
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
176

Re: Wrong total in bank module

ellivir:

So, I changed finally this line:

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

to this:

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

Any reason why the original didn't work if this does? Do you think this is a safe solution for the case?
Yes, that should be fine.
It's limited to only work with 2 decimal places, but for most applications that is fine.
For your case, it would appear to be safe.

I suspect this showed up for you as a problem because of a currency/locale setting within PHP on your webserver that wasn't the same as the original author of the contribution was using, and thus it wasn't discovered there.

By forcing translation of the dollar amount to a specific format, you are sending "good" data to the bank, which results in successful transactions.

24 Sep 2006, 1:18 PM
#29
ellivir avatar

ellivir

Zen Follower

Join Date:
Sep 2005
Posts:
444
Plugin Contributions:
0

Re: Wrong total in bank module

DrByte:

Yes, that should be fine.
It's limited to only work with 2 decimal places, but for most applications that is fine.
For your case, it would appear to be safe.

I suspect this showed up for you as a problem because of a currency/locale setting within PHP on your webserver that wasn't the same as the original author of the contribution was using, and thus it wasn't discovered there.

By forcing translation of the dollar amount to a specific format, you are sending "good" data to the bank, which results in successful transactions.

Thanks for your feedback and indeed it seems to have been working fine all this time already in my shop. After your post I anyway feel more secure to keep going... :)

Elli

13 May 2007, 1:10 PM
#30
srbin avatar

srbin

New Zenner

Join Date:
Oct 2006
Posts:
32
Plugin Contributions:
0

Re: Wrong total in bank module

Alertpay module is not working for me at https://www.super-majice.com. Can somebody check it?