Jump to content

cart system 3d secure coding help


ohno

Recommended Posts

			$subtotal = $row[0];
			$delivery = $row[1];
			$discount = $row[2];
			$vatrate = $row[3];
			$totalex = str_replace(",","",$subtotal) + str_replace(",","",$delivery);
			$vatamount = ($totalex - $discount) * ($vatrate/100);
			$vatamount = number_format($vatamount, 2, '.', ',');
			$total = $row[4];
			
			$centinel_total = $total * 100;
			$centinel_delivery = $delivery * 100;
			$centinel_vatamount = $vatamount * 100;

I've got a custom written cart system which for some reason is not passing the correct amounts to our 3D secure processor (Cardinel commerce). I'm not a programmer but looking at how it seems to work I think the issue is with this code. From the processor logs we are passing the tax value with a negative amount and the total is always £1 when the total is above £1000. It all works fine as it should if the total amount is LESS than £1000! Anyone got any ideas what's going on? I'm more than happy to pay someone to fix this!!

 

 

 

 

 

 

Link to comment
Share on other sites

Hi David, I'm really glad you replied as you helped me out in the past! I lost your contact details as my hard drive failed and the backup I had failed too! I lost all my emails & contacts and baby photo's etc. Anyway, I'll give that a go, I think you are on the right lines as it seems weird why it would all work under £1000 but go completely wrong when £1000 or above. If that doesn't work would you be interested in looking into it for me? Obviously I'll pay you for your time :) Thanks, Dave

Link to comment
Share on other sites

You sir are a genius! It now passes the correct amount, will that line of code only affect the $centinel_total string? The tax amount isn't used by them but their logs show an incorrect amount there too, would I just add the same sort of thing above the $centinel_vatamont string?

Link to comment
Share on other sites

You sir are a genius! It now passes the correct amount, will that line of code only affect the $centinel_total string? The tax amount isn't used by them but their logs show an incorrect amount there too, would I just add the same sort of thing above the $centinel_vatamont string?

 

Someplace in the code that is not shown it is inserting commas to separate thousands digits, I'm sure to make it easier for humans to read. I suspect it does it for the tax too but I can't tell without see the code in question. In any case, you'd need a very expensive cart to have taxes that high and a similar line to strip the commas would work.

 

Barand is right - you should not store the values with the commas but we'd need to see all of the code to properly fix it.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

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

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.