Zen Cart Logo
Forums / Addon Payment Modules / Currency Calculation Bug Found in Paypal IPN module

Currency Calculation Bug Found in Paypal IPN module

Locked

Views: 5,023

Results 1 to 11 of 11
This thread is locked. New replies are disabled.
2 Feb 2007, 12:30 AM
#1
peter_homann avatar

peter_homann

Zen Follower

Join Date:
Jun 2006
Location:
Melbourne, VIC
Posts:
106
Plugin Contributions:
0

Currency Calculation Bug Found in Paypal IPN module

Hi,

I upgraded to 1.3.7, removed the Paypal IPN module then added it in as instructed.

In my Paypal account I have set my default currency to AUD$. I also accept US$

In my ZenCart I have set my default currency to US$ as most of my customers are in the USA. That way I set the prices in US$

If I set the currency option in Zencart Paypal IPN to use selected currency all is well. The orders are processed correctly

If I set it to only AUD$ I experience the problem where I receive a paypal payment but no order turns up in ZenCart.

So I turned on the debugging. The final debug message #13 says

IPN WARNING::Currency/Amount Mismatch. Details:
PayPal email address = [email protected]
| mc_currency = AUD
| submitted_currency = AUD
| order_currency = USD
| mc_gross = 15.98
| converted_amount = 15.99
| order_amount = 12.38

It appears that there is a rounding problem somwhere. The order was place with the currency set to US$ for the amount of US$12.38.

Then when checking out in the Paypal enter payment info page. (Before logging into paypal), the page shows the amount as. AUD$ 15.98

When I log into Paypal, the amount still shows AUD$15.98, and this is the amount that Paypal notifies me I been payed.

I presume that the order is rejected because the converted_amount of 15.99 does not mated the mc_gross amount of 15.98.

Is there a rounding error somewhere?

I hope this helps.

Also in debug #8 I get the message

IPN WARNING::Could not find matched txn_id record in DB

Cheers,

Peter.

9 Feb 2007, 5:00 AM
#2
drbyte avatar

drbyte

Sensei

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

Re: Currency Calculation Bug Found in Paypal IPN module

If the customer purchases using AUD and you have your PayPal settings in Zen Cart set to "Use selected Currency" or to use "AUD Only", what differences do you see in the logs (specifically in the section you posted about currency mismatches)?

9 Feb 2007, 5:21 AM
#3
peter_homann avatar

peter_homann

Zen Follower

Join Date:
Jun 2006
Location:
Melbourne, VIC
Posts:
106
Plugin Contributions:
0

Re: Currency Calculation Bug Found in Paypal IPN module

DrByte:

If the customer purchases using AUD and you have your PayPal settings in Zen Cart set to "Use selected Currency" or to use "AUD Only", what differences do you see in the logs (specifically in the section you posted about currency mismatches)?

Thanks for the reply. From memory, if they select the currency to be AUD, then it is OK. But, give me 10 minutes to test it out.

Cheers,

Peter.

9 Feb 2007, 5:52 AM
#4
peter_homann avatar

peter_homann

Zen Follower

Join Date:
Jun 2006
Location:
Melbourne, VIC
Posts:
106
Plugin Contributions:
0

Re: Currency Calculation Bug Found in Paypal IPN module

Peter Homann:

Thanks for the reply. From memory, if they select the currency to be AUD, then it is OK. But, give me 10 minutes to test it out.

Cheers,

Peter.

OK, Using Paypal IPN with currency set to Selected currency. In the store I selected the currency to AUD. Made a purchase and discovered another problem. :cry:

This was due to not enough funds in the paypal account.

I tried another purchase with a lesser amount so no pending echeck and all was fine.

Thanks,

Peter.

In the debug messages, message #8 is

IPN WARNING::Could not find matched txn_id record in DB

#9 is

Breakpoint: 4 txn_type=unique ordersID =  IPN_id=

#10

IPN DEBUG::uniqueness-test.  Relevant data from POST:
txn_type = unique
parent_txn_id = 
txn_id = 8HA28436R8910243J

first part of #11

IPN NOTICE::Set transaction type = pending-echeck
POST data:
mc_gross=15.92 
&address_status=unconfirmed 

#12

Breakpoint: 5 txn_type=pending-echeck

first part of #13

IPN WARNING:: Could not establish txn type pending-echeck
 postdata=mc_gross=15.92 
&address_status=unconfirmed 
9 Feb 2007, 6:00 AM
#5
drbyte avatar

drbyte

Sensei

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

Re: Currency Calculation Bug Found in Paypal IPN module

The "cleared" echeck notice should complete the order properly.

9 Feb 2007, 6:01 AM
#6
drbyte avatar

drbyte

Sensei

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

Re: Currency Calculation Bug Found in Paypal IPN module

I'm glad that using "Selected Currency" is at least a working option.

Not sure the cause of the rounding problem, since the formula used to calculate the initial number and the formula to verify matching ... are the same formula.
Will have to do some digging on that part.
Thanks for the detailed report -- it helps a lot with narrowing things down.

9 Feb 2007, 6:14 AM
#7
peter_homann avatar

peter_homann

Zen Follower

Join Date:
Jun 2006
Location:
Melbourne, VIC
Posts:
106
Plugin Contributions:
0

Re: Currency Calculation Bug Found in Paypal IPN module

DrByte:

I'm glad that using "Selected Currency" is at least a working option.

Not sure the cause of the rounding problem, since the formula used to calculate the initial number and the formula to verify matching ... are the same formula.
Will have to do some digging on that part.
Thanks for the detailed report -- it helps a lot with narrowing things down.

I really appreciate your effort, looking into this. The reason I want all transactions in AUD, is that AUD is what my accounting software requires, and also the customer pays the Paypal currency conversion fee rather than me when I shift the funds to my Aussie bank account.

Cheers,

Peter.

9 Feb 2007, 6:42 AM
#8
drbyte avatar

drbyte

Sensei

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

Re: Currency Calculation Bug Found in Paypal IPN module

Good point, and well understood.
Will keep digging :)

Meanwhile, if you can detail what the line-item prices and subtotal prices and tax amounts were on the order you quoted earlier (15.98 vs 15.99), that will help me reconstruct such a transaction for easier testing ...

9 Feb 2007, 11:51 AM
#9
peter_homann avatar

peter_homann

Zen Follower

Join Date:
Jun 2006
Location:
Melbourne, VIC
Posts:
106
Plugin Contributions:
0

Re: Currency Calculation Bug Found in Paypal IPN module

DrByte:

Good point, and well understood.
Will keep digging :)

Meanwhile, if you can detail what the line-item prices and subtotal prices and tax amounts were on the order you quoted earlier (15.98 vs 15.99), that will help me reconstruct such a transaction for easier testing ...

Hi,

OK, Product was US$4.00, postage was US$8.38, including US$1.49 handling charges. No taxes or other charges.

Cheers,

Peter.

21 Mar 2007, 6:15 AM
#10
peter_homann avatar

peter_homann

Zen Follower

Join Date:
Jun 2006
Location:
Melbourne, VIC
Posts:
106
Plugin Contributions:
0

Re: Currency Calculation Bug Found in Paypal IPN module

DrByte:

Good point, and well understood.
Will keep digging :)

Hi Doc,

Today I loaded the latest Paypal patches and this problem seems to be fixed. Did you do that ?

If so thanks very much.

Cheers,

Peter.

21 Mar 2007, 7:06 AM
#11
drbyte avatar

drbyte

Sensei

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

Re: Currency Calculation Bug Found in Paypal IPN module

Yes, there have been a lot of improvements as time has progressed. Thanks for your patience, and for the confirmation that this issue is also fixed.