Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Incorrect voucher balance (paypal IPN)


FWR Media

Recommended Posts

I have read all 150 odd posts and can't see anyone with the same problem which leads me to believe the problem is local to my code.

 

I am using 5.14 with all available correction mods (to my knowledge)

 

The problem exists with paypal IPN only, which suggests it lays with the paypal_ipn.php file: -

 

All works fine, except example: -

 

Customer has a voucher balance of ?15.01

 

Customer buys a product with a value of ?24.98 and clicks to use their voucher credit

 

Result: -

 

All correct going through the paypal process

 

Return to the shop: -

 

Voucher Balance reads : ?5.04 where it should read ?0

 

What it's doing is :-

 

voucher balance remaining = (previous voucher balance - Total cash paid(in this case ?9.97))

 

Instead of what it should be doing :-

 

voucher balance remaining = (previous voucher balance - voucher amount used this purchase)

 

Any ideas? is the fault in the CCGV_514_PaypalIPN_11_fix contribution?

 

Thanks

 

Rob

Link to comment
Share on other sites

***More Info to Tie this down****

 

The email sent to customer is also wrong as follows: -

 

Sub-Total: ?24.98 >>Is correct

UK Royal Mail Rates (Shipping to GB : 4.00 kg(s)): ?0.00 >>Is correct

Gift Vouchers: ?9.97 (Should show ?15.01 i.e. the value of the voucher)

Total: ?0.00 (Should be ?9.97 (i.e. (total cost - minus voucher value) )

 

My order total module sequence is below: -

 

sub total =1

shipping = 2

tax = 3

discount coupons = 4

gift vouchers = 5

total = 6

Edited by thunderace
Link to comment
Share on other sites

To clarify:

 

All is correct in admin>orders

 

 

All is correct in customer order history screen.

 

 

The problems are: -

 

voucher balance is updated incorrectly with the cash value spent (item value - voucher value)

 

email sent out shows: -

 

The order total as what the final voucher balance should have been.

 

The voucher value used as the cash value spent

Edited by thunderace
Link to comment
Share on other sites

Well I've answered this for myself.

 

So here is the solution in case others have this problem.

 

Symptoms: -

 

As mentioned above .. plus ..

 

On return from paypal after a successful transaction

 

Cannot redeclare class order_total

 

the temptation is to set

include(DIR_WS_CLASSES . 'order_total.php');

as

require_once(DIR_WS_CLASSES . 'order_total.php');

in paypal_ipn.php.

 

DON'T it is not the problem or the solution

 

Somewhere in the official support thread it is suggested that you change the following code in checkout_process.php

 

  require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// load the before_process function from the payment modules
 $payment_modules->before_process();

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

 $order_totals = $order_total_modules->process();

 

Leave this as standard (or modify back to standard) because this is what was causing my problem.

 

Hope this helps someone

Edited by thunderace
Link to comment
Share on other sites

  • 4 months later...

I love you people!!

 

We have Auth.net and PayPal IPN on our catalog. Adding the fix, this is what the code in checkout_process.php looks like there: (lines 50-62)

 // Need to be included before Authorizenet ADC Direct Connection
 require(DIR_WS_CLASSES . 'order.php');
 $order = new order;

// load the before_process function from the payment modules
$payment_modules->before_process();

//************************************************************
// Authorizenet ADC Direct Connection
//************************************************************

 require(DIR_WS_CLASSES . 'order_total.php');
 $order_total_modules = new order_total;

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