SilverCart Forum

We moderate this Forum and we're here to help. Have you already run a forum search to check if your problem has already been solved?

You can help us helping you by providing detailed error messages, screenshots and logfile entries.

SebastianRamon

Page: 1 , 2
Topic US Taxes 15617 Views

Re: US Taxes

13 November 2013 at 9:28am

Sebastian, thank you very much again!
I still have to learn a lot more about SilverStripe, Controller::curr() is one thing I've just learnt from you :)

Best Regard,
Szabesz

Re: US Taxes

13 November 2013 at 3:33pm Last edited: 13 November 2013 3:43pm

Hi Sebastian,

The overwritten getTaxRate() seems to work fine, as long as I do not want to pay with PayPal. I only have to overwrite the tax rate when shipping is to the same state as the company selling the goods is in. In our case it is Indiana. My shop and customers are set to use (gross)* net prices, because normally I do not need tax at all, and only need added tax in the case of Indiana.

This is how the cart looks when we have the added tax rate:

The exact rate is not shown in the position list, because I did not wand to spend too much time on it, but otherwise the order would be good, if PayPal accepted it, but it did not.

The PayPal error log says: 'The totals of the cart item amounts do not match order amounts.'

So overwriting getTaxRate() is not enough, in case of PayPal payments. What else should I do? There are no details about the amounts in the error log, but I suppose the problem is that 118 != 126.26 (in case of the screenshots' example). So somehow subtotal is sent to PayPal as well, I suppose.

thanx in advance
Szabesz

*edit: net, and not gross prices are used...

Re: US Taxes

14 November 2013 at 9:09pm Last edited: 14 November 2013 9:09pm

Hi Sebastian,

OK, again, I've hacked the core to fix it :) Well, you know, this is the fastest way to fix things :P

First of all, sorry for posting this is this topic, but my whole saga has started as need for a simple field of "State"...

So my hack is:

In "class SilvercartPaymentPaypal", I added the tax amount to the net price, like this (+ $positionTaxAmt):

$parameters['L_PAYMENTREQUEST_0_AMT'.$itemCount] =
round((float) $shoppingCartPosition->getPrice()->getAmount(), 2) + $positionTaxAmt;

And a bit later, I added this (right after foreach), this way the calculation on PayPal's part is going to be OK:

$parameters['PAYMENTREQUEST_0_ITEMAMT'] = 0.0;


I have not check what "getTaxableAmountGrossWithoutFees()->getAmount()" does, but my addition (+ $positionTaxAmt) is only working when PAYMENTREQUEST_0_ITEMAMT is 0, since anything else would mess up PayPal's calculation.

Maybe you have a better solution. What do you think?
thanx in advance
Szabesz